@prefecthq/graphs 2.2.10 → 2.2.12

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(Ft,z){typeof exports=="object"&&typeof module<"u"?z(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"],z):(Ft=typeof globalThis<"u"?globalThis:Ft||self,z(Ft["prefect-graphs"]={},Ft.Vue,Ft.vueCompositions,Ft.prefectDesign))})(this,function(Ft,z,_r,zi){"use strict";var FM=Object.defineProperty;var DM=(Ft,z,_r)=>z in Ft?FM(Ft,z,{enumerable:!0,configurable:!0,writable:!0,value:_r}):Ft[z]=_r;var Tf=(Ft,z,_r)=>(DM(Ft,typeof z!="symbol"?z+"":z,_r),_r);const Lf="nodes-container",rx="node-container",sx="edge-container";function Cl(r){const t=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&t==="[object Date]"?new r.constructor(+r):typeof r=="number"||t==="[object Number]"||typeof r=="string"||t==="[object String]"?new Date(r):new Date(NaN)}function nx(r,t){return r instanceof Date?new r.constructor(t):new Date(t)}function ox(r,t){const e=+Cl(r);return nx(r,e+t)}const oa=1e3;function ax(r,t){return ox(r,t*1e3)}function hx(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function Pf(r,t){return+Cl(r)-+Cl(t)}function lx(r,t,e){const i=Pf(r,t)/1e3;return hx(e==null?void 0:e.roundingMethod)(i)}var jr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(jr||{}),Gf=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Gf||{}),Il=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Il||{}),pt=(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))(pt||{}),_i=(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))(_i||{}),Y=(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))(Y||{}),Bs=(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))(Bs||{}),ct=(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))(ct||{}),it=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(it||{}),ji=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(ji||{}),vi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(vi||{}),wi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(wi||{}),Ce=(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))(Ce||{}),Ti=(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))(Ti||{}),Al=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Al||{}),Ye=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ye||{}),ee=(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))(ee||{}),Jt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Jt||{}),Si=(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))(Si||{});const rt={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 Rl=/iPhone/i,Nf=/iPod/i,Ff=/iPad/i,Df=/\biOS-universal(?:.+)Mac\b/i,Ml=/\bAndroid(?:.+)Mobile\b/i,kf=/Android/i,Ws=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,aa=/Silk/i,Ji=/Windows Phone/i,Of=/\bWindows(?:.+)ARM\b/i,Bf=/BlackBerry/i,Wf=/BB10/i,Uf=/Opera Mini/i,Xf=/\b(CriOS|Chrome)(?:.+)Mobile/i,Zf=/Mobile(?:.+)Firefox\b/i,Vf=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function cx(r){return function(t){return t.test(r)}}function Hf(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=cx(e),n={apple:{phone:s(Rl)&&!s(Ji),ipod:s(Nf),tablet:!s(Rl)&&(s(Ff)||Vf(t))&&!s(Ji),universal:s(Df),device:(s(Rl)||s(Nf)||s(Ff)||s(Df)||Vf(t))&&!s(Ji)},amazon:{phone:s(Ws),tablet:!s(Ws)&&s(aa),device:s(Ws)||s(aa)},android:{phone:!s(Ji)&&s(Ws)||!s(Ji)&&s(Ml),tablet:!s(Ji)&&!s(Ws)&&!s(Ml)&&(s(aa)||s(kf)),device:!s(Ji)&&(s(Ws)||s(aa)||s(Ml)||s(kf))||s(/\bokhttp\b/i)},windows:{phone:s(Ji),tablet:s(Of),device:s(Ji)||s(Of)},other:{blackberry:s(Bf),blackberry10:s(Wf),opera:s(Uf),firefox:s(Zf),chrome:s(Xf),device:s(Bf)||s(Wf)||s(Uf)||s(Zf)||s(Xf)},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 ux=Hf.default??Hf,$i=ux(globalThis.navigator);rt.RETINA_PREFIX=/@([0-9\.]+)x/,rt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Us(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function dx(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 Kf={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,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,u||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],f]:h._events[m].push(f):(h._events[m]=f,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=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,m=new Array(f);d<f;d++)m[d]=u[d].fn;return m},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,d,f,m){var p=e?e+l:l;if(!this._events[p])return!1;var g=this._events[p],y=arguments.length,x,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,c),!0;case 3:return g.fn.call(g.context,c,u),!0;case 4:return g.fn.call(g.context,c,u,d),!0;case 5:return g.fn.call(g.context,c,u,d,f),!0;case 6:return g.fn.call(g.context,c,u,d,f,m),!0}for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];g.fn.apply(g.context,x)}else{var v=g.length,T;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,c);break;case 3:g[b].fn.call(g[b].context,c,u);break;case 4:g[b].fn.call(g[b].context,c,u,d);break;default:if(!x)for(T=1,x=new Array(y-1);T<y;T++)x[T-1]=arguments[T];g[b].fn.apply(g[b].context,x)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,d){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return o(this,f),this;var m=this._events[f];if(m.fn)m.fn===c&&(!d||m.once)&&(!u||m.context===u)&&o(this,f);else{for(var p=0,g=[],y=m.length;p<y;p++)(m[p].fn!==c||d&&!m[p].once||u&&m[p].context!==u)&&g.push(m[p]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(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})(Kf);var fx=Kf.exports;const Hn=Us(fx);var Ll={exports:{}};Ll.exports=ha,Ll.exports.default=ha;function ha(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Yf(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,c,u,d,f;if(i&&(n=bx(r,t,n,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var m=e;m<s;m+=e)u=r[m],d=r[m+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return Kn(n,o,e,a,h,f,0),o}function Yf(r,t,e,i,s){var n,o;if(s===Nl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Jf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Jf(n,r[n],r[n+1],o);return o&&la(o,o.next)&&(zn(o),o=o.next),o}function Jr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(la(e,e.next)||Ut(e.prev,e,e.next)===0)){if(zn(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&&Tx(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?mx(r,i,s,n):px(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),zn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=gx(Jr(r),t,e),Kn(r,t,e,i,s,n,2)):o===2&&yx(r,t,e,i,s,n):Kn(Jr(r),t,e,i,s,n,1);break}}}}function px(r){var t=r.prev,e=r,i=r.next;if(Ut(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,c=s<n?s<o?s:o:n<o?n:o,u=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,f=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=f&&Xs(s,a,n,h,o,l,m.x,m.y)&&Ut(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function mx(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Ut(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,c=s.y,u=n.y,d=o.y,f=a<h?a<l?a:l:h<l?h:l,m=c<u?c<d?c:d:u<d?u:d,p=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,y=Pl(f,m,t,e,i),x=Pl(p,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=x;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Xs(a,c,h,u,l,d,b.x,b.y)&&Ut(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=p&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Xs(a,c,h,u,l,d,v.x,v.y)&&Ut(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Xs(a,c,h,u,l,d,b.x,b.y)&&Ut(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=p&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Xs(a,c,h,u,l,d,v.x,v.y)&&Ut(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function gx(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!la(s,n)&&zf(s,i,i.next,n)&&Yn(s,n)&&Yn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),zn(i),zn(i.next),i=r=n),i=i.next}while(i!==r);return Jr(i)}function yx(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Cx(o,a)){var h=jf(o,a);o=Jr(o,o.next),h=Jr(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 bx(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=Yf(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(Ex(l));for(s.sort(xx),n=0;n<s.length;n++)e=_x(s[n],e);return e}function xx(r,t){return r.x-t.x}function _x(r,t){var e=vx(r,t);if(!e)return t;var i=jf(e,r);return Jr(i,i.next),Jr(e,e.next)}function vx(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,c=o.y,u=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&Xs(s<c?i:n,s,l,c,s<c?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Yn(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&wx(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function wx(r,t){return Ut(r.prev,r,t.prev)<0&&Ut(t.next,r,r.next)<0}function Tx(r,t,e,i){var s=r;do s.z===0&&(s.z=Pl(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,Sx(s)}function Sx(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 Pl(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 Ex(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 Xs(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 Cx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Ix(r,t)&&(Yn(r,t)&&Yn(t,r)&&Ax(r,t)&&(Ut(r.prev,r,t.prev)||Ut(r,t.prev,t))||la(r,t)&&Ut(r.prev,r,r.next)>0&&Ut(t.prev,t,t.next)>0)}function Ut(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function la(r,t){return r.x===t.x&&r.y===t.y}function zf(r,t,e,i){var s=ua(Ut(r,t,e)),n=ua(Ut(r,t,i)),o=ua(Ut(e,i,r)),a=ua(Ut(e,i,t));return!!(s!==n&&o!==a||s===0&&ca(r,e,t)||n===0&&ca(r,i,t)||o===0&&ca(e,r,i)||a===0&&ca(e,t,i))}function ca(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 ua(r){return r>0?1:r<0?-1:0}function Ix(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&&zf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Yn(r,t){return Ut(r.prev,r,r.next)<0?Ut(r,t,r.next)>=0&&Ut(r,r.prev,t)>=0:Ut(r,t,r.prev)<0||Ut(r,r.next,t)<0}function Ax(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 jf(r,t){var e=new Gl(r.i,r.x,r.y),i=new Gl(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 Jf(r,t,e,i){var s=new Gl(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 zn(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 Gl(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}ha.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(Nl(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:r.length;o-=Math.abs(Nl(r,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,m=i[a+2]*e;u+=Math.abs((r[d]-r[m])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[m+1]-r[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Nl(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}ha.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 Rx=Ll.exports;const Mx=Us(Rx);var da={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */da.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof ve=="object"&&ve;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,c=26,u=38,d=700,f=72,m=128,p="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\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,T=Math.floor,S=String.fromCharCode,C;function I(D){throw new RangeError(b[D])}function R(D,G){for(var V=D.length,tt=[];V--;)tt[V]=G(D[V]);return tt}function P(D,G){var V=D.split("@"),tt="";V.length>1&&(tt=V[0]+"@",D=V[1]),D=D.replace(x,".");var ft=D.split("."),at=R(ft,G).join(".");return tt+at}function N(D){for(var G=[],V=0,tt=D.length,ft,at;V<tt;)ft=D.charCodeAt(V++),ft>=55296&&ft<=56319&&V<tt?(at=D.charCodeAt(V++),(at&64512)==56320?G.push(((ft&1023)<<10)+(at&1023)+65536):(G.push(ft),V--)):G.push(ft);return G}function F(D){return R(D,function(G){var V="";return G>65535&&(G-=65536,V+=S(G>>>10&1023|55296),G=56320|G&1023),V+=S(G),V}).join("")}function A(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:h}function k(D,G){return D+22+75*(D<26)-((G!=0)<<5)}function Z(D,G,V){var tt=0;for(D=V?T(D/d):D>>1,D+=T(D/G);D>v*c>>1;tt+=h)D=T(D/v);return T(tt+(v+1)*D/(D+u))}function K(D){var G=[],V=D.length,tt,ft=0,at=m,Tt=f,It,et,X,$,j,O,mt,yt,Mt;for(It=D.lastIndexOf(p),It<0&&(It=0),et=0;et<It;++et)D.charCodeAt(et)>=128&&I("not-basic"),G.push(D.charCodeAt(et));for(X=It>0?It+1:0;X<V;){for($=ft,j=1,O=h;X>=V&&I("invalid-input"),mt=A(D.charCodeAt(X++)),(mt>=h||mt>T((a-ft)/j))&&I("overflow"),ft+=mt*j,yt=O<=Tt?l:O>=Tt+c?c:O-Tt,!(mt<yt);O+=h)Mt=h-yt,j>T(a/Mt)&&I("overflow"),j*=Mt;tt=G.length+1,Tt=Z(ft-$,tt,$==0),T(ft/tt)>a-at&&I("overflow"),at+=T(ft/tt),ft%=tt,G.splice(ft++,0,at)}return F(G)}function H(D){var G,V,tt,ft,at,Tt,It,et,X,$,j,O=[],mt,yt,Mt,Nt;for(D=N(D),mt=D.length,G=m,V=0,at=f,Tt=0;Tt<mt;++Tt)j=D[Tt],j<128&&O.push(S(j));for(tt=ft=O.length,ft&&O.push(p);tt<mt;){for(It=a,Tt=0;Tt<mt;++Tt)j=D[Tt],j>=G&&j<It&&(It=j);for(yt=tt+1,It-G>T((a-V)/yt)&&I("overflow"),V+=(It-G)*yt,G=It,Tt=0;Tt<mt;++Tt)if(j=D[Tt],j<G&&++V>a&&I("overflow"),j==G){for(et=V,X=h;$=X<=at?l:X>=at+c?c:X-at,!(et<$);X+=h)Nt=et-$,Mt=h-$,O.push(S(k($+Nt%Mt,0))),et=T(Nt/Mt);O.push(S(k(et,0))),at=Z(V,yt,tt==ft),V=0,++tt}++V,++G}return O.join("")}function J(D){return P(D,function(G){return g.test(G)?K(G.slice(4).toLowerCase()):G})}function B(D){return P(D,function(G){return y.test(G)?"xn--"+H(G):G})}if(o={version:"1.4.1",ucs2:{decode:N,encode:F},decode:K,encode:H,toASCII:B,toUnicode:J},i&&s)if(r.exports==i)s.exports=o;else for(C in o)o.hasOwnProperty(C)&&(i[C]=o[C]);else e.punycode=o})(ve)}(da,da.exports);var Lx=da.exports,Px=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},$f=typeof Symbol<"u"&&Symbol,Gx=Px,Nx=function(){return typeof $f!="function"||typeof Symbol!="function"||typeof $f("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Gx()},Qf={foo:{}},Fx=Object,Dx=function(){return{__proto__:Qf}.foo===Qf.foo&&!({__proto__:null}instanceof Fx)},kx="Function.prototype.bind called on incompatible ",Fl=Array.prototype.slice,Ox=Object.prototype.toString,Bx="[object Function]",Wx=function(t){var e=this;if(typeof e!="function"||Ox.call(e)!==Bx)throw new TypeError(kx+e);for(var i=Fl.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Fl.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Fl.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},Ux=Wx,Dl=Function.prototype.bind||Ux,Xx=Dl,Zx=Xx.call(Function.call,Object.prototype.hasOwnProperty),St,Zs=SyntaxError,qf=Function,Vs=TypeError,kl=function(r){try{return qf('"use strict"; return ('+r+").constructor;")()}catch{}},$r=Object.getOwnPropertyDescriptor;if($r)try{$r({},"")}catch{$r=null}var Ol=function(){throw new Vs},Vx=$r?function(){try{return arguments.callee,Ol}catch{try{return $r(arguments,"callee").get}catch{return Ol}}}():Ol,Hs=Nx(),Hx=Dx(),ne=Object.getPrototypeOf||(Hx?function(r){return r.__proto__}:null),Ks={},Kx=typeof Uint8Array>"u"||!ne?St:ne(Uint8Array),Qr={"%AggregateError%":typeof AggregateError>"u"?St:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?St:ArrayBuffer,"%ArrayIteratorPrototype%":Hs&&ne?ne([][Symbol.iterator]()):St,"%AsyncFromSyncIteratorPrototype%":St,"%AsyncFunction%":Ks,"%AsyncGenerator%":Ks,"%AsyncGeneratorFunction%":Ks,"%AsyncIteratorPrototype%":Ks,"%Atomics%":typeof Atomics>"u"?St:Atomics,"%BigInt%":typeof BigInt>"u"?St:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?St:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?St:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?St:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?St:Float32Array,"%Float64Array%":typeof Float64Array>"u"?St:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?St:FinalizationRegistry,"%Function%":qf,"%GeneratorFunction%":Ks,"%Int8Array%":typeof Int8Array>"u"?St:Int8Array,"%Int16Array%":typeof Int16Array>"u"?St:Int16Array,"%Int32Array%":typeof Int32Array>"u"?St:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Hs&&ne?ne(ne([][Symbol.iterator]())):St,"%JSON%":typeof JSON=="object"?JSON:St,"%Map%":typeof Map>"u"?St:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Hs||!ne?St:ne(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?St:Promise,"%Proxy%":typeof Proxy>"u"?St:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?St:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?St:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Hs||!ne?St:ne(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?St:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Hs&&ne?ne(""[Symbol.iterator]()):St,"%Symbol%":Hs?Symbol:St,"%SyntaxError%":Zs,"%ThrowTypeError%":Vx,"%TypedArray%":Kx,"%TypeError%":Vs,"%Uint8Array%":typeof Uint8Array>"u"?St:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?St:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?St:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?St:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?St:WeakMap,"%WeakRef%":typeof WeakRef>"u"?St:WeakRef,"%WeakSet%":typeof WeakSet>"u"?St:WeakSet};if(ne)try{null.error}catch(r){var Yx=ne(ne(r));Qr["%Error.prototype%"]=Yx}var zx=function r(t){var e;if(t==="%AsyncFunction%")e=kl("async function () {}");else if(t==="%GeneratorFunction%")e=kl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=kl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&ne&&(e=ne(s.prototype))}return Qr[t]=e,e},tp={"%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"]},jn=Dl,fa=Zx,jx=jn.call(Function.call,Array.prototype.concat),Jx=jn.call(Function.apply,Array.prototype.splice),ep=jn.call(Function.call,String.prototype.replace),pa=jn.call(Function.call,String.prototype.slice),$x=jn.call(Function.call,RegExp.prototype.exec),Qx=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,qx=/\\(\\)?/g,t_=function(t){var e=pa(t,0,1),i=pa(t,-1);if(e==="%"&&i!=="%")throw new Zs("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Zs("invalid intrinsic syntax, expected opening `%`");var s=[];return ep(t,Qx,function(n,o,a,h){s[s.length]=a?ep(h,qx,"$1"):o||n}),s},e_=function(t,e){var i=t,s;if(fa(tp,i)&&(s=tp[i],i="%"+s[0]+"%"),fa(Qr,i)){var n=Qr[i];if(n===Ks&&(n=zx(i)),typeof n>"u"&&!e)throw new Vs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Zs("intrinsic "+t+" does not exist!")},Bl=function(t,e){if(typeof t!="string"||t.length===0)throw new Vs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Vs('"allowMissing" argument must be a boolean');if($x(/^%?[^%]*%?$/,t)===null)throw new Zs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=t_(t),s=i.length>0?i[0]:"",n=e_("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Jx(i,jx([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=pa(d,0,1),m=pa(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new Zs("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",fa(Qr,o))a=Qr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Vs("base intrinsic for "+t+" exists, but the property is not available.");return}if($r&&c+1>=i.length){var p=$r(a,d);u=!!p,u&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[d]}else u=fa(a,d),a=a[d];u&&!h&&(Qr[o]=a)}}return a},ip={exports:{}};(function(r){var t=Dl,e=Bl,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(u){var d=n(t,s,arguments);if(o&&a){var f=o(d,"length");f.configurable&&a(d,"length",{value:1+h(0,u.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})(ip);var i_=ip.exports,rp=Bl,sp=i_,r_=sp(rp("String.prototype.indexOf")),s_=function(t,e){var i=rp(t,!!e);return typeof i=="function"&&r_(t,".prototype.")>-1?sp(i):i};const n_=dx(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Wl=typeof Map=="function"&&Map.prototype,Ul=Object.getOwnPropertyDescriptor&&Wl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ma=Wl&&Ul&&typeof Ul.get=="function"?Ul.get:null,np=Wl&&Map.prototype.forEach,Xl=typeof Set=="function"&&Set.prototype,Zl=Object.getOwnPropertyDescriptor&&Xl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ga=Xl&&Zl&&typeof Zl.get=="function"?Zl.get:null,op=Xl&&Set.prototype.forEach,o_=typeof WeakMap=="function"&&WeakMap.prototype,Jn=o_?WeakMap.prototype.has:null,a_=typeof WeakSet=="function"&&WeakSet.prototype,$n=a_?WeakSet.prototype.has:null,h_=typeof WeakRef=="function"&&WeakRef.prototype,ap=h_?WeakRef.prototype.deref:null,l_=Boolean.prototype.valueOf,c_=Object.prototype.toString,u_=Function.prototype.toString,d_=String.prototype.match,Vl=String.prototype.slice,vr=String.prototype.replace,f_=String.prototype.toUpperCase,hp=String.prototype.toLowerCase,lp=RegExp.prototype.test,cp=Array.prototype.concat,Ei=Array.prototype.join,p_=Array.prototype.slice,up=Math.floor,Hl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Kl=Object.getOwnPropertySymbols,Yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ys=typeof Symbol=="function"&&typeof Symbol.iterator=="object",pe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ys||!0)?Symbol.toStringTag:null,dp=Object.prototype.propertyIsEnumerable,fp=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function pp(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||lp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-up(-r):up(r);if(i!==r){var s=String(i),n=Vl.call(t,s.length+1);return vr.call(s,e,"$&_")+"."+vr.call(vr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return vr.call(t,e,"$&_")}var zl=n_,mp=zl.custom,gp=xp(mp)?mp:null,m_=function r(t,e,i,s){var n=e||{};if(wr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(wr(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=wr(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(wr(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(wr(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 vp(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?pp(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?pp(t,l):l}var c=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return jl(t)?"[Array]":"[Object]";var u=G_(n,i);if(typeof s>"u")s=[];else if(_p(s,t)>=0)return"[Circular]";function d(A,k,Z){if(k&&(s=p_.call(s),s.push(k)),Z){var K={depth:n.depth};return wr(n,"quoteStyle")&&(K.quoteStyle=n.quoteStyle),r(A,K,i+1,s)}return r(A,n,i+1,s)}if(typeof t=="function"&&!bp(t)){var f=S_(t),m=ya(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+Ei.call(m,", ")+" }":"")}if(xp(t)){var p=Ys?vr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yl.call(t);return typeof t=="object"&&!Ys?Qn(p):p}if(M_(t)){for(var g="<"+hp.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+yp(g_(y[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+hp.call(String(t.nodeName))+">",g}if(jl(t)){if(t.length===0)return"[]";var b=ya(t,d);return u&&!P_(b)?"["+$l(b,u)+"]":"[ "+Ei.call(b,", ")+" ]"}if(b_(t)){var v=ya(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!dp.call(t,"cause")?"{ ["+String(t)+"] "+Ei.call(cp.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ei.call(v,", ")+" }"}if(typeof t=="object"&&o){if(gp&&typeof t[gp]=="function"&&zl)return zl(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(E_(t)){var T=[];return np&&np.call(t,function(A,k){T.push(d(k,t,!0)+" => "+d(A,t))}),wp("Map",ma.call(t),T,u)}if(A_(t)){var S=[];return op&&op.call(t,function(A){S.push(d(A,t))}),wp("Set",ga.call(t),S,u)}if(C_(t))return Jl("WeakMap");if(R_(t))return Jl("WeakSet");if(I_(t))return Jl("WeakRef");if(__(t))return Qn(d(Number(t)));if(w_(t))return Qn(d(Hl.call(t)));if(v_(t))return Qn(l_.call(t));if(x_(t))return Qn(d(String(t)));if(!y_(t)&&!bp(t)){var C=ya(t,d),I=fp?fp(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",P=!I&&pe&&Object(t)===t&&pe in t?Vl.call(Tr(t),8,-1):R?"Object":"",N=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",F=N+(P||R?"["+Ei.call(cp.call([],P||[],R||[]),": ")+"] ":"");return C.length===0?F+"{}":u?F+"{"+$l(C,u)+"}":F+"{ "+Ei.call(C,", ")+" }"}return String(t)};function yp(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function g_(r){return vr.call(String(r),/"/g,"&quot;")}function jl(r){return Tr(r)==="[object Array]"&&(!pe||!(typeof r=="object"&&pe in r))}function y_(r){return Tr(r)==="[object Date]"&&(!pe||!(typeof r=="object"&&pe in r))}function bp(r){return Tr(r)==="[object RegExp]"&&(!pe||!(typeof r=="object"&&pe in r))}function b_(r){return Tr(r)==="[object Error]"&&(!pe||!(typeof r=="object"&&pe in r))}function x_(r){return Tr(r)==="[object String]"&&(!pe||!(typeof r=="object"&&pe in r))}function __(r){return Tr(r)==="[object Number]"&&(!pe||!(typeof r=="object"&&pe in r))}function v_(r){return Tr(r)==="[object Boolean]"&&(!pe||!(typeof r=="object"&&pe in r))}function xp(r){if(Ys)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Yl)return!1;try{return Yl.call(r),!0}catch{}return!1}function w_(r){if(!r||typeof r!="object"||!Hl)return!1;try{return Hl.call(r),!0}catch{}return!1}var T_=Object.prototype.hasOwnProperty||function(r){return r in this};function wr(r,t){return T_.call(r,t)}function Tr(r){return c_.call(r)}function S_(r){if(r.name)return r.name;var t=d_.call(u_.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function _p(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 E_(r){if(!ma||!r||typeof r!="object")return!1;try{ma.call(r);try{ga.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function C_(r){if(!Jn||!r||typeof r!="object")return!1;try{Jn.call(r,Jn);try{$n.call(r,$n)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function I_(r){if(!ap||!r||typeof r!="object")return!1;try{return ap.call(r),!0}catch{}return!1}function A_(r){if(!ga||!r||typeof r!="object")return!1;try{ga.call(r);try{ma.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function R_(r){if(!$n||!r||typeof r!="object")return!1;try{$n.call(r,$n);try{Jn.call(r,Jn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function M_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function vp(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return vp(Vl.call(r,0,t.maxStringLength),t)+i}var s=vr.call(vr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,L_);return yp(s,"single",t)}function L_(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":"")+f_.call(t.toString(16))}function Qn(r){return"Object("+r+")"}function Jl(r){return r+" { ? }"}function wp(r,t,e,i){var s=i?$l(e,i):Ei.call(e,", ");return r+" ("+t+") {"+s+"}"}function P_(r){for(var t=0;t<r.length;t++)if(_p(r[t],`
1
+ (function(Ft,z){typeof exports=="object"&&typeof module<"u"?z(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"],z):(Ft=typeof globalThis<"u"?globalThis:Ft||self,z(Ft["prefect-graphs"]={},Ft.Vue,Ft.vueCompositions,Ft.prefectDesign))})(this,function(Ft,z,_r,zi){"use strict";var NM=Object.defineProperty;var DM=(Ft,z,_r)=>z in Ft?NM(Ft,z,{enumerable:!0,configurable:!0,writable:!0,value:_r}):Ft[z]=_r;var Tf=(Ft,z,_r)=>(DM(Ft,typeof z!="symbol"?z+"":z,_r),_r);const Lf="nodes-container",rx="node-container",sx="edge-container";function Cl(r){const t=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&t==="[object Date]"?new r.constructor(+r):typeof r=="number"||t==="[object Number]"||typeof r=="string"||t==="[object String]"?new Date(r):new Date(NaN)}function nx(r,t){return r instanceof Date?new r.constructor(t):new Date(t)}function ox(r,t){const e=+Cl(r);return nx(r,e+t)}const aa=1e3;function ax(r,t){return ox(r,t*1e3)}function hx(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function Pf(r,t){return+Cl(r)-+Cl(t)}function lx(r,t,e){const i=Pf(r,t)/1e3;return hx(e==null?void 0:e.roundingMethod)(i)}var Jr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Jr||{}),Gf=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Gf||{}),Il=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Il||{}),pt=(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))(pt||{}),_i=(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))(_i||{}),Y=(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))(Y||{}),Xs=(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))(Xs||{}),lt=(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))(lt||{}),it=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(it||{}),ji=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(ji||{}),vi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(vi||{}),wi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(wi||{}),Ce=(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))(Ce||{}),Ti=(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))(Ti||{}),Al=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Al||{}),Ke=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ke||{}),ie=(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))(ie||{}),Jt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Jt||{}),Si=(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))(Si||{});const rt={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 Rl=/iPhone/i,Ff=/iPod/i,Nf=/iPad/i,Df=/\biOS-universal(?:.+)Mac\b/i,Ml=/\bAndroid(?:.+)Mobile\b/i,kf=/Android/i,Zs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ha=/Silk/i,Ji=/Windows Phone/i,Of=/\bWindows(?:.+)ARM\b/i,Bf=/BlackBerry/i,Uf=/BB10/i,Wf=/Opera Mini/i,Xf=/\b(CriOS|Chrome)(?:.+)Mobile/i,Zf=/Mobile(?:.+)Firefox\b/i,Vf=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function cx(r){return function(t){return t.test(r)}}function Hf(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=cx(e),n={apple:{phone:s(Rl)&&!s(Ji),ipod:s(Ff),tablet:!s(Rl)&&(s(Nf)||Vf(t))&&!s(Ji),universal:s(Df),device:(s(Rl)||s(Ff)||s(Nf)||s(Df)||Vf(t))&&!s(Ji)},amazon:{phone:s(Zs),tablet:!s(Zs)&&s(ha),device:s(Zs)||s(ha)},android:{phone:!s(Ji)&&s(Zs)||!s(Ji)&&s(Ml),tablet:!s(Ji)&&!s(Zs)&&!s(Ml)&&(s(ha)||s(kf)),device:!s(Ji)&&(s(Zs)||s(ha)||s(Ml)||s(kf))||s(/\bokhttp\b/i)},windows:{phone:s(Ji),tablet:s(Of),device:s(Ji)||s(Of)},other:{blackberry:s(Bf),blackberry10:s(Uf),opera:s(Wf),firefox:s(Zf),chrome:s(Xf),device:s(Bf)||s(Uf)||s(Wf)||s(Zf)||s(Xf)},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 ux=Hf.default??Hf,$i=ux(globalThis.navigator);rt.RETINA_PREFIX=/@([0-9\.]+)x/,rt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function dx(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 Kf={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,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,u||h,d),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function 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=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);d<f;d++)p[d]=u[d].fn;return p},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,d,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,x,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,c),!0;case 3:return g.fn.call(g.context,c,u),!0;case 4:return g.fn.call(g.context,c,u,d),!0;case 5:return g.fn.call(g.context,c,u,d,f),!0;case 6:return g.fn.call(g.context,c,u,d,f,p),!0}for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];g.fn.apply(g.context,x)}else{var v=g.length,w;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,c);break;case 3:g[b].fn.call(g[b].context,c,u);break;case 4:g[b].fn.call(g[b].context,c,u,d);break;default:if(!x)for(w=1,x=new Array(y-1);w<y;w++)x[w-1]=arguments[w];g[b].fn.apply(g[b].context,x)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,d){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!u||p.context===u)&&o(this,f);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==c||d&&!p[m].once||u&&p[m].context!==u)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(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})(Kf);var fx=Kf.exports;const Kn=Vs(fx);var Ll={exports:{}};Ll.exports=la,Ll.exports.default=la;function la(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Yf(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,c,u,d,f;if(i&&(n=bx(r,t,n,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return Yn(n,o,e,a,h,f,0),o}function Yf(r,t,e,i,s){var n,o;if(s===Fl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Jf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Jf(n,r[n],r[n+1],o);return o&&ca(o,o.next)&&(jn(o),o=o.next),o}function $r(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(ca(e,e.next)||Wt(e.prev,e,e.next)===0)){if(jn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Yn(r,t,e,i,s,n,o){if(r){!o&&n&&Tx(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?mx(r,i,s,n):px(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),jn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=gx($r(r),t,e),Yn(r,t,e,i,s,n,2)):o===2&&yx(r,t,e,i,s,n):Yn($r(r),t,e,i,s,n,1);break}}}}function px(r){var t=r.prev,e=r,i=r.next;if(Wt(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,c=s<n?s<o?s:o:n<o?n:o,u=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,f=a>h?a>l?a:l:h>l?h:l,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&Hs(s,a,n,h,o,l,p.x,p.y)&&Wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function mx(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Wt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,c=s.y,u=n.y,d=o.y,f=a<h?a<l?a:l:h<l?h:l,p=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,y=Pl(f,p,t,e,i),x=Pl(m,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Hs(a,c,h,u,l,d,b.x,b.y)&&Wt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&Hs(a,c,h,u,l,d,v.x,v.y)&&Wt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Hs(a,c,h,u,l,d,b.x,b.y)&&Wt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&Hs(a,c,h,u,l,d,v.x,v.y)&&Wt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function gx(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!ca(s,n)&&zf(s,i,i.next,n)&&zn(s,n)&&zn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),jn(i),jn(i.next),i=r=n),i=i.next}while(i!==r);return $r(i)}function yx(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Cx(o,a)){var h=jf(o,a);o=$r(o,o.next),h=$r(h,h.next),Yn(o,t,e,i,s,n,0),Yn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function bx(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=Yf(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(Ex(l));for(s.sort(xx),n=0;n<s.length;n++)e=_x(s[n],e);return e}function xx(r,t){return r.x-t.x}function _x(r,t){var e=vx(r,t);if(!e)return t;var i=jf(e,r);return $r(i,i.next),$r(e,e.next)}function vx(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,c=o.y,u=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&Hs(s<c?i:n,s,l,c,s<c?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),zn(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&wx(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function wx(r,t){return Wt(r.prev,r,t.prev)<0&&Wt(t.next,r,r.next)<0}function Tx(r,t,e,i){var s=r;do s.z===0&&(s.z=Pl(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,Sx(s)}function Sx(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 Pl(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 Ex(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 Hs(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 Cx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Ix(r,t)&&(zn(r,t)&&zn(t,r)&&Ax(r,t)&&(Wt(r.prev,r,t.prev)||Wt(r,t.prev,t))||ca(r,t)&&Wt(r.prev,r,r.next)>0&&Wt(t.prev,t,t.next)>0)}function Wt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ca(r,t){return r.x===t.x&&r.y===t.y}function zf(r,t,e,i){var s=da(Wt(r,t,e)),n=da(Wt(r,t,i)),o=da(Wt(e,i,r)),a=da(Wt(e,i,t));return!!(s!==n&&o!==a||s===0&&ua(r,e,t)||n===0&&ua(r,i,t)||o===0&&ua(e,r,i)||a===0&&ua(e,t,i))}function ua(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 da(r){return r>0?1:r<0?-1:0}function Ix(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&&zf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function zn(r,t){return Wt(r.prev,r,r.next)<0?Wt(r,t,r.next)>=0&&Wt(r,r.prev,t)>=0:Wt(r,t,r.prev)<0||Wt(r,r.next,t)<0}function Ax(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 jf(r,t){var e=new Gl(r.i,r.x,r.y),i=new Gl(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 Jf(r,t,e,i){var s=new Gl(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 jn(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 Gl(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}la.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(Fl(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:r.length;o-=Math.abs(Fl(r,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Fl(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}la.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 Rx=Ll.exports;const Mx=Vs(Rx);var fa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */fa.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof ve=="object"&&ve;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,c=26,u=38,d=700,f=72,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\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,w=Math.floor,S=String.fromCharCode,C;function I(D){throw new RangeError(b[D])}function R(D,F){for(var Z=D.length,tt=[];Z--;)tt[Z]=F(D[Z]);return tt}function P(D,F){var Z=D.split("@"),tt="";Z.length>1&&(tt=Z[0]+"@",D=Z[1]),D=D.replace(x,".");var ft=D.split("."),ot=R(ft,F).join(".");return tt+ot}function G(D){for(var F=[],Z=0,tt=D.length,ft,ot;Z<tt;)ft=D.charCodeAt(Z++),ft>=55296&&ft<=56319&&Z<tt?(ot=D.charCodeAt(Z++),(ot&64512)==56320?F.push(((ft&1023)<<10)+(ot&1023)+65536):(F.push(ft),Z--)):F.push(ft);return F}function N(D){return R(D,function(F){var Z="";return F>65535&&(F-=65536,Z+=S(F>>>10&1023|55296),F=56320|F&1023),Z+=S(F),Z}).join("")}function A(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:h}function k(D,F){return D+22+75*(D<26)-((F!=0)<<5)}function V(D,F,Z){var tt=0;for(D=Z?w(D/d):D>>1,D+=w(D/F);D>v*c>>1;tt+=h)D=w(D/v);return w(tt+(v+1)*D/(D+u))}function K(D){var F=[],Z=D.length,tt,ft=0,ot=p,Et=f,Mt,bt,B,j,J,O,gt,ut,It;for(Mt=D.lastIndexOf(m),Mt<0&&(Mt=0),bt=0;bt<Mt;++bt)D.charCodeAt(bt)>=128&&I("not-basic"),F.push(D.charCodeAt(bt));for(B=Mt>0?Mt+1:0;B<Z;){for(j=ft,J=1,O=h;B>=Z&&I("invalid-input"),gt=A(D.charCodeAt(B++)),(gt>=h||gt>w((a-ft)/J))&&I("overflow"),ft+=gt*J,ut=O<=Et?l:O>=Et+c?c:O-Et,!(gt<ut);O+=h)It=h-ut,J>w(a/It)&&I("overflow"),J*=It;tt=F.length+1,Et=V(ft-j,tt,j==0),w(ft/tt)>a-ot&&I("overflow"),ot+=w(ft/tt),ft%=tt,F.splice(ft++,0,ot)}return N(F)}function H(D){var F,Z,tt,ft,ot,Et,Mt,bt,B,j,J,O=[],gt,ut,It,Dt;for(D=G(D),gt=D.length,F=p,Z=0,ot=f,Et=0;Et<gt;++Et)J=D[Et],J<128&&O.push(S(J));for(tt=ft=O.length,ft&&O.push(m);tt<gt;){for(Mt=a,Et=0;Et<gt;++Et)J=D[Et],J>=F&&J<Mt&&(Mt=J);for(ut=tt+1,Mt-F>w((a-Z)/ut)&&I("overflow"),Z+=(Mt-F)*ut,F=Mt,Et=0;Et<gt;++Et)if(J=D[Et],J<F&&++Z>a&&I("overflow"),J==F){for(bt=Z,B=h;j=B<=ot?l:B>=ot+c?c:B-ot,!(bt<j);B+=h)Dt=bt-j,It=h-j,O.push(S(k(j+Dt%It,0))),bt=w(Dt/It);O.push(S(k(bt,0))),ot=V(Z,ut,tt==ft),Z=0,++tt}++Z,++F}return O.join("")}function $(D){return P(D,function(F){return g.test(F)?K(F.slice(4).toLowerCase()):F})}function U(D){return P(D,function(F){return y.test(F)?"xn--"+H(F):F})}if(o={version:"1.4.1",ucs2:{decode:G,encode:N},decode:K,encode:H,toASCII:U,toUnicode:$},i&&s)if(r.exports==i)s.exports=o;else for(C in o)o.hasOwnProperty(C)&&(i[C]=o[C]);else e.punycode=o})(ve)}(fa,fa.exports);var Lx=fa.exports,Px=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},$f=typeof Symbol<"u"&&Symbol,Gx=Px,Fx=function(){return typeof $f!="function"||typeof Symbol!="function"||typeof $f("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Gx()},Qf={foo:{}},Nx=Object,Dx=function(){return{__proto__:Qf}.foo===Qf.foo&&!({__proto__:null}instanceof Nx)},kx="Function.prototype.bind called on incompatible ",Nl=Array.prototype.slice,Ox=Object.prototype.toString,Bx="[object Function]",Ux=function(t){var e=this;if(typeof e!="function"||Ox.call(e)!==Bx)throw new TypeError(kx+e);for(var i=Nl.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Nl.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Nl.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},Wx=Ux,Dl=Function.prototype.bind||Wx,Xx=Dl,Zx=Xx.call(Function.call,Object.prototype.hasOwnProperty),Tt,Ks=SyntaxError,qf=Function,Ys=TypeError,kl=function(r){try{return qf('"use strict"; return ('+r+").constructor;")()}catch{}},Qr=Object.getOwnPropertyDescriptor;if(Qr)try{Qr({},"")}catch{Qr=null}var Ol=function(){throw new Ys},Vx=Qr?function(){try{return arguments.callee,Ol}catch{try{return Qr(arguments,"callee").get}catch{return Ol}}}():Ol,zs=Fx(),Hx=Dx(),oe=Object.getPrototypeOf||(Hx?function(r){return r.__proto__}:null),js={},Kx=typeof Uint8Array>"u"||!oe?Tt:oe(Uint8Array),qr={"%AggregateError%":typeof AggregateError>"u"?Tt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Tt:ArrayBuffer,"%ArrayIteratorPrototype%":zs&&oe?oe([][Symbol.iterator]()):Tt,"%AsyncFromSyncIteratorPrototype%":Tt,"%AsyncFunction%":js,"%AsyncGenerator%":js,"%AsyncGeneratorFunction%":js,"%AsyncIteratorPrototype%":js,"%Atomics%":typeof Atomics>"u"?Tt:Atomics,"%BigInt%":typeof BigInt>"u"?Tt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Tt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Tt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Tt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Tt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Tt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Tt:FinalizationRegistry,"%Function%":qf,"%GeneratorFunction%":js,"%Int8Array%":typeof Int8Array>"u"?Tt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Tt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Tt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":zs&&oe?oe(oe([][Symbol.iterator]())):Tt,"%JSON%":typeof JSON=="object"?JSON:Tt,"%Map%":typeof Map>"u"?Tt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!zs||!oe?Tt:oe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Tt:Promise,"%Proxy%":typeof Proxy>"u"?Tt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Tt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Tt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!zs||!oe?Tt:oe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Tt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":zs&&oe?oe(""[Symbol.iterator]()):Tt,"%Symbol%":zs?Symbol:Tt,"%SyntaxError%":Ks,"%ThrowTypeError%":Vx,"%TypedArray%":Kx,"%TypeError%":Ys,"%Uint8Array%":typeof Uint8Array>"u"?Tt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Tt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Tt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Tt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Tt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Tt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Tt:WeakSet};if(oe)try{null.error}catch(r){var Yx=oe(oe(r));qr["%Error.prototype%"]=Yx}var zx=function r(t){var e;if(t==="%AsyncFunction%")e=kl("async function () {}");else if(t==="%GeneratorFunction%")e=kl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=kl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&oe&&(e=oe(s.prototype))}return qr[t]=e,e},tp={"%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"]},Jn=Dl,pa=Zx,jx=Jn.call(Function.call,Array.prototype.concat),Jx=Jn.call(Function.apply,Array.prototype.splice),ep=Jn.call(Function.call,String.prototype.replace),ma=Jn.call(Function.call,String.prototype.slice),$x=Jn.call(Function.call,RegExp.prototype.exec),Qx=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,qx=/\\(\\)?/g,t_=function(t){var e=ma(t,0,1),i=ma(t,-1);if(e==="%"&&i!=="%")throw new Ks("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ks("invalid intrinsic syntax, expected opening `%`");var s=[];return ep(t,Qx,function(n,o,a,h){s[s.length]=a?ep(h,qx,"$1"):o||n}),s},e_=function(t,e){var i=t,s;if(pa(tp,i)&&(s=tp[i],i="%"+s[0]+"%"),pa(qr,i)){var n=qr[i];if(n===js&&(n=zx(i)),typeof n>"u"&&!e)throw new Ys("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Ks("intrinsic "+t+" does not exist!")},Bl=function(t,e){if(typeof t!="string"||t.length===0)throw new Ys("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ys('"allowMissing" argument must be a boolean');if($x(/^%?[^%]*%?$/,t)===null)throw new Ks("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=t_(t),s=i.length>0?i[0]:"",n=e_("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Jx(i,jx([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=ma(d,0,1),p=ma(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ks("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",pa(qr,o))a=qr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Ys("base intrinsic for "+t+" exists, but the property is not available.");return}if(Qr&&c+1>=i.length){var m=Qr(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=pa(a,d),a=a[d];u&&!h&&(qr[o]=a)}}return a},ip={exports:{}};(function(r){var t=Dl,e=Bl,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(u){var d=n(t,s,arguments);if(o&&a){var f=o(d,"length");f.configurable&&a(d,"length",{value:1+h(0,u.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})(ip);var i_=ip.exports,rp=Bl,sp=i_,r_=sp(rp("String.prototype.indexOf")),s_=function(t,e){var i=rp(t,!!e);return typeof i=="function"&&r_(t,".prototype.")>-1?sp(i):i};const n_=dx(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ul=typeof Map=="function"&&Map.prototype,Wl=Object.getOwnPropertyDescriptor&&Ul?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ga=Ul&&Wl&&typeof Wl.get=="function"?Wl.get:null,np=Ul&&Map.prototype.forEach,Xl=typeof Set=="function"&&Set.prototype,Zl=Object.getOwnPropertyDescriptor&&Xl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ya=Xl&&Zl&&typeof Zl.get=="function"?Zl.get:null,op=Xl&&Set.prototype.forEach,o_=typeof WeakMap=="function"&&WeakMap.prototype,$n=o_?WeakMap.prototype.has:null,a_=typeof WeakSet=="function"&&WeakSet.prototype,Qn=a_?WeakSet.prototype.has:null,h_=typeof WeakRef=="function"&&WeakRef.prototype,ap=h_?WeakRef.prototype.deref:null,l_=Boolean.prototype.valueOf,c_=Object.prototype.toString,u_=Function.prototype.toString,d_=String.prototype.match,Vl=String.prototype.slice,vr=String.prototype.replace,f_=String.prototype.toUpperCase,hp=String.prototype.toLowerCase,lp=RegExp.prototype.test,cp=Array.prototype.concat,Ei=Array.prototype.join,p_=Array.prototype.slice,up=Math.floor,Hl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Kl=Object.getOwnPropertySymbols,Yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Js=typeof Symbol=="function"&&typeof Symbol.iterator=="object",pe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Js||!0)?Symbol.toStringTag:null,dp=Object.prototype.propertyIsEnumerable,fp=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function pp(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||lp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-up(-r):up(r);if(i!==r){var s=String(i),n=Vl.call(t,s.length+1);return vr.call(s,e,"$&_")+"."+vr.call(vr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return vr.call(t,e,"$&_")}var zl=n_,mp=zl.custom,gp=xp(mp)?mp:null,m_=function r(t,e,i,s){var n=e||{};if(wr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(wr(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=wr(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(wr(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(wr(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 vp(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?pp(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?pp(t,l):l}var c=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return jl(t)?"[Array]":"[Object]";var u=G_(n,i);if(typeof s>"u")s=[];else if(_p(s,t)>=0)return"[Circular]";function d(A,k,V){if(k&&(s=p_.call(s),s.push(k)),V){var K={depth:n.depth};return wr(n,"quoteStyle")&&(K.quoteStyle=n.quoteStyle),r(A,K,i+1,s)}return r(A,n,i+1,s)}if(typeof t=="function"&&!bp(t)){var f=S_(t),p=ba(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ei.call(p,", ")+" }":"")}if(xp(t)){var m=Js?vr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yl.call(t);return typeof t=="object"&&!Js?qn(m):m}if(M_(t)){for(var g="<"+hp.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+yp(g_(y[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+hp.call(String(t.nodeName))+">",g}if(jl(t)){if(t.length===0)return"[]";var b=ba(t,d);return u&&!P_(b)?"["+$l(b,u)+"]":"[ "+Ei.call(b,", ")+" ]"}if(b_(t)){var v=ba(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!dp.call(t,"cause")?"{ ["+String(t)+"] "+Ei.call(cp.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ei.call(v,", ")+" }"}if(typeof t=="object"&&o){if(gp&&typeof t[gp]=="function"&&zl)return zl(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(E_(t)){var w=[];return np&&np.call(t,function(A,k){w.push(d(k,t,!0)+" => "+d(A,t))}),wp("Map",ga.call(t),w,u)}if(A_(t)){var S=[];return op&&op.call(t,function(A){S.push(d(A,t))}),wp("Set",ya.call(t),S,u)}if(C_(t))return Jl("WeakMap");if(R_(t))return Jl("WeakSet");if(I_(t))return Jl("WeakRef");if(__(t))return qn(d(Number(t)));if(w_(t))return qn(d(Hl.call(t)));if(v_(t))return qn(l_.call(t));if(x_(t))return qn(d(String(t)));if(!y_(t)&&!bp(t)){var C=ba(t,d),I=fp?fp(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",P=!I&&pe&&Object(t)===t&&pe in t?Vl.call(Tr(t),8,-1):R?"Object":"",G=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",N=G+(P||R?"["+Ei.call(cp.call([],P||[],R||[]),": ")+"] ":"");return C.length===0?N+"{}":u?N+"{"+$l(C,u)+"}":N+"{ "+Ei.call(C,", ")+" }"}return String(t)};function yp(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function g_(r){return vr.call(String(r),/"/g,"&quot;")}function jl(r){return Tr(r)==="[object Array]"&&(!pe||!(typeof r=="object"&&pe in r))}function y_(r){return Tr(r)==="[object Date]"&&(!pe||!(typeof r=="object"&&pe in r))}function bp(r){return Tr(r)==="[object RegExp]"&&(!pe||!(typeof r=="object"&&pe in r))}function b_(r){return Tr(r)==="[object Error]"&&(!pe||!(typeof r=="object"&&pe in r))}function x_(r){return Tr(r)==="[object String]"&&(!pe||!(typeof r=="object"&&pe in r))}function __(r){return Tr(r)==="[object Number]"&&(!pe||!(typeof r=="object"&&pe in r))}function v_(r){return Tr(r)==="[object Boolean]"&&(!pe||!(typeof r=="object"&&pe in r))}function xp(r){if(Js)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Yl)return!1;try{return Yl.call(r),!0}catch{}return!1}function w_(r){if(!r||typeof r!="object"||!Hl)return!1;try{return Hl.call(r),!0}catch{}return!1}var T_=Object.prototype.hasOwnProperty||function(r){return r in this};function wr(r,t){return T_.call(r,t)}function Tr(r){return c_.call(r)}function S_(r){if(r.name)return r.name;var t=d_.call(u_.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function _p(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 E_(r){if(!ga||!r||typeof r!="object")return!1;try{ga.call(r);try{ya.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function C_(r){if(!$n||!r||typeof r!="object")return!1;try{$n.call(r,$n);try{Qn.call(r,Qn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function I_(r){if(!ap||!r||typeof r!="object")return!1;try{return ap.call(r),!0}catch{}return!1}function A_(r){if(!ya||!r||typeof r!="object")return!1;try{ya.call(r);try{ga.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function R_(r){if(!Qn||!r||typeof r!="object")return!1;try{Qn.call(r,Qn);try{$n.call(r,$n)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function M_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function vp(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return vp(Vl.call(r,0,t.maxStringLength),t)+i}var s=vr.call(vr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,L_);return yp(s,"single",t)}function L_(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":"")+f_.call(t.toString(16))}function qn(r){return"Object("+r+")"}function Jl(r){return r+" { ? }"}function wp(r,t,e,i){var s=i?$l(e,i):Ei.call(e,", ");return r+" ("+t+") {"+s+"}"}function P_(r){for(var t=0;t<r.length;t++)if(_p(r[t],`
2
2
  `)>=0)return!1;return!0}function G_(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ei.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ei.call(Array(t+1),e)}}function $l(r,t){if(r.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+Ei.call(r,","+e)+`
4
- `+t.prev}function ya(r,t){var e=jl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=wr(r,s)?t(r[s],r):""}var n=typeof Kl=="function"?Kl(r):[],o;if(Ys){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)wr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Ys&&o["$"+h]instanceof Symbol||(lp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Kl=="function")for(var l=0;l<n.length;l++)dp.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Ql=Bl,zs=s_,N_=m_,F_=Ql("%TypeError%"),ba=Ql("%WeakMap%",!0),xa=Ql("%Map%",!0),D_=zs("WeakMap.prototype.get",!0),k_=zs("WeakMap.prototype.set",!0),O_=zs("WeakMap.prototype.has",!0),B_=zs("Map.prototype.get",!0),W_=zs("Map.prototype.set",!0),U_=zs("Map.prototype.has",!0),ql=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},X_=function(r,t){var e=ql(r,t);return e&&e.value},Z_=function(r,t,e){var i=ql(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},V_=function(r,t){return!!ql(r,t)},H_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new F_("Side channel does not contain "+N_(n))},get:function(n){if(ba&&n&&(typeof n=="object"||typeof n=="function")){if(t)return D_(t,n)}else if(xa){if(e)return B_(e,n)}else if(i)return X_(i,n)},has:function(n){if(ba&&n&&(typeof n=="object"||typeof n=="function")){if(t)return O_(t,n)}else if(xa){if(e)return U_(e,n)}else if(i)return V_(i,n);return!1},set:function(n,o){ba&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new ba),k_(t,n,o)):xa?(e||(e=new xa),W_(e,n,o)):(i||(i={key:{},next:null}),Z_(i,n,o))}};return s},K_=String.prototype.replace,Y_=/%20/g,tc={RFC1738:"RFC1738",RFC3986:"RFC3986"},ec={default:tc.RFC3986,formatters:{RFC1738:function(r){return K_.call(r,Y_,"+")},RFC3986:function(r){return String(r)}},RFC1738:tc.RFC1738,RFC3986:tc.RFC3986},z_=ec,ic=Object.prototype.hasOwnProperty,qr=Array.isArray,Ci=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),j_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(qr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Tp=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},J_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(qr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!ic.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 qr(t)&&!qr(e)&&(s=Tp(t,i)),qr(t)&&qr(e)?(e.forEach(function(n,o){if(ic.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 ic.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},$_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},Q_=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}},q_=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(c){return"%26%23"+parseInt(c.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===z_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+Ci[l];continue}if(l<2048){a=a+(Ci[192|l>>6]+Ci[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Ci[224|l>>12]+Ci[128|l>>6&63]+Ci[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=Ci[240|l>>18]+Ci[128|l>>12&63]+Ci[128|l>>6&63]+Ci[128|l&63]}return a},t1=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],c=o[l];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:o,prop:l}),i.push(c))}return j_(e),t},e1=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},i1=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},r1=function(t,e){return[].concat(t,e)},s1=function(t,e){if(qr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Sp={arrayToObject:Tp,assign:$_,combine:r1,compact:t1,decode:Q_,encode:q_,isBuffer:i1,isRegExp:e1,maybeMap:s1,merge:J_},Ep=H_,_a=Sp,qn=ec,n1=Object.prototype.hasOwnProperty,Cp={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Qi=Array.isArray,o1=Array.prototype.push,Ip=function(r,t){o1.apply(r,Qi(t)?t:[t])},a1=Date.prototype.toISOString,Ap=qn.default,me={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:_a.encode,encodeValuesOnly:!1,format:Ap,formatter:qn.formatters[Ap],indices:!1,serializeDate:function(t){return a1.call(t)},skipNulls:!1,strictNullHandling:!1},h1=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},rc={},l1=function r(t,e,i,s,n,o,a,h,l,c,u,d,f,m,p,g){for(var y=t,x=g,b=0,v=!1;(x=x.get(rc))!==void 0&&!v;){var T=x.get(t);if(b+=1,typeof T<"u"){if(T===b)throw new RangeError("Cyclic object value");v=!0}typeof x.get(rc)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&Qi(y)&&(y=_a.maybeMap(y,function(K){return K instanceof Date?u(K):K})),y===null){if(n)return a&&!m?a(e,me.encoder,p,"key",d):e;y=""}if(h1(y)||_a.isBuffer(y)){if(a){var S=m?e:a(e,me.encoder,p,"key",d);return[f(S)+"="+f(a(y,me.encoder,p,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var I;if(i==="comma"&&Qi(y))m&&a&&(y=_a.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(Qi(h))I=h;else{var R=Object.keys(y);I=l?R.sort(l):R}for(var P=s&&Qi(y)&&y.length===1?e+"[]":e,N=0;N<I.length;++N){var F=I[N],A=typeof F=="object"&&typeof F.value<"u"?F.value:y[F];if(!(o&&A===null)){var k=Qi(y)?typeof i=="function"?i(P,F):P:P+(c?"."+F:"["+F+"]");g.set(t,b);var Z=Ep();Z.set(rc,g),Ip(C,r(A,k,i,s,n,o,i==="comma"&&m&&Qi(y)?null:a,h,l,c,u,d,f,m,p,Z))}}return C},c1=function(t){if(!t)return me;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||me.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=qn.default;if(typeof t.format<"u"){if(!n1.call(qn.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=qn.formatters[i],n=me.filter;return(typeof t.filter=="function"||Qi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:me.addQueryPrefix,allowDots:typeof t.allowDots>"u"?me.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:me.charsetSentinel,delimiter:typeof t.delimiter>"u"?me.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:me.encode,encoder:typeof t.encoder=="function"?t.encoder:me.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:me.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:me.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:me.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:me.strictNullHandling}},u1=function(r,t){var e=r,i=c1(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Qi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Cp?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=Cp[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 c=Ep(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||Ip(o,l1(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,c))}var f=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&"),f.length>0?m+f:""},js=Sp,sc=Object.prototype.hasOwnProperty,d1=Array.isArray,oe={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:js.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},f1=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Rp=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},p1="utf8=%26%2310003%3B",m1="utf8=%E2%9C%93",g1=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]===m1?l="utf-8":o[h]===p1&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var c=o[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,m;d===-1?(f=e.decoder(c,oe.decoder,l,"key"),m=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),oe.decoder,l,"key"),m=js.maybeMap(Rp(c.slice(d+1),e),function(p){return e.decoder(p,oe.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=f1(m)),c.indexOf("[]=")>-1&&(m=d1(m)?[m]:m),sc.call(i,f)?i[f]=js.combine(i[f],m):i[f]=m}return i},y1=function(r,t,e,i){for(var s=i?t:Rp(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},b1=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,c=[];if(l){if(!i.plainObjects&&sc.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(n))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&sc.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),y1(c,e,i,s)}},x1=function(t){if(!t)return oe;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"?oe.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?oe.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:oe.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:oe.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:oe.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:oe.comma,decoder:typeof t.decoder=="function"?t.decoder:oe.decoder,delimiter:typeof t.delimiter=="string"||js.isRegExp(t.delimiter)?t.delimiter:oe.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:oe.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:oe.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:oe.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:oe.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}},_1=function(r,t){var e=x1(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?g1(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=b1(a,i[a],e,typeof r=="string");s=js.merge(s,h,e)}return e.allowSparse===!0?s:js.compact(s)},v1=u1,w1=_1,T1=ec,S1={formats:T1,parse:w1,stringify:v1},E1=Lx;function qi(){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 C1=/^([a-z0-9.+-]+:)/i,I1=/:[0-9]*$/,A1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,R1=["<",">",'"',"`"," ","\r",`
5
- `," "],M1=["{","}","|","\\","^","`"].concat(R1),nc=["'"].concat(M1),Mp=["%","/","?",";","#"].concat(nc),Lp=["/","?","#"],L1=255,Pp=/^[+a-z0-9A-Z_-]{0,63}$/,P1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,G1={javascript:!0,"javascript:":!0},oc={javascript:!0,"javascript:":!0},Js={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ac=S1;function N1(r,t,e){if(r&&typeof r=="object"&&r instanceof qi)return r;var i=new qi;return i.parse(r,t,e),i}qi.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=A1.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=ac.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=C1.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&oc[l])&&(a=a.substr(2),this.slashes=!0)}if(!oc[l]&&(u||l&&!Js[l])){for(var d=-1,f=0;f<Lp.length;f++){var m=a.indexOf(Lp[f]);m!==-1&&(d===-1||m<d)&&(d=m)}var p,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(p=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(p)),d=-1;for(var f=0;f<Mp.length;f++){var m=a.indexOf(Mp[f]);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 x=this.hostname.split(/\./),f=0,b=x.length;f<b;f++){var v=x[f];if(v&&!v.match(Pp)){for(var T="",S=0,C=v.length;S<C;S++)v.charCodeAt(S)>127?T+="x":T+=v[S];if(!T.match(Pp)){var I=x.slice(0,f),R=x.slice(f+1),P=v.match(P1);P&&(I.push(P[1]),R.unshift(P[2])),R.length&&(a="/"+R.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>L1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=E1.toASCII(this.hostname));var N=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+N,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!G1[c])for(var f=0,b=nc.length;f<b;f++){var A=nc[f];if(a.indexOf(A)!==-1){var k=encodeURIComponent(A);k===A&&(k=escape(A)),a=a.split(A).join(k)}}var Z=a.indexOf("#");Z!==-1&&(this.hash=a.substr(Z),a=a.slice(0,Z));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=ac.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Js[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var N=this.pathname||"",H=this.search||"";this.path=N+H}return this.href=this.format(),this},qi.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=ac.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Js[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},qi.prototype.resolve=function(r){return this.resolveObject(N1(r,!1,!0)).format()},qi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new qi;t.parse(r,!1,!0),r=t}for(var e=new qi,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 Js[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(!Js[r.protocol]){for(var l=Object.keys(r),c=0;c<l.length;c++){var u=l[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!oc[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||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",p=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=p||m||e.host&&r.pathname,y=g,x=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!Js[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.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]===""||x[0]==="")),p)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,x=b;else if(b.length)x||(x=[]),x.pop(),x=x.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var T=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.hostname=T.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(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=x.slice(-1)[0],C=(e.host||r.host||x.length>1)&&(S==="."||S==="..")||S==="",I=0,R=x.length;R>=0;R--)S=x[R],S==="."?x.splice(R,1):S===".."?(x.splice(R,1),I++):I&&(x.splice(R,1),I--);if(!g&&!y)for(;I--;I)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),C&&x.join("/").substr(-1)!=="/"&&x.push("");var P=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=P?"":x.length?x.shift():"",e.host=e.hostname;var T=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.hostname=T.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!P&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},qi.prototype.parseHost=function(){var r=this.host,t=I1.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 Gp={};function wt(r,t,e=3){if(Gp[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
4
+ `+t.prev}function ba(r,t){var e=jl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=wr(r,s)?t(r[s],r):""}var n=typeof Kl=="function"?Kl(r):[],o;if(Js){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)wr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Js&&o["$"+h]instanceof Symbol||(lp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Kl=="function")for(var l=0;l<n.length;l++)dp.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Ql=Bl,$s=s_,F_=m_,N_=Ql("%TypeError%"),xa=Ql("%WeakMap%",!0),_a=Ql("%Map%",!0),D_=$s("WeakMap.prototype.get",!0),k_=$s("WeakMap.prototype.set",!0),O_=$s("WeakMap.prototype.has",!0),B_=$s("Map.prototype.get",!0),U_=$s("Map.prototype.set",!0),W_=$s("Map.prototype.has",!0),ql=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},X_=function(r,t){var e=ql(r,t);return e&&e.value},Z_=function(r,t,e){var i=ql(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},V_=function(r,t){return!!ql(r,t)},H_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new N_("Side channel does not contain "+F_(n))},get:function(n){if(xa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return D_(t,n)}else if(_a){if(e)return B_(e,n)}else if(i)return X_(i,n)},has:function(n){if(xa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return O_(t,n)}else if(_a){if(e)return W_(e,n)}else if(i)return V_(i,n);return!1},set:function(n,o){xa&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new xa),k_(t,n,o)):_a?(e||(e=new _a),U_(e,n,o)):(i||(i={key:{},next:null}),Z_(i,n,o))}};return s},K_=String.prototype.replace,Y_=/%20/g,tc={RFC1738:"RFC1738",RFC3986:"RFC3986"},ec={default:tc.RFC3986,formatters:{RFC1738:function(r){return K_.call(r,Y_,"+")},RFC3986:function(r){return String(r)}},RFC1738:tc.RFC1738,RFC3986:tc.RFC3986},z_=ec,ic=Object.prototype.hasOwnProperty,ts=Array.isArray,Ci=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),j_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(ts(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Tp=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},J_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(ts(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!ic.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 ts(t)&&!ts(e)&&(s=Tp(t,i)),ts(t)&&ts(e)?(e.forEach(function(n,o){if(ic.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 ic.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},$_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},Q_=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}},q_=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(c){return"%26%23"+parseInt(c.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===z_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+Ci[l];continue}if(l<2048){a=a+(Ci[192|l>>6]+Ci[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Ci[224|l>>12]+Ci[128|l>>6&63]+Ci[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=Ci[240|l>>18]+Ci[128|l>>12&63]+Ci[128|l>>6&63]+Ci[128|l&63]}return a},t1=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],c=o[l];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:o,prop:l}),i.push(c))}return j_(e),t},e1=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},i1=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},r1=function(t,e){return[].concat(t,e)},s1=function(t,e){if(ts(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Sp={arrayToObject:Tp,assign:$_,combine:r1,compact:t1,decode:Q_,encode:q_,isBuffer:i1,isRegExp:e1,maybeMap:s1,merge:J_},Ep=H_,va=Sp,to=ec,n1=Object.prototype.hasOwnProperty,Cp={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Qi=Array.isArray,o1=Array.prototype.push,Ip=function(r,t){o1.apply(r,Qi(t)?t:[t])},a1=Date.prototype.toISOString,Ap=to.default,me={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:va.encode,encodeValuesOnly:!1,format:Ap,formatter:to.formatters[Ap],indices:!1,serializeDate:function(t){return a1.call(t)},skipNulls:!1,strictNullHandling:!1},h1=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},rc={},l1=function r(t,e,i,s,n,o,a,h,l,c,u,d,f,p,m,g){for(var y=t,x=g,b=0,v=!1;(x=x.get(rc))!==void 0&&!v;){var w=x.get(t);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");v=!0}typeof x.get(rc)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&Qi(y)&&(y=va.maybeMap(y,function(K){return K instanceof Date?u(K):K})),y===null){if(n)return a&&!p?a(e,me.encoder,m,"key",d):e;y=""}if(h1(y)||va.isBuffer(y)){if(a){var S=p?e:a(e,me.encoder,m,"key",d);return[f(S)+"="+f(a(y,me.encoder,m,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var I;if(i==="comma"&&Qi(y))p&&a&&(y=va.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(Qi(h))I=h;else{var R=Object.keys(y);I=l?R.sort(l):R}for(var P=s&&Qi(y)&&y.length===1?e+"[]":e,G=0;G<I.length;++G){var N=I[G],A=typeof N=="object"&&typeof N.value<"u"?N.value:y[N];if(!(o&&A===null)){var k=Qi(y)?typeof i=="function"?i(P,N):P:P+(c?"."+N:"["+N+"]");g.set(t,b);var V=Ep();V.set(rc,g),Ip(C,r(A,k,i,s,n,o,i==="comma"&&p&&Qi(y)?null:a,h,l,c,u,d,f,p,m,V))}}return C},c1=function(t){if(!t)return me;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||me.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=to.default;if(typeof t.format<"u"){if(!n1.call(to.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=to.formatters[i],n=me.filter;return(typeof t.filter=="function"||Qi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:me.addQueryPrefix,allowDots:typeof t.allowDots>"u"?me.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:me.charsetSentinel,delimiter:typeof t.delimiter>"u"?me.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:me.encode,encoder:typeof t.encoder=="function"?t.encoder:me.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:me.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:me.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:me.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:me.strictNullHandling}},u1=function(r,t){var e=r,i=c1(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Qi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Cp?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=Cp[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 c=Ep(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||Ip(o,l1(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,c))}var f=o.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},Qs=Sp,sc=Object.prototype.hasOwnProperty,d1=Array.isArray,ae={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Qs.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},f1=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Rp=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},p1="utf8=%26%2310003%3B",m1="utf8=%E2%9C%93",g1=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]===m1?l="utf-8":o[h]===p1&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var c=o[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,ae.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),ae.decoder,l,"key"),p=Qs.maybeMap(Rp(c.slice(d+1),e),function(m){return e.decoder(m,ae.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=f1(p)),c.indexOf("[]=")>-1&&(p=d1(p)?[p]:p),sc.call(i,f)?i[f]=Qs.combine(i[f],p):i[f]=p}return i},y1=function(r,t,e,i){for(var s=i?t:Rp(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},b1=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,c=[];if(l){if(!i.plainObjects&&sc.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(n))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&sc.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),y1(c,e,i,s)}},x1=function(t){if(!t)return ae;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"?ae.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?ae.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:ae.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:ae.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:ae.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ae.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:ae.comma,decoder:typeof t.decoder=="function"?t.decoder:ae.decoder,delimiter:typeof t.delimiter=="string"||Qs.isRegExp(t.delimiter)?t.delimiter:ae.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:ae.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:ae.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:ae.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:ae.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ae.strictNullHandling}},_1=function(r,t){var e=x1(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?g1(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=b1(a,i[a],e,typeof r=="string");s=Qs.merge(s,h,e)}return e.allowSparse===!0?s:Qs.compact(s)},v1=u1,w1=_1,T1=ec,S1={formats:T1,parse:w1,stringify:v1},E1=Lx;function qi(){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 C1=/^([a-z0-9.+-]+:)/i,I1=/:[0-9]*$/,A1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,R1=["<",">",'"',"`"," ","\r",`
5
+ `," "],M1=["{","}","|","\\","^","`"].concat(R1),nc=["'"].concat(M1),Mp=["%","/","?",";","#"].concat(nc),Lp=["/","?","#"],L1=255,Pp=/^[+a-z0-9A-Z_-]{0,63}$/,P1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,G1={javascript:!0,"javascript:":!0},oc={javascript:!0,"javascript:":!0},qs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ac=S1;function F1(r,t,e){if(r&&typeof r=="object"&&r instanceof qi)return r;var i=new qi;return i.parse(r,t,e),i}qi.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=A1.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=ac.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=C1.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&oc[l])&&(a=a.substr(2),this.slashes=!0)}if(!oc[l]&&(u||l&&!qs[l])){for(var d=-1,f=0;f<Lp.length;f++){var p=a.indexOf(Lp[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Mp.length;f++){var p=a.indexOf(Mp[f]);p!==-1&&(d===-1||p<d)&&(d=p)}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 x=this.hostname.split(/\./),f=0,b=x.length;f<b;f++){var v=x[f];if(v&&!v.match(Pp)){for(var w="",S=0,C=v.length;S<C;S++)v.charCodeAt(S)>127?w+="x":w+=v[S];if(!w.match(Pp)){var I=x.slice(0,f),R=x.slice(f+1),P=v.match(P1);P&&(I.push(P[1]),R.unshift(P[2])),R.length&&(a="/"+R.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>L1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=E1.toASCII(this.hostname));var G=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+G,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!G1[c])for(var f=0,b=nc.length;f<b;f++){var A=nc[f];if(a.indexOf(A)!==-1){var k=encodeURIComponent(A);k===A&&(k=escape(A)),a=a.split(A).join(k)}}var V=a.indexOf("#");V!==-1&&(this.hash=a.substr(V),a=a.slice(0,V));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=ac.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),qs[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var G=this.pathname||"",H=this.search||"";this.path=G+H}return this.href=this.format(),this},qi.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=ac.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||qs[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},qi.prototype.resolve=function(r){return this.resolveObject(F1(r,!1,!0)).format()},qi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new qi;t.parse(r,!1,!0),r=t}for(var e=new qi,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 qs[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(!qs[r.protocol]){for(var l=Object.keys(r),c=0;c<l.length;c++){var u=l[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!oc[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||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,y=g,x=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!qs[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.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]===""||x[0]==="")),m)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,x=b;else if(b.length)x||(x=[]),x.pop(),x=x.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.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(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=x.slice(-1)[0],C=(e.host||r.host||x.length>1)&&(S==="."||S==="..")||S==="",I=0,R=x.length;R>=0;R--)S=x[R],S==="."?x.splice(R,1):S===".."?(x.splice(R,1),I++):I&&(x.splice(R,1),I--);if(!g&&!y)for(;I--;I)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),C&&x.join("/").substr(-1)!=="/"&&x.push("");var P=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=P?"":x.length?x.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!P&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},qi.prototype.parseHost=function(){var r=this.host,t=I1.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 Gp={};function wt(r,t,e=3){if(Gp[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))),Gp[t]=!0}function oi(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function to(r){return r.split("?")[0].split("#")[0]}function F1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D1(r,t,e){return r.replace(new RegExp(F1(t),"g"),e)}function k1(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 ie={toPosix(r){return D1(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){oi(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(oi(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=to(this.toPosix(t??rt.ADAPTER.getBaseUrl())),s=to(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ie.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(oi(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=k1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return oi(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(oi(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(oi(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){oi(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){oi(r),t&&oi(t),r=to(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){oi(r),r=to(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){oi(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=to(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,c=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:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===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 hc;async function O1(){return hc??(hc=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Ce.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 Ce.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]?Ce.PMA:Ce.UNPACK})()),hc}let lc;function B1(){return typeof lc>"u"&&(lc=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:rt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!rt.ADAPTER.getWebGLRenderingContext())return!1;const e=rt.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}}()),lc}var W1={grad:.9,turn:360,rad:360/(2*Math.PI)},tr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ae=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},ze=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Np=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Fp=function(r){return{r:ze(r.r,0,255),g:ze(r.g,0,255),b:ze(r.b,0,255),a:ze(r.a)}},cc=function(r){return{r:ae(r.r),g:ae(r.g),b:ae(r.b),a:ae(r.a,3)}},U1=/^#([0-9a-f]{3,8})$/i,va=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Dp=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}},kp=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}},Op=function(r){return{h:Np(r.h),s:ze(r.s,0,100),l:ze(r.l,0,100),a:ze(r.a)}},Bp=function(r){return{h:ae(r.h),s:ae(r.s),l:ae(r.l),a:ae(r.a,3)}},Wp=function(r){return kp((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},eo=function(r){return{h:(t=Dp(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},X1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Z1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,V1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,H1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uc={string:[[function(r){var t=U1.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?ae(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?ae(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=V1.exec(r)||H1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Fp({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=X1.exec(r)||Z1.exec(r);if(!t)return null;var e,i,s=Op({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(W1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Wp(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 tr(t)&&tr(e)&&tr(i)?Fp({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(!tr(t)||!tr(e)||!tr(i))return null;var o=Op({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Wp(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!tr(t)||!tr(e)||!tr(i))return null;var o=function(a){return{h:Np(a.h),s:ze(a.s,0,100),v:ze(a.v,0,100),a:ze(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return kp(o)},"hsv"]]},Up=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]},K1=function(r){return typeof r=="string"?Up(r.trim(),uc.string):typeof r=="object"&&r!==null?Up(r,uc.object):[null,void 0]},dc=function(r,t){var e=eo(r);return{h:e.h,s:ze(e.s+100*t,0,100),l:e.l,a:e.a}},fc=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Xp=function(r,t){var e=eo(r);return{h:e.h,s:e.s,l:ze(e.l+100*t,0,100),a:e.a}},pc=function(){function r(t){this.parsed=K1(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 ae(fc(this.rgba),2)},r.prototype.isDark=function(){return fc(this.rgba)<.5},r.prototype.isLight=function(){return fc(this.rgba)>=.5},r.prototype.toHex=function(){return t=cc(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?va(ae(255*n)):"","#"+va(e)+va(i)+va(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return cc(this.rgba)},r.prototype.toRgbString=function(){return t=cc(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 Bp(eo(this.rgba))},r.prototype.toHslString=function(){return t=Bp(eo(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=Dp(this.rgba),{h:ae(t.h),s:ae(t.s),v:ae(t.v),a:ae(t.a,3)};var t},r.prototype.invert=function(){return Ii({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),Ii(dc(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ii(dc(this.rgba,-t))},r.prototype.grayscale=function(){return Ii(dc(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ii(Xp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ii(Xp(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"?Ii({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ae(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=eo(this.rgba);return typeof t=="number"?Ii({h:t,s:e.s,l:e.l,a:e.a}):ae(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ii(t).toHex()},r}(),Ii=function(r){return r instanceof pc?r:new pc(r)},Zp=[],Y1=function(r){r.forEach(function(t){Zp.indexOf(t)<0&&(t(pc,uc),Zp.push(t))})};function z1(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 c=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var m in e){var p=(a=c,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));p<u&&(u=p,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"])}Y1([z1]);const $s=class vl{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 vl)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]=vl.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=vl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ii(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)}};$s.shared=new $s,$s.temp=new $s,$s.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let kt=$s;function j1(r){return wt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),kt.shared.setValue(r).toHex()}function J1(r){return wt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),kt.shared.setValue(r).toNumber()}function $1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[pt.NORMAL_NPM]=pt.NORMAL,r[pt.ADD_NPM]=pt.ADD,r[pt.SCREEN_NPM]=pt.SCREEN,t[pt.NORMAL]=pt.NORMAL_NPM,t[pt.ADD]=pt.ADD_NPM,t[pt.SCREEN]=pt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Vp=$1();function Hp(r,t){return Vp[t?1:0][r]}function Q1(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 Kp(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 wa(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 Yp(r){return!(r&r-1)&&!!r}function zp(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 Qs(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 Sr(r){return r===0?0:r<0?-1:1}let q1=0;function ts(){return++q1}const mc=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}};mc.EMPTY=new mc(0,0,0,0);let jp=mc;const Jp={},Ai=Object.create(null),Er=Object.create(null);class tv{constructor(t,e,i){this._canvas=rt.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||rt.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 $p(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 Qp(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 ev(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&&$p(s,t,o);)++o;if(o===e)return jp.EMPTY;for(;$p(s,t,h);)--h;for(;Qp(s,t,n,o,h);)++n;for(;Qp(s,t,a,o,h);)--a;return++a,++h,new jp(n,o,a,h)}function iv(r){const t=ev(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 rv(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 er(r,t=1){var i;const e=(i=rt.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var Q=(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))(Q||{});const gc=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},qp=(r,t)=>gc(r).priority??t,nt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(gc).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(gc).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)=>qp(n,e)-qp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class yc{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 sv=["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))),Gp[t]=!0}function oi(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function eo(r){return r.split("?")[0].split("#")[0]}function N1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D1(r,t,e){return r.replace(new RegExp(N1(t),"g"),e)}function k1(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 re={toPosix(r){return D1(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){oi(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(oi(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=eo(this.toPosix(t??rt.ADAPTER.getBaseUrl())),s=eo(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?re.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(oi(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=k1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return oi(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(oi(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(oi(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){oi(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){oi(r),t&&oi(t),r=eo(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){oi(r),r=eo(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){oi(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=eo(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,c=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:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===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 hc;async function O1(){return hc??(hc=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Ce.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 Ce.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]?Ce.PMA:Ce.UNPACK})()),hc}let lc;function B1(){return typeof lc>"u"&&(lc=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:rt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!rt.ADAPTER.getWebGLRenderingContext())return!1;const e=rt.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}}()),lc}var U1={grad:.9,turn:360,rad:360/(2*Math.PI)},tr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},he=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ye=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Fp=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Np=function(r){return{r:Ye(r.r,0,255),g:Ye(r.g,0,255),b:Ye(r.b,0,255),a:Ye(r.a)}},cc=function(r){return{r:he(r.r),g:he(r.g),b:he(r.b),a:he(r.a,3)}},W1=/^#([0-9a-f]{3,8})$/i,wa=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Dp=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}},kp=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}},Op=function(r){return{h:Fp(r.h),s:Ye(r.s,0,100),l:Ye(r.l,0,100),a:Ye(r.a)}},Bp=function(r){return{h:he(r.h),s:he(r.s),l:he(r.l),a:he(r.a,3)}},Up=function(r){return kp((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},io=function(r){return{h:(t=Dp(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},X1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Z1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,V1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,H1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uc={string:[[function(r){var t=W1.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?he(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?he(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=V1.exec(r)||H1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Np({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=X1.exec(r)||Z1.exec(r);if(!t)return null;var e,i,s=Op({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(U1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Up(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 tr(t)&&tr(e)&&tr(i)?Np({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(!tr(t)||!tr(e)||!tr(i))return null;var o=Op({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Up(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!tr(t)||!tr(e)||!tr(i))return null;var o=function(a){return{h:Fp(a.h),s:Ye(a.s,0,100),v:Ye(a.v,0,100),a:Ye(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return kp(o)},"hsv"]]},Wp=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]},K1=function(r){return typeof r=="string"?Wp(r.trim(),uc.string):typeof r=="object"&&r!==null?Wp(r,uc.object):[null,void 0]},dc=function(r,t){var e=io(r);return{h:e.h,s:Ye(e.s+100*t,0,100),l:e.l,a:e.a}},fc=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Xp=function(r,t){var e=io(r);return{h:e.h,s:e.s,l:Ye(e.l+100*t,0,100),a:e.a}},pc=function(){function r(t){this.parsed=K1(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 he(fc(this.rgba),2)},r.prototype.isDark=function(){return fc(this.rgba)<.5},r.prototype.isLight=function(){return fc(this.rgba)>=.5},r.prototype.toHex=function(){return t=cc(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?wa(he(255*n)):"","#"+wa(e)+wa(i)+wa(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return cc(this.rgba)},r.prototype.toRgbString=function(){return t=cc(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 Bp(io(this.rgba))},r.prototype.toHslString=function(){return t=Bp(io(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=Dp(this.rgba),{h:he(t.h),s:he(t.s),v:he(t.v),a:he(t.a,3)};var t},r.prototype.invert=function(){return Ii({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),Ii(dc(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ii(dc(this.rgba,-t))},r.prototype.grayscale=function(){return Ii(dc(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ii(Xp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ii(Xp(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"?Ii({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):he(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=io(this.rgba);return typeof t=="number"?Ii({h:t,s:e.s,l:e.l,a:e.a}):he(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ii(t).toHex()},r}(),Ii=function(r){return r instanceof pc?r:new pc(r)},Zp=[],Y1=function(r){r.forEach(function(t){Zp.indexOf(t)<0&&(t(pc,uc),Zp.push(t))})};function z1(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 c=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=c,h=n[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));m<u&&(u=m,d=p)}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"])}Y1([z1]);const tn=class vl{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 vl)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]=vl.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=vl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ii(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)}};tn.shared=new tn,tn.temp=new tn,tn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let kt=tn;function j1(r){return wt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),kt.shared.setValue(r).toHex()}function J1(r){return wt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),kt.shared.setValue(r).toNumber()}function $1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[pt.NORMAL_NPM]=pt.NORMAL,r[pt.ADD_NPM]=pt.ADD,r[pt.SCREEN_NPM]=pt.SCREEN,t[pt.NORMAL]=pt.NORMAL_NPM,t[pt.ADD]=pt.ADD_NPM,t[pt.SCREEN]=pt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Vp=$1();function Hp(r,t){return Vp[t?1:0][r]}function Q1(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 Kp(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 Ta(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 Yp(r){return!(r&r-1)&&!!r}function zp(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 en(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 Sr(r){return r===0?0:r<0?-1:1}let q1=0;function es(){return++q1}const mc=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}};mc.EMPTY=new mc(0,0,0,0);let jp=mc;const Jp={},Ai=Object.create(null),Er=Object.create(null);class tv{constructor(t,e,i){this._canvas=rt.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||rt.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 $p(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 Qp(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 ev(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&&$p(s,t,o);)++o;if(o===e)return jp.EMPTY;for(;$p(s,t,h);)--h;for(;Qp(s,t,n,o,h);)++n;for(;Qp(s,t,a,o,h);)--a;return++a,++h,new jp(n,o,a,h)}function iv(r){const t=ev(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 rv(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 er(r,t=1){var i;const e=(i=rt.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var Q=(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))(Q||{});const gc=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},qp=(r,t)=>gc(r).priority??t,st={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(gc).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(gc).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)=>qp(n,e)-qp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class yc{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 sv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
11
  `);function nv(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 ov(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=sv.replace(/%forloop%/gi,nv(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const bc=0,xc=1,_c=2,vc=3,wc=4,Tc=5;class Ri{constructor(){this.data=0,this.blendMode=pt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<bc)}set blend(t){!!(this.data&1<<bc)!==t&&(this.data^=1<<bc)}get offsets(){return!!(this.data&1<<xc)}set offsets(t){!!(this.data&1<<xc)!==t&&(this.data^=1<<xc)}get culling(){return!!(this.data&1<<_c)}set culling(t){!!(this.data&1<<_c)!==t&&(this.data^=1<<_c)}get depthTest(){return!!(this.data&1<<vc)}set depthTest(t){!!(this.data&1<<vc)!==t&&(this.data^=1<<vc)}get depthMask(){return!!(this.data&1<<Tc)}set depthMask(t){!!(this.data&1<<Tc)!==t&&(this.data^=1<<Tc)}get clockwiseFrontFace(){return!!(this.data&1<<wc)}set clockwiseFrontFace(t){!!(this.data&1<<wc)!==t&&(this.data^=1<<wc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==pt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ri;return t.depthTest=!1,t.blend=!0,t}}Ri.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Sc=[];function tm(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=Sc.length-1;i>=0;--i){const s=Sc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ai{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:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,i,s,n,o,a,h);return c===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(ai.prototype,{dispatch:{value:ai.prototype.emit},run:{value:ai.prototype.emit}});class io{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ai("setRealSize"),this.onUpdate=new ai("update"),this.onError=new ai("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 Ta extends io{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===Ce.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 av={scaleMode:ji.NEAREST,alphaMode:Ce.NPM},Ec=class Un extends Hn{constructor(t=null,e=null){super(),e=Object.assign({},Un.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:m}=e;t&&!(t instanceof io)&&(t=tm(t,m),t.internal=!0),this.resolution=f||rt.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=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=ts(),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=Yp(this.realWidth)&&Yp(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 Er[this.cacheId],delete Ai[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Un.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=rt.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}_${ts()}`}n=t._pixiId}let o=Er[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Un(t,e),o.cacheId=n,Un.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new Ta(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=Y.RGBA,a=ct.FLOAT):t instanceof Int32Array?(o=Y.RGBA_INTEGER,a=ct.INT):t instanceof Uint32Array?(o=Y.RGBA_INTEGER,a=ct.UNSIGNED_INT):t instanceof Int16Array?(o=Y.RGBA_INTEGER,a=ct.SHORT):t instanceof Uint16Array?(o=Y.RGBA_INTEGER,a=ct.UNSIGNED_SHORT):t instanceof Int8Array?(o=Y.RGBA,a=ct.BYTE):(o=Y.RGBA,a=ct.UNSIGNED_BYTE),n.internal=!0,new Un(n,Object.assign({},av,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Er[e]&&Er[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Er[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Er[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Er[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Er[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ec.defaultOptions={mipmap:wi.POW2,anisotropicLevel:0,scaleMode:ji.LINEAR,wrapMode:vi.CLAMP,alphaMode:Ce.UNPACK,target:Bs.TEXTURE_2D,format:Y.RGBA,type:ct.UNSIGNED_BYTE},Ec._globalBatch=0;let xt=Ec;class Cc{constructor(){this.texArray=null,this.blend=0,this.type=_i.TRIANGLES,this.start=0,this.size=0,this.data=null}}let hv=0;class zt{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=hv++,this.disposeRunner=new ai("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?Si.ELEMENT_ARRAY_BUFFER:Si.ARRAY_BUFFER}get index(){return this.type===Si.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new zt(t)}}class Sa{constructor(t,e=0,i=!1,s=ct.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 Sa(t,e,i,s,n)}}const lv={Float32Array,Uint32Array,Int32Array,Uint8Array};function cv(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],c=r[h],u=Kp(c);s[u]||(s[u]=new lv[u](n)),o=s[u];for(let d=0;d<c.length;d++){const f=(d/l|0)*i+a,m=d%l;o[f+m]=c[d]}a+=l}return new Float32Array(n)}const em={5126:4,5123:2,5121:1};let uv=0;const dv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Cr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=uv++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ai("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 zt||(e instanceof Array&&(e=new Float32Array(e)),e=new zt(e));const l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,i,s,n);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new Sa(c,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 zt||(t instanceof Array&&(t=new Uint16Array(t)),t=new zt(t)),t.type=Si.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 zt;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*em[n.type]/4),n.buffer=0}for(i.data=cv(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 Cr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new zt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Sa(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Si.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Cr,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 dv[Kp(o.buffers[a].data)](s[a]),e.buffers[a]=new zt(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=Si.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===c&&(h+=d.size*em[d.type]/4)}for(let u=0;u<t.length;u++){const d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}}class im extends Cr{constructor(t=!1){super(),this._buffer=new zt(null,t,!1),this._indexBuffer=new zt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ct.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ct.FLOAT).addAttribute("aColor",this._buffer,4,!0,ct.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ct.FLOAT).addIndex(this._indexBuffer)}}const Ea=Math.PI*2,fv=180/Math.PI,pv=Math.PI/180;var fe=(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))(fe||{});class dt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new dt(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}}dt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Ca=[new dt,new dt,new dt,new dt];class gt{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=fe.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 gt(0,0,0,0)}clone(){return new gt(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 R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=Ca[0].set(t.left,t.top),h=Ca[1].set(t.left,t.bottom),l=Ca[2].set(t.right,t.top),c=Ca[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const d=u*(h.y-a.y),f=u*(a.x-h.x),m=d*i+f*n,p=d*s+f*n,g=d*i+f*o,y=d*s+f*o;if(Math.max(m,p,g,y)<=d*a.x+f*a.y||Math.min(m,p,g,y)>=d*c.x+f*c.y)return!1;const x=u*(a.y-l.y),b=u*(l.x-a.x),v=x*i+b*n,T=x*s+b*n,S=x*i+b*o,C=x*s+b*o;return!(Math.max(v,T,S,C)<=x*a.x+b*a.y||Math.min(v,T,S,C)>=x*c.x+b*c.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}}gt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ia{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=fe.CIRC}clone(){return new Ia(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 gt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Ia.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Aa{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=fe.ELIP}clone(){return new Aa(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 gt(this.x-this.width,this.y-this.height,this.width,this.height)}}Aa.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class es{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=fe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new es(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],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}}es.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class Ra{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=fe.RREC}clone(){return new Ra(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}}Ra.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Ot{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 dt;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 dt;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(Ea-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 Ot;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 Ot}static get TEMP_MATRIX(){return new Ot}}Ot.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 is=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],rs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ss=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ns=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ic=[],rm=[],Ma=Math.sign;function mv(){for(let r=0;r<16;r++){const t=[];Ic.push(t);for(let e=0;e<16;e++){const i=Ma(is[r]*is[e]+ss[r]*rs[e]),s=Ma(rs[r]*is[e]+ns[r]*rs[e]),n=Ma(is[r]*ss[e]+ss[r]*ns[e]),o=Ma(rs[r]*ss[e]+ns[r]*ns[e]);for(let a=0;a<16;a++)if(is[a]===i&&rs[a]===s&&ss[a]===n&&ns[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Ot;t.set(is[r],rs[r],ss[r],ns[r],0,0),rm.push(t)}}mv();const Xt={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=>is[r],uY:r=>rs[r],vX:r=>ss[r],vY:r=>ns[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ic[r][t],sub:(r,t)=>Ic[r][Xt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Xt.S:Xt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Xt.E:Xt.W:t>0?r>0?Xt.SE:Xt.SW:r>0?Xt.NE:Xt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=rm[Xt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class ir{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 ir(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))}}ir.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Ac=class{constructor(){this.worldTransform=new Ot,this.localTransform=new Ot,this.position=new ir(this.onChange,this,0,0),this.scale=new ir(this.onChange,this,1,1),this.pivot=new ir(this.onChange,this,0,0),this.skew=new ir(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())}};Ac.IDENTITY=new Ac;let Rc=Ac;Rc.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 gv=`varying vec2 vTextureCoord;
12
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function ov(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=sv.replace(/%forloop%/gi,nv(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const bc=0,xc=1,_c=2,vc=3,wc=4,Tc=5;class Ri{constructor(){this.data=0,this.blendMode=pt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<bc)}set blend(t){!!(this.data&1<<bc)!==t&&(this.data^=1<<bc)}get offsets(){return!!(this.data&1<<xc)}set offsets(t){!!(this.data&1<<xc)!==t&&(this.data^=1<<xc)}get culling(){return!!(this.data&1<<_c)}set culling(t){!!(this.data&1<<_c)!==t&&(this.data^=1<<_c)}get depthTest(){return!!(this.data&1<<vc)}set depthTest(t){!!(this.data&1<<vc)!==t&&(this.data^=1<<vc)}get depthMask(){return!!(this.data&1<<Tc)}set depthMask(t){!!(this.data&1<<Tc)!==t&&(this.data^=1<<Tc)}get clockwiseFrontFace(){return!!(this.data&1<<wc)}set clockwiseFrontFace(t){!!(this.data&1<<wc)!==t&&(this.data^=1<<wc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==pt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ri;return t.depthTest=!1,t.blend=!0,t}}Ri.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Sc=[];function tm(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=Sc.length-1;i>=0;--i){const s=Sc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ai{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:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,i,s,n,o,a,h);return c===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(ai.prototype,{dispatch:{value:ai.prototype.emit},run:{value:ai.prototype.emit}});class ro{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ai("setRealSize"),this.onUpdate=new ai("update"),this.onError=new ai("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 Sa extends ro{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===Ce.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 av={scaleMode:ji.NEAREST,alphaMode:Ce.NPM},Ec=class Xn extends Kn{constructor(t=null,e=null){super(),e=Object.assign({},Xn.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof ro)&&(t=tm(t,p),t.internal=!0),this.resolution=f||rt.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=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=es(),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=Yp(this.realWidth)&&Yp(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 Er[this.cacheId],delete Ai[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Xn.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=rt.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}_${es()}`}n=t._pixiId}let o=Er[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Xn(t,e),o.cacheId=n,Xn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new Sa(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=Y.RGBA,a=lt.FLOAT):t instanceof Int32Array?(o=Y.RGBA_INTEGER,a=lt.INT):t instanceof Uint32Array?(o=Y.RGBA_INTEGER,a=lt.UNSIGNED_INT):t instanceof Int16Array?(o=Y.RGBA_INTEGER,a=lt.SHORT):t instanceof Uint16Array?(o=Y.RGBA_INTEGER,a=lt.UNSIGNED_SHORT):t instanceof Int8Array?(o=Y.RGBA,a=lt.BYTE):(o=Y.RGBA,a=lt.UNSIGNED_BYTE),n.internal=!0,new Xn(n,Object.assign({},av,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Er[e]&&Er[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Er[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Er[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Er[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Er[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ec.defaultOptions={mipmap:wi.POW2,anisotropicLevel:0,scaleMode:ji.LINEAR,wrapMode:vi.CLAMP,alphaMode:Ce.UNPACK,target:Xs.TEXTURE_2D,format:Y.RGBA,type:lt.UNSIGNED_BYTE},Ec._globalBatch=0;let xt=Ec;class Cc{constructor(){this.texArray=null,this.blend=0,this.type=_i.TRIANGLES,this.start=0,this.size=0,this.data=null}}let hv=0;class zt{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=hv++,this.disposeRunner=new ai("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?Si.ELEMENT_ARRAY_BUFFER:Si.ARRAY_BUFFER}get index(){return this.type===Si.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new zt(t)}}class Ea{constructor(t,e=0,i=!1,s=lt.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 Ea(t,e,i,s,n)}}const lv={Float32Array,Uint32Array,Int32Array,Uint8Array};function cv(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],c=r[h],u=Kp(c);s[u]||(s[u]=new lv[u](n)),o=s[u];for(let d=0;d<c.length;d++){const f=(d/l|0)*i+a,p=d%l;o[f+p]=c[d]}a+=l}return new Float32Array(n)}const em={5126:4,5123:2,5121:1};let uv=0;const dv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Cr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=uv++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ai("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 zt||(e instanceof Array&&(e=new Float32Array(e)),e=new zt(e));const l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,i,s,n);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new Ea(c,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 zt||(t instanceof Array&&(t=new Uint16Array(t)),t=new zt(t)),t.type=Si.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 zt;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*em[n.type]/4),n.buffer=0}for(i.data=cv(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 Cr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new zt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Ea(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=Si.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Cr,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 dv[Kp(o.buffers[a].data)](s[a]),e.buffers[a]=new zt(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=Si.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===c&&(h+=d.size*em[d.type]/4)}for(let u=0;u<t.length;u++){const d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}}class im extends Cr{constructor(t=!1){super(),this._buffer=new zt(null,t,!1),this._indexBuffer=new zt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,lt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,lt.FLOAT).addAttribute("aColor",this._buffer,4,!0,lt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,lt.FLOAT).addIndex(this._indexBuffer)}}const Ca=Math.PI*2,fv=180/Math.PI,pv=Math.PI/180;var fe=(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))(fe||{});class dt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new dt(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}}dt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Ia=[new dt,new dt,new dt,new dt];class mt{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=fe.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 mt(0,0,0,0)}clone(){return new mt(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 R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=Ia[0].set(t.left,t.top),h=Ia[1].set(t.left,t.bottom),l=Ia[2].set(t.right,t.top),c=Ia[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*i+f*n,m=d*s+f*n,g=d*i+f*o,y=d*s+f*o;if(Math.max(p,m,g,y)<=d*a.x+f*a.y||Math.min(p,m,g,y)>=d*c.x+f*c.y)return!1;const x=u*(a.y-l.y),b=u*(l.x-a.x),v=x*i+b*n,w=x*s+b*n,S=x*i+b*o,C=x*s+b*o;return!(Math.max(v,w,S,C)<=x*a.x+b*a.y||Math.min(v,w,S,C)>=x*c.x+b*c.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}}mt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Aa{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=fe.CIRC}clone(){return new Aa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new mt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Aa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Ra{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=fe.ELIP}clone(){return new Ra(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 mt(this.x-this.width,this.y-this.height,this.width,this.height)}}Ra.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class is{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=fe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new is(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],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}}is.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class Ma{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=fe.RREC}clone(){return new Ma(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}}Ma.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Ot{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 dt;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 dt;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(Ca-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 Ot;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 Ot}static get TEMP_MATRIX(){return new Ot}}Ot.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 rs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ss=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ns=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],os=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ic=[],rm=[],La=Math.sign;function mv(){for(let r=0;r<16;r++){const t=[];Ic.push(t);for(let e=0;e<16;e++){const i=La(rs[r]*rs[e]+ns[r]*ss[e]),s=La(ss[r]*rs[e]+os[r]*ss[e]),n=La(rs[r]*ns[e]+ns[r]*os[e]),o=La(ss[r]*ns[e]+os[r]*os[e]);for(let a=0;a<16;a++)if(rs[a]===i&&ss[a]===s&&ns[a]===n&&os[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Ot;t.set(rs[r],ss[r],ns[r],os[r],0,0),rm.push(t)}}mv();const Xt={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=>rs[r],uY:r=>ss[r],vX:r=>ns[r],vY:r=>os[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ic[r][t],sub:(r,t)=>Ic[r][Xt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Xt.S:Xt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Xt.E:Xt.W:t>0?r>0?Xt.SE:Xt.SW:r>0?Xt.NE:Xt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=rm[Xt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class ir{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 ir(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))}}ir.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Ac=class{constructor(){this.worldTransform=new Ot,this.localTransform=new Ot,this.position=new ir(this.onChange,this,0,0),this.scale=new ir(this.onChange,this,1,1),this.pivot=new ir(this.onChange,this,0,0),this.skew=new ir(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())}};Ac.IDENTITY=new Ac;let Rc=Ac;Rc.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 gv=`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 sm(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Mc(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function nm(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 Mc(2*t);case"bvec3":return Mc(3*t);case"bvec4":return Mc(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 qs=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
29
+ `;function sm(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Mc(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function nm(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 Mc(2*t);case"bvec3":return Mc(3*t);case"bvec4":return Mc(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 rn=[{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<qs.length;h++)if(qs[h].test(n,o)){e.push(qs[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?bv:xv)[n.type].replace("location",`ud["${s}"].location`);e.push(`
295
+ `));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<rn.length;h++)if(rn[h].test(n,o)){e.push(rn[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?bv:xv)[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 om={};let tn=om;function vv(){if(tn===om||tn!=null&&tn.isContextLost()){const r=rt.ADAPTER.createCanvas();let t;rt.PREFER_ENV>=jr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),tn=t}return tn}let La;function wv(){if(!La){La=Ye.MEDIUM;const r=vv();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(La=t.precision?Ye.HIGH:Ye.MEDIUM)}}return La}function am(r,t){const e=r.getShaderSource(t).split(`
300
+ `))}const om={};let sn=om;function vv(){if(sn===om||sn!=null&&sn.isContextLost()){const r=rt.ADAPTER.createCanvas();let t;rt.PREFER_ENV>=Jr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),sn=t}return sn}let Pa;function wv(){if(!Pa){Pa=Ke.MEDIUM;const r=vv();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Pa=t.precision?Ke.HIGH:Ke.MEDIUM)}}return Pa}function am(r,t){const e=r.getShaderSource(t).split(`
301
301
  `).map((l,c)=>`${c}: ${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 Tv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||am(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||am(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Sv={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 hm(r){return Sv[r]}let Pa=null;const lm={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 cm(r,t){if(!Pa){const e=Object.keys(lm);Pa={};for(let i=0;i<e.length;++i){const s=e[i];Pa[r[s]]=lm[s]}}return Pa[t]}function um(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ye.HIGH&&e!==Ye.HIGH&&(i=Ye.MEDIUM),`precision ${i} float;
304
- ${r}`}else if(e!==Ye.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let ro;function Ev(){if(typeof ro=="boolean")return ro;try{ro=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ro=!1}return ro}let Cv=0;const Ga={},Lc=class Xn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=Cv++,this.vertexSrc=t||Xn.defaultVertexSrc,this.fragmentSrc=e||Xn.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,"-"),Ga[i]?(Ga[i]++,i+=`-${Ga[i]}`):Ga[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 Tv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||am(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||am(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Sv={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 hm(r){return Sv[r]}let Ga=null;const lm={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 cm(r,t){if(!Ga){const e=Object.keys(lm);Ga={};for(let i=0;i<e.length;++i){const s=e[i];Ga[r[s]]=lm[s]}}return Ga[t]}function um(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ke.HIGH&&e!==Ke.HIGH&&(i=Ke.MEDIUM),`precision ${i} float;
304
+ ${r}`}else if(e!==Ke.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let so;function Ev(){if(typeof so=="boolean")return so;try{so=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{so=!1}return so}let Cv=0;const Fa={},Lc=class Zn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=Cv++,this.vertexSrc=t||Zn.defaultVertexSrc,this.fragmentSrc=e||Zn.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,"-"),Fa[i]?(Fa[i]++,i+=`-${Fa[i]}`):Fa[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
305
305
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
306
- ${this.fragmentSrc}`,this.vertexSrc=um(this.vertexSrc,Xn.defaultVertexPrecision,Ye.HIGH),this.fragmentSrc=um(this.fragmentSrc,Xn.defaultFragmentPrecision,wv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return yv}static get defaultFragmentSrc(){return gv}static from(t,e,i){const s=t+e;let n=Jp[s];return n||(Jp[s]=n=new Xn(t,e,i)),n}};Lc.defaultVertexPrecision=Ye.HIGH,Lc.defaultFragmentPrecision=$i.apple.device?Ye.HIGH:Ye.MEDIUM;let rr=Lc,Iv=0;class hi{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Iv++,this.static=!!e,this.ubo=!!i,t instanceof zt?(this.buffer=t,this.buffer.type=Si.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new zt(new Float32Array(1)),this.buffer.type=Si.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 hi(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 hi(t,e,i)}static uboFrom(t,e){return new hi(t,e??!0,!0)}}class Mi{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof hi?this.uniformGroup=e:this.uniformGroup=new hi(e):this.uniformGroup=new hi({}),this.disposeRunner=new ai("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=rr.from(t,e);return new Mi(s,i)}}class Av{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]=hi.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 rr(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ot,default:this.defaultGroupCache[t]};return new Mi(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
306
+ ${this.fragmentSrc}`,this.vertexSrc=um(this.vertexSrc,Zn.defaultVertexPrecision,Ke.HIGH),this.fragmentSrc=um(this.fragmentSrc,Zn.defaultFragmentPrecision,wv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return yv}static get defaultFragmentSrc(){return gv}static from(t,e,i){const s=t+e;let n=Jp[s];return n||(Jp[s]=n=new Zn(t,e,i)),n}};Lc.defaultVertexPrecision=Ke.HIGH,Lc.defaultFragmentPrecision=$i.apple.device?Ke.HIGH:Ke.MEDIUM;let rr=Lc,Iv=0;class hi{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Iv++,this.static=!!e,this.ubo=!!i,t instanceof zt?(this.buffer=t,this.buffer.type=Si.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new zt(new Float32Array(1)),this.buffer.type=Si.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 hi(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 hi(t,e,i)}static uboFrom(t,e){return new hi(t,e??!0,!0)}}class Mi{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof hi?this.uniformGroup=e:this.uniformGroup=new hi(e):this.uniformGroup=new hi({}),this.disposeRunner=new ai("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=rr.from(t,e);return new Mi(s,i)}}class Av{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]=hi.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 rr(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ot,default:this.defaultGroupCache[t]};return new Mi(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+=`
@@ -342,14 +342,14 @@ void main(void){
342
342
  vTextureId = aTextureId;
343
343
  vColor = aColor * tint;
344
344
  }
345
- `;const so=class xi extends Na{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=im,this.vertexSize=6,this.state=Ri.for2d(),this.size=xi.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??Mv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Rv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return wt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return Pv}static get defaultFragmentTemplate(){return Lv}setShaderGenerator({vertex:t=xi.defaultVertexSrc,fragment:e=xi.defaultFragmentTemplate}={}){this.shaderGenerator=new Av(t,e)}contextChange(){const t=this.renderer.gl;rt.PREFER_ENV===jr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),xi.defaultMaxTextures),this.maxTextures=ov(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}=xi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Cc);for(;e.length<s;)e.push(new Pc);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=xi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++xt._globalBatch,h=0,l=i[0],c=0;s.copyBoundTextures(n,e);for(let u=0;u<this._bufferSize;++u){const d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,c,u),c=u,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,c,this._bufferSize),++h,++a);for(let u=0;u<n.length;u++)n[u]=null;xt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=xi._drawCallPool;let l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){const m=s[f],p=m._texture.baseTexture,g=Vp[p.alphaMode?1:0][m.blendMode];s[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(m,n,o,c,u),c+=m.vertexData.length/2*a,u+=m.indices.length,d.blend=g}e<i&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}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;xi.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=xi._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:c,blend:u}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,c*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),xi.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=wa(Math.ceil(t/8)),i=zp(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 yc(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=wa(Math.ceil(t/12)),i=zp(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,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),m=kt.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let p=0;p<u.length;p+=2)a[s++]=u[p],a[s++]=u[p+1],a[s++]=l[p],a[s++]=l[p+1],o[s++]=m,a[s++]=d;for(let p=0;p<c.length;p++)i[n++]=h+c[p]}};so.defaultBatchSize=4096,so.extension={name:"batch",type:Q.RendererPlugin},so._drawCallPool=[],so._textureArrayPool=[];let os=so;nt.add(os);var Gv=`varying vec2 vTextureCoord;
345
+ `;const no=class xi extends Na{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=im,this.vertexSize=6,this.state=Ri.for2d(),this.size=xi.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??Mv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Rv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return wt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return Pv}static get defaultFragmentTemplate(){return Lv}setShaderGenerator({vertex:t=xi.defaultVertexSrc,fragment:e=xi.defaultFragmentTemplate}={}){this.shaderGenerator=new Av(t,e)}contextChange(){const t=this.renderer.gl;rt.PREFER_ENV===Jr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),xi.defaultMaxTextures),this.maxTextures=ov(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}=xi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Cc);for(;e.length<s;)e.push(new Pc);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=xi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++xt._globalBatch,h=0,l=i[0],c=0;s.copyBoundTextures(n,e);for(let u=0;u<this._bufferSize;++u){const d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,c,u),c=u,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,c,this._bufferSize),++h,++a);for(let u=0;u<n.length;u++)n[u]=null;xt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=xi._drawCallPool;let l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){const p=s[f],m=p._texture.baseTexture,g=Vp[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,n,o,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=g}e<i&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}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;xi.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=xi._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:c,blend:u}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,c*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),xi.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=Ta(Math.ceil(t/8)),i=zp(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 yc(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=Ta(Math.ceil(t/12)),i=zp(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,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=kt.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=l[m],a[s++]=l[m+1],o[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)i[n++]=h+c[m]}};no.defaultBatchSize=4096,no.extension={name:"batch",type:Q.RendererPlugin},no._drawCallPool=[],no._textureArrayPool=[];let as=no;st.add(as);var Gv=`varying vec2 vTextureCoord;
346
346
 
347
347
  uniform sampler2D uSampler;
348
348
 
349
349
  void main(void){
350
350
  gl_FragColor = texture2D(uSampler, vTextureCoord);
351
351
  }
352
- `,Nv=`attribute vec2 aVertexPosition;
352
+ `,Fv=`attribute vec2 aVertexPosition;
353
353
 
354
354
  uniform mat3 projectionMatrix;
355
355
 
@@ -375,7 +375,7 @@ void main(void)
375
375
  gl_Position = filterVertexPosition();
376
376
  vTextureCoord = filterTextureCoord();
377
377
  }
378
- `;const Gc=class ea extends Mi{constructor(t,e,i){const s=rr.from(t||ea.defaultVertexSrc,e||ea.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=ea.defaultResolution,this.multisample=ea.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ri}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 Gv}};Gc.defaultResolution=1,Gc.defaultMultisample=Jt.NONE;let we=Gc;class Fa{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new kt(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(){}}Fa.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Fa.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"background"},nt.add(Fa);class dm{constructor(t){this.renderer=t,this.emptyRenderer=new Na(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 c=n[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){o[l]=u;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}}dm.extension={type:Q.RendererSystem,name:"batch"},nt.add(dm);let fm=0;class Da{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=fm++}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=fm++,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(rt.PREFER_ENV>=jr.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")}}Da.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Da.extension={type:Q.RendererSystem,name:"context"},nt.add(Da);class Nc{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 ai("disposeFramebuffer"),this.multisample=Jt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new xt(null,{scaleMode:ji.NEAREST,resolution:1,mipmap:wi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new xt(null,{scaleMode:ji.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:wi.OFF,format:Y.DEPTH_COMPONENT,type:ct.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 pm extends xt{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=Jt.NONE),super(null,t),this.mipmap=wi.OFF,this.valid=!0,this._clear=new kt([0,0,0,0]),this.framebuffer=new Nc(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 Ir extends io{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=rv(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===Ce.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 mm extends Ir{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Ir.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??rt.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===Ce.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 Fc{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=Xt.add(i,Xt.NW),this.x0=h+o*Xt.uX(i),this.y0=l+a*Xt.uY(i),i=Xt.add(i,2),this.x1=h+o*Xt.uX(i),this.y1=l+a*Xt.uY(i),i=Xt.add(i,2),this.x2=h+o*Xt.uX(i),this.y2=l+a*Xt.uY(i),i=Xt.add(i,2),this.x3=h+o*Xt.uX(i),this.y3=l+a*Xt.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}}Fc.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 gm=new Fc;function ka(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class ot extends Hn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new gt(0,0,1,1)),t instanceof ot&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=gm,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 dt(o.x,o.y):new dt(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&&Ai[e.url]&&ot.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,ot.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 ot(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===gm&&(this._uvs=new Fc),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=rt.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof xt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${ts()}`,xt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${ts()}`}n=t._pixiId}let o=Ai[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof xt)?(e.resolution||(e.resolution=er(t)),o=new ot(new xt(t,e)),o.baseTexture.cacheId=n,xt.addToCache(o.baseTexture,n),ot.addToCache(o,n)):!o&&t instanceof xt&&(o=new ot(t),ot.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=ot.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 ot(xt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new xt(t,Object.assign({scaleMode:xt.defaultOptions.scaleMode,resolution:er(e)},s)),{resource:o}=n;o instanceof mm&&(o.url=e);const a=new ot(n);return i||(i=e),xt.addToCache(a.baseTexture,i),ot.addToCache(a,i),i!==e&&(xt.addToCache(a.baseTexture,e),ot.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),Ai[e]&&Ai[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ai[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ai[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ai[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ai[t.textureCacheIds[e]]===t&&delete Ai[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}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}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 ot._EMPTY||(ot._EMPTY=new ot(new xt),ka(ot._EMPTY),ka(ot._EMPTY.baseTexture)),ot._EMPTY}static get WHITE(){if(!ot._WHITE){const t=rt.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),ot._WHITE=new ot(xt.from(t)),ka(ot._WHITE),ka(ot._WHITE.baseTexture)}return ot._WHITE}}class as extends ot{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 as(new pm(t))}}class ym{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Jt.NONE){const s=new pm(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new as(s)}getOptimalTexture(t,e,i=1,s=Jt.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=wa(t),e=wa(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||Jt.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}}}ym.SCREEN_KEY=-1;class Fv extends Cr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class bm extends Cr{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 zt(this.vertices),this.uvBuffer=new zt(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 Dv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Jt.NONE,this.sourceFrame=new gt,this.destinationFrame=new gt,this.bindingSourceFrame=new gt,this.bindingDestinationFrame=new gt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Oa=[new dt,new dt,new dt,new dt],Dc=new Ot;class xm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new ym,this.statePool=[],this.quad=new Fv,this.quadUv=new bm,this.tempRect=new gt,this.activeState={},this.globalUniforms=new hi({outputFrame:new gt,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 Dv,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,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||a),c=Math.min(c,y.multisample??h),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=l,n.multisample=c,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(u);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Dc.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,c),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const p=this.tempRect;p.x=0,p.y=0,p.width=n.sourceFrame.width,p.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,p),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,Ti.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Ti.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Ti.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ti.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===Ti.CLEAR||e===Ti.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(_i.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(_i.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(Ot.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=Jt.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||Jt.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=Oa[0],s=Oa[1],n=Oa[2],o=Oa[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),c=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=c-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?Dc.copyFrom(n):Dc.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)}}}xm.extension={type:Q.RendererSystem,name:"filter"},nt.add(xm);class kv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Jt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Ov=new gt;class _m{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Nc(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 gt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;rt.PREFER_ENV===jr.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=Il.COLOR|Il.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new kv(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],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._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,c._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=Jt.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=Jt.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 c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Nc(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,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=Ov,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 gt}destroy(){this.renderer=null}}_m.extension={type:Q.RendererSystem,name:"framebuffer"},nt.add(_m);const kc={5126:4,5123:2,5121:1};class vm{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;rt.PREFER_ENV===jr.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 c=l[h];if(c)return l[a.id]=c,c;const u=t.buffers,d=t.attributes,f={},m={};for(const p in u)f[p]=0,m[p]=0;for(const p in d)!d[p].size&&a.attributeData[p]?d[p].size=a.attributeData[p].size:d[p].size||console.warn(`PIXI Geometry attribute '${p}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[p].buffer]+=d[p].size*kc[d[p].type];for(const p in d){const g=d[p],y=g.size;g.stride===void 0&&(f[g.buffer]===y*kc[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*kc[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let p=0;p<u.length;p++){const g=u[p];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),o.unbind(Si.ARRAY_BUFFER),c}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 c=a[l],u=o[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(u),h=d);const f=e.attributeData[l].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.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}}vm.extension={type:Q.RendererSystem,name:"geometry"},nt.add(vm);const wm=new Ot;class Tm{constructor(t,e){this._texture=t,this.mapCoord=new Ot,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&&(wm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(wm));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 Bv=`varying vec2 vMaskCoord;
378
+ `;const Gc=class ia extends Mi{constructor(t,e,i){const s=rr.from(t||ia.defaultVertexSrc,e||ia.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=ia.defaultResolution,this.multisample=ia.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ri}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 Fv}static get defaultFragmentSrc(){return Gv}};Gc.defaultResolution=1,Gc.defaultMultisample=Jt.NONE;let we=Gc;class Da{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new kt(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(){}}Da.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Da.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"background"},st.add(Da);class dm{constructor(t){this.renderer=t,this.emptyRenderer=new Na(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 c=n[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){o[l]=u;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}}dm.extension={type:Q.RendererSystem,name:"batch"},st.add(dm);let fm=0;class ka{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=fm++}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=fm++,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(rt.PREFER_ENV>=Jr.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")}}ka.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ka.extension={type:Q.RendererSystem,name:"context"},st.add(ka);class Fc{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 ai("disposeFramebuffer"),this.multisample=Jt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new xt(null,{scaleMode:ji.NEAREST,resolution:1,mipmap:wi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new xt(null,{scaleMode:ji.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:wi.OFF,format:Y.DEPTH_COMPONENT,type:lt.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 pm extends xt{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=Jt.NONE),super(null,t),this.mipmap=wi.OFF,this.valid=!0,this._clear=new kt([0,0,0,0]),this.framebuffer=new Fc(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 Ir extends ro{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=rv(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===Ce.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 mm extends Ir{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Ir.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??rt.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===Ce.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 Nc{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=Xt.add(i,Xt.NW),this.x0=h+o*Xt.uX(i),this.y0=l+a*Xt.uY(i),i=Xt.add(i,2),this.x1=h+o*Xt.uX(i),this.y1=l+a*Xt.uY(i),i=Xt.add(i,2),this.x2=h+o*Xt.uX(i),this.y2=l+a*Xt.uY(i),i=Xt.add(i,2),this.x3=h+o*Xt.uX(i),this.y3=l+a*Xt.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}}Nc.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 gm=new Nc;function Oa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class nt extends Kn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new mt(0,0,1,1)),t instanceof nt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=gm,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 dt(o.x,o.y):new dt(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&&Ai[e.url]&&nt.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,nt.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 nt(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===gm&&(this._uvs=new Nc),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=rt.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof xt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${es()}`,xt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${es()}`}n=t._pixiId}let o=Ai[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof xt)?(e.resolution||(e.resolution=er(t)),o=new nt(new xt(t,e)),o.baseTexture.cacheId=n,xt.addToCache(o.baseTexture,n),nt.addToCache(o,n)):!o&&t instanceof xt&&(o=new nt(t),nt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=nt.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 nt(xt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new xt(t,Object.assign({scaleMode:xt.defaultOptions.scaleMode,resolution:er(e)},s)),{resource:o}=n;o instanceof mm&&(o.url=e);const a=new nt(n);return i||(i=e),xt.addToCache(a.baseTexture,i),nt.addToCache(a,i),i!==e&&(xt.addToCache(a.baseTexture,e),nt.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),Ai[e]&&Ai[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ai[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ai[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ai[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ai[t.textureCacheIds[e]]===t&&delete Ai[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}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}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 nt._EMPTY||(nt._EMPTY=new nt(new xt),Oa(nt._EMPTY),Oa(nt._EMPTY.baseTexture)),nt._EMPTY}static get WHITE(){if(!nt._WHITE){const t=rt.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),nt._WHITE=new nt(xt.from(t)),Oa(nt._WHITE),Oa(nt._WHITE.baseTexture)}return nt._WHITE}}class hs extends nt{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 hs(new pm(t))}}class ym{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Jt.NONE){const s=new pm(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new hs(s)}getOptimalTexture(t,e,i=1,s=Jt.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=Ta(t),e=Ta(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||Jt.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}}}ym.SCREEN_KEY=-1;class Nv extends Cr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class bm extends Cr{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 zt(this.vertices),this.uvBuffer=new zt(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 Dv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Jt.NONE,this.sourceFrame=new mt,this.destinationFrame=new mt,this.bindingSourceFrame=new mt,this.bindingDestinationFrame=new mt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ba=[new dt,new dt,new dt,new dt],Dc=new Ot;class xm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new ym,this.statePool=[],this.quad=new Nv,this.quadUv=new bm,this.tempRect=new mt,this.activeState={},this.globalUniforms=new hi({outputFrame:new mt,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 Dv,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,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||a),c=Math.min(c,y.multisample??h),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=l,n.multisample=c,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(u);const p=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Dc.copyFrom(i.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,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,c),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const 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,Ti.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Ti.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Ti.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ti.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===Ti.CLEAR||e===Ti.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(_i.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(_i.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(Ot.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=Jt.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||Jt.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=Ba[0],s=Ba[1],n=Ba[2],o=Ba[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),c=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=c-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?Dc.copyFrom(n):Dc.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)}}}xm.extension={type:Q.RendererSystem,name:"filter"},st.add(xm);class kv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Jt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Ov=new mt;class _m{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Fc(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 mt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;rt.PREFER_ENV===Jr.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=Il.COLOR|Il.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new kv(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],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._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,c._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=Jt.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=Jt.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 c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Fc(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,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=Ov,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 mt}destroy(){this.renderer=null}}_m.extension={type:Q.RendererSystem,name:"framebuffer"},st.add(_m);const kc={5126:4,5123:2,5121:1};class vm{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;rt.PREFER_ENV===Jr.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 c=l[h];if(c)return l[a.id]=c,c;const u=t.buffers,d=t.attributes,f={},p={};for(const m in u)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*kc[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*kc[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*kc[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){const g=u[m];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),o.unbind(Si.ARRAY_BUFFER),c}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 c=a[l],u=o[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(u),h=d);const f=e.attributeData[l].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.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}}vm.extension={type:Q.RendererSystem,name:"geometry"},st.add(vm);const wm=new Ot;class Tm{constructor(t,e){this._texture=t,this.mapCoord=new Ot,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&&(wm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(wm));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 Bv=`varying vec2 vMaskCoord;
379
379
  varying vec2 vTextureCoord;
380
380
 
381
381
  uniform sampler2D uSampler;
@@ -400,7 +400,7 @@ void main(void)
400
400
 
401
401
  gl_FragColor = original;
402
402
  }
403
- `,Wv=`attribute vec2 aVertexPosition;
403
+ `,Uv=`attribute vec2 aVertexPosition;
404
404
  attribute vec2 aTextureCoord;
405
405
 
406
406
  uniform mat3 projectionMatrix;
@@ -416,7 +416,7 @@ void main(void)
416
416
  vTextureCoord = aTextureCoord;
417
417
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
418
418
  }
419
- `;class Uv extends we{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||Wv,e||Bv,i),this.maskSprite=s,this.maskMatrix=new Ot}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 Tm(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 Xv{constructor(t=null){this.type=ee.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=we.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=ee.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 Sm{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 Xv;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!==ee.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ee.SCISSOR:this.renderer.scissor.push(i);break;case ee.STENCIL:this.renderer.stencil.push(i);break;case ee.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ee.COLOR:this.pushColorMask(i);break}i.type===ee.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ee.SCISSOR:this.renderer.scissor.pop(e);break;case ee.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ee.SPRITE:this.popSpriteMask(e);break;case ee.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===ee.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ee.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ee.SCISSOR:t.type=ee.STENCIL:t.type=ee.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 Uv])),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}}Sm.extension={type:Q.RendererSystem,name:"mask"},nt.add(Sm);class Em{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 Cm=new Ot,Im=[],Am=class wl extends Em{constructor(t){super(t),this.glConst=rt.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,Im.pop()??new gt);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()||wl.isMatrixRotated(e.worldTransform)||wl.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){wl.isMatrixRotated(n)||(n=n?Cm.copyFrom(n):Cm.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&&Im.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)}};Am.extension={type:Q.RendererSystem,name:"scissor"};let Zv=Am;nt.add(Zv);class Rm extends Em{constructor(t){super(t),this.glConst=rt.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)}}Rm.extension={type:Q.RendererSystem,name:"stencil"},nt.add(Rm);class Mm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return wt("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}}Mm.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"_plugin"},nt.add(Mm);class Lm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ot,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}}Lm.extension={type:Q.RendererSystem,name:"projection"},nt.add(Lm);const Vv=new Rc,Pm=new gt;class Gm{constructor(t){this.renderer=t,this._tempMatrix=new Ot}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Pm))||t.getLocalBounds(Pm,!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=as.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=Vv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Gm.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"textureGenerator"},nt.add(Gm);const hs=new gt,no=new gt;class Nm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new gt,this.destinationFrame=new gt,this.viewportFrame=new gt}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||(hs.width=t.frame.width,hs.height=t.frame.height,e=hs),i||(no.x=t.frame.x,no.y=t.frame.y,no.width=e.width,no.height=e.height,i=no),o=n.framebuffer):(a=s.resolution,e||(hs.width=s._view.screen.width,hs.height=s._view.screen.height,e=hs),i||(i=hs,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=kt.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:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}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}}Nm.extension={type:Q.RendererSystem,name:"renderTexture"},nt.add(Nm);class Hv{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 Kv(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=cm(t,n.type),a={type:o,name:n.name,size:hm(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Yv(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=cm(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:nm(h,n.size)}}return e}function zv(r,t){var a;const e=sm(r,r.VERTEX_SHADER,t.vertexSrc),i=sm(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)||Tv(r,s,e,i),t.attributeData=Kv(s,r),t.uniformData=Yv(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,c)=>l>c?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:nm(l.type,l.size)}}return new Hv(s,o)}function jv(r,t,e,i,s){e.buffer.update(s)}const Jv={float:`
419
+ `;class Wv extends we{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||Uv,e||Bv,i),this.maskSprite=s,this.maskMatrix=new Ot}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 Tm(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 Xv{constructor(t=null){this.type=ie.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=we.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=ie.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 Sm{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 Xv;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!==ie.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ie.SCISSOR:this.renderer.scissor.push(i);break;case ie.STENCIL:this.renderer.stencil.push(i);break;case ie.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ie.COLOR:this.pushColorMask(i);break}i.type===ie.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ie.SCISSOR:this.renderer.scissor.pop(e);break;case ie.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ie.SPRITE:this.popSpriteMask(e);break;case ie.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===ie.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ie.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ie.SCISSOR:t.type=ie.STENCIL:t.type=ie.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 Wv])),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}}Sm.extension={type:Q.RendererSystem,name:"mask"},st.add(Sm);class Em{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 Cm=new Ot,Im=[],Am=class wl extends Em{constructor(t){super(t),this.glConst=rt.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,Im.pop()??new mt);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()||wl.isMatrixRotated(e.worldTransform)||wl.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){wl.isMatrixRotated(n)||(n=n?Cm.copyFrom(n):Cm.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&&Im.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)}};Am.extension={type:Q.RendererSystem,name:"scissor"};let Zv=Am;st.add(Zv);class Rm extends Em{constructor(t){super(t),this.glConst=rt.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)}}Rm.extension={type:Q.RendererSystem,name:"stencil"},st.add(Rm);class Mm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return wt("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}}Mm.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"_plugin"},st.add(Mm);class Lm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ot,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}}Lm.extension={type:Q.RendererSystem,name:"projection"},st.add(Lm);const Vv=new Rc,Pm=new mt;class Gm{constructor(t){this.renderer=t,this._tempMatrix=new Ot}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Pm))||t.getLocalBounds(Pm,!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=hs.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=Vv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Gm.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"textureGenerator"},st.add(Gm);const ls=new mt,oo=new mt;class Fm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new mt,this.destinationFrame=new mt,this.viewportFrame=new mt}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||(ls.width=t.frame.width,ls.height=t.frame.height,e=ls),i||(oo.x=t.frame.x,oo.y=t.frame.y,oo.width=e.width,oo.height=e.height,i=oo),o=n.framebuffer):(a=s.resolution,e||(ls.width=s._view.screen.width,ls.height=s._view.screen.height,e=ls),i||(i=ls,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=kt.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:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}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}}Fm.extension={type:Q.RendererSystem,name:"renderTexture"},st.add(Fm);class Hv{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 Kv(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=cm(t,n.type),a={type:o,name:n.name,size:hm(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Yv(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=cm(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:nm(h,n.size)}}return e}function zv(r,t){var a;const e=sm(r,r.VERTEX_SHADER,t.vertexSrc),i=sm(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)||Tv(r,s,e,i),t.attributeData=Kv(s,r),t.uniformData=Yv(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,c)=>l>c?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:nm(l.type,l.size)}}return new Hv(s,o)}function jv(r,t,e,i,s){e.buffer.update(s)}const Jv={float:`
420
420
  data[offset] = v;
421
421
  `,vec2:`
422
422
  data[offset] = v[0];
@@ -454,7 +454,7 @@ void main(void)
454
454
  {
455
455
  data[offset + i] = v[i];
456
456
  }
457
- `},Fm={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function $v(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=Fm[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function Qv(r,t){const e=[];for(const i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function qv(r,t){if(!r.autoManage)return{size:0,syncFunc:jv};const e=Qv(r.uniforms,t),{uboElements:i,size:s}=$v(e),n=[`
457
+ `},Nm={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function $v(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=Nm[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function Qv(r,t){const e=[];for(const i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function qv(r,t){if(!r.autoManage)return{size:0,syncFunc:jv};const e=Qv(r.uniforms,t),{uboElements:i,size:s}=$v(e),n=[`
458
458
  var v = null;
459
459
  var v2 = null;
460
460
  var cv = null;
@@ -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 c=!1;for(let u=0;u<qs.length;u++){const d=qs[u];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,qs[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){const u=hm(a.data.type),d=Math.max(Fm[a.data.type]/16,1),f=u/d,m=(4-f%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 c=!1;for(let u=0;u<rn.length;u++){const d=rn[u];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,rn[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){const u=hm(a.data.type),d=Math.max(Nm[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;n.push(`
466
466
  cv = ud.${l}.value;
467
467
  v = uv.${l};
468
468
  offset = ${a.offset/4};
@@ -475,7 +475,7 @@ void main(void)
475
475
  {
476
476
  data[offset++] = v[t++];
477
477
  }
478
- offset += ${m};
478
+ offset += ${p};
479
479
  }
480
480
 
481
481
  `)}else{const u=Jv[a.data.type];n.push(`
@@ -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 tw=0;const Ba={textureCount:0,uboCount:0};class Dm{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=tw++}systemCheck(){if(!Ev())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||(Ba.textureCount=0,Ba.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ba)),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]=_v(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,Ba,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]=qv(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=zv(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}}Dm.extension={type:Q.RendererSystem,name:"shader"},nt.add(Dm);class Wa{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(){}}Wa.defaultOptions={hello:!1},Wa.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"startup"},nt.add(Wa);function ew(r,t=[]){return t[pt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.ADD]=[r.ONE,r.ONE],t[pt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.NONE]=[0,0],t[pt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[pt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[pt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[pt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[pt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[pt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[pt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[pt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[pt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[pt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const iw=0,rw=1,sw=2,nw=3,ow=4,aw=5,km=class Sf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=pt.NONE,this._blendEq=!1,this.map=[],this.map[iw]=this.setBlend,this.map[rw]=this.setOffset,this.map[sw]=this.setCullFace,this.map[nw]=this.setDepthTest,this.map[ow]=this.setFrontFace,this.map[aw]=this.setDepthMask,this.checks=[],this.defaultState=new Ri,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=ew(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(Sf.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Sf.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}};km.extension={type:Q.RendererSystem,name:"state"};let hw=km;nt.add(hw);class lw extends Hn{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 ai(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 oo=class Tl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Tl.defaultMaxIdle,this.checkCountMax=Tl.defaultCheckCountMax,this.mode=Tl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Al.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}};oo.defaultMode=Al.AUTO,oo.defaultMaxIdle=60*60,oo.defaultCheckCountMax=60*10,oo.extension={type:Q.RendererSystem,name:"textureGC"};let ls=oo;nt.add(ls);class Oc{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=ct.UNSIGNED_BYTE,this.internalFormat=Y.RGBA,this.samplerType=0}}function cw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:it.FLOAT,[r.RGBA]:it.FLOAT,[r.ALPHA]:it.FLOAT,[r.LUMINANCE]:it.FLOAT,[r.LUMINANCE_ALPHA]:it.FLOAT,[r.R8]:it.FLOAT,[r.R8_SNORM]:it.FLOAT,[r.RG8]:it.FLOAT,[r.RG8_SNORM]:it.FLOAT,[r.RGB8]:it.FLOAT,[r.RGB8_SNORM]:it.FLOAT,[r.RGB565]:it.FLOAT,[r.RGBA4]:it.FLOAT,[r.RGB5_A1]:it.FLOAT,[r.RGBA8]:it.FLOAT,[r.RGBA8_SNORM]:it.FLOAT,[r.RGB10_A2]:it.FLOAT,[r.RGB10_A2UI]:it.FLOAT,[r.SRGB8]:it.FLOAT,[r.SRGB8_ALPHA8]:it.FLOAT,[r.R16F]:it.FLOAT,[r.RG16F]:it.FLOAT,[r.RGB16F]:it.FLOAT,[r.RGBA16F]:it.FLOAT,[r.R32F]:it.FLOAT,[r.RG32F]:it.FLOAT,[r.RGB32F]:it.FLOAT,[r.RGBA32F]:it.FLOAT,[r.R11F_G11F_B10F]:it.FLOAT,[r.RGB9_E5]:it.FLOAT,[r.R8I]:it.INT,[r.R8UI]:it.UINT,[r.R16I]:it.INT,[r.R16UI]:it.UINT,[r.R32I]:it.INT,[r.R32UI]:it.UINT,[r.RG8I]:it.INT,[r.RG8UI]:it.UINT,[r.RG16I]:it.INT,[r.RG16UI]:it.UINT,[r.RG32I]:it.INT,[r.RG32UI]:it.UINT,[r.RGB8I]:it.INT,[r.RGB8UI]:it.UINT,[r.RGB16I]:it.INT,[r.RGB16UI]:it.UINT,[r.RGB32I]:it.INT,[r.RGB32UI]:it.UINT,[r.RGBA8I]:it.INT,[r.RGBA8UI]:it.UINT,[r.RGBA16I]:it.INT,[r.RGBA16UI]:it.UINT,[r.RGBA32I]:it.INT,[r.RGBA32UI]:it.UINT,[r.DEPTH_COMPONENT16]:it.FLOAT,[r.DEPTH_COMPONENT24]:it.FLOAT,[r.DEPTH_COMPONENT32F]:it.FLOAT,[r.DEPTH_STENCIL]:it.FLOAT,[r.DEPTH24_STENCIL8]:it.FLOAT,[r.DEPTH32F_STENCIL8]:it.FLOAT}:t={[r.RGB]:it.FLOAT,[r.RGBA]:it.FLOAT,[r.ALPHA]:it.FLOAT,[r.LUMINANCE]:it.FLOAT,[r.LUMINANCE_ALPHA]:it.FLOAT,[r.DEPTH_STENCIL]:it.FLOAT},t}function uw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ct.UNSIGNED_BYTE]:{[Y.RGBA]:r.RGBA8,[Y.RGB]:r.RGB8,[Y.RG]:r.RG8,[Y.RED]:r.R8,[Y.RGBA_INTEGER]:r.RGBA8UI,[Y.RGB_INTEGER]:r.RGB8UI,[Y.RG_INTEGER]:r.RG8UI,[Y.RED_INTEGER]:r.R8UI,[Y.ALPHA]:r.ALPHA,[Y.LUMINANCE]:r.LUMINANCE,[Y.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ct.BYTE]:{[Y.RGBA]:r.RGBA8_SNORM,[Y.RGB]:r.RGB8_SNORM,[Y.RG]:r.RG8_SNORM,[Y.RED]:r.R8_SNORM,[Y.RGBA_INTEGER]:r.RGBA8I,[Y.RGB_INTEGER]:r.RGB8I,[Y.RG_INTEGER]:r.RG8I,[Y.RED_INTEGER]:r.R8I},[ct.UNSIGNED_SHORT]:{[Y.RGBA_INTEGER]:r.RGBA16UI,[Y.RGB_INTEGER]:r.RGB16UI,[Y.RG_INTEGER]:r.RG16UI,[Y.RED_INTEGER]:r.R16UI,[Y.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ct.SHORT]:{[Y.RGBA_INTEGER]:r.RGBA16I,[Y.RGB_INTEGER]:r.RGB16I,[Y.RG_INTEGER]:r.RG16I,[Y.RED_INTEGER]:r.R16I},[ct.UNSIGNED_INT]:{[Y.RGBA_INTEGER]:r.RGBA32UI,[Y.RGB_INTEGER]:r.RGB32UI,[Y.RG_INTEGER]:r.RG32UI,[Y.RED_INTEGER]:r.R32UI,[Y.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ct.INT]:{[Y.RGBA_INTEGER]:r.RGBA32I,[Y.RGB_INTEGER]:r.RGB32I,[Y.RG_INTEGER]:r.RG32I,[Y.RED_INTEGER]:r.R32I},[ct.FLOAT]:{[Y.RGBA]:r.RGBA32F,[Y.RGB]:r.RGB32F,[Y.RG]:r.RG32F,[Y.RED]:r.R32F,[Y.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ct.HALF_FLOAT]:{[Y.RGBA]:r.RGBA16F,[Y.RGB]:r.RGB16F,[Y.RG]:r.RG16F,[Y.RED]:r.R16F},[ct.UNSIGNED_SHORT_5_6_5]:{[Y.RGB]:r.RGB565},[ct.UNSIGNED_SHORT_4_4_4_4]:{[Y.RGBA]:r.RGBA4},[ct.UNSIGNED_SHORT_5_5_5_1]:{[Y.RGBA]:r.RGB5_A1},[ct.UNSIGNED_INT_2_10_10_10_REV]:{[Y.RGBA]:r.RGB10_A2,[Y.RGBA_INTEGER]:r.RGB10_A2UI},[ct.UNSIGNED_INT_10F_11F_11F_REV]:{[Y.RGB]:r.R11F_G11F_B10F},[ct.UNSIGNED_INT_5_9_9_9_REV]:{[Y.RGB]:r.RGB9_E5},[ct.UNSIGNED_INT_24_8]:{[Y.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ct.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Y.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ct.UNSIGNED_BYTE]:{[Y.RGBA]:r.RGBA,[Y.RGB]:r.RGB,[Y.ALPHA]:r.ALPHA,[Y.LUMINANCE]:r.LUMINANCE,[Y.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ct.UNSIGNED_SHORT_5_6_5]:{[Y.RGB]:r.RGB},[ct.UNSIGNED_SHORT_4_4_4_4]:{[Y.RGBA]:r.RGBA},[ct.UNSIGNED_SHORT_5_5_5_1]:{[Y.RGBA]:r.RGBA}},t}class Om{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xt,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=uw(t),this.samplerTypes=cw(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 Oc(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 Oc(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!==it.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Oc(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]??it.FLOAT,this.webGLVersion===2&&t.type===ct.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!==it.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&&Qs(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===wi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=vi.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!==wi.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===ji.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ji.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===ji.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===ji.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Om.extension={type:Q.RendererSystem,name:"texture"},nt.add(Om);class Bm{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}}Bm.extension={type:Q.RendererSystem,name:"transformFeedback"},nt.add(Bm);class Ua{constructor(t){this.renderer=t}init(t){this.screen=new gt(0,0,t.width,t.height),this.element=t.view||rt.ADAPTER.createCanvas(),this.resolution=t.resolution||rt.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}}Ua.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Ua.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"_view"},nt.add(Ua),rt.PREFER_ENV=jr.WEBGL2,rt.STRICT_TEXTURE_CACHE=!1,rt.RENDER_OPTIONS={...Da.defaultOptions,...Fa.defaultOptions,...Ua.defaultOptions,...Wa.defaultOptions},Object.defineProperties(rt,{WRAP_MODE:{get(){return xt.defaultOptions.wrapMode},set(r){wt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),xt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return xt.defaultOptions.scaleMode},set(r){wt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),xt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return xt.defaultOptions.mipmap},set(r){wt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),xt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return xt.defaultOptions.anisotropicLevel},set(r){wt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),xt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return wt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),we.defaultResolution},set(r){we.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return wt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),we.defaultMultisample},set(r){we.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return os.defaultMaxTextures},set(r){wt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),os.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return os.defaultBatchSize},set(r){wt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),os.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return os.canUploadSameBuffer},set(r){wt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),os.canUploadSameBuffer=r}},GC_MODE:{get(){return ls.defaultMode},set(r){wt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ls.defaultMode=r}},GC_MAX_IDLE:{get(){return ls.defaultMaxIdle},set(r){wt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ls.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return ls.defaultCheckCountMax},set(r){wt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ls.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return rr.defaultVertexPrecision},set(r){wt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),rr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return rr.defaultFragmentPrecision},set(r){wt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),rr.defaultFragmentPrecision=r}}});var cs=(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))(cs||{});class Bc{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 Wm=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 Bc(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=cs.NORMAL){return this._addListener(new Bc(t,e,i))}addOnce(t,e,i=cs.NORMAL){return this._addListener(new Bc(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}};Wm.targetFPMS=.06;let Te=Wm;Object.defineProperties(rt,{TARGET_FPMS:{get(){return Te.targetFPMS},set(r){wt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Te.targetFPMS=r}}});class Um{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,cs.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Te.shared:new Te,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Um.extension=Q.Application,nt.add(Um);const Xm=[];nt.handleByList(Q.Renderer,Xm);function dw(r){for(const t of Xm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var fw=`attribute vec2 aVertexPosition;
489
+ `))}}let tw=0;const Ua={textureCount:0,uboCount:0};class Dm{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=tw++}systemCheck(){if(!Ev())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||(Ua.textureCount=0,Ua.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ua)),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]=_v(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,Ua,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]=qv(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=zv(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}}Dm.extension={type:Q.RendererSystem,name:"shader"},st.add(Dm);class Wa{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(){}}Wa.defaultOptions={hello:!1},Wa.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"startup"},st.add(Wa);function ew(r,t=[]){return t[pt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.ADD]=[r.ONE,r.ONE],t[pt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.NONE]=[0,0],t[pt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[pt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[pt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[pt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[pt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[pt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[pt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[pt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[pt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[pt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[pt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const iw=0,rw=1,sw=2,nw=3,ow=4,aw=5,km=class Sf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=pt.NONE,this._blendEq=!1,this.map=[],this.map[iw]=this.setBlend,this.map[rw]=this.setOffset,this.map[sw]=this.setCullFace,this.map[nw]=this.setDepthTest,this.map[ow]=this.setFrontFace,this.map[aw]=this.setDepthMask,this.checks=[],this.defaultState=new Ri,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=ew(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(Sf.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Sf.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}};km.extension={type:Q.RendererSystem,name:"state"};let hw=km;st.add(hw);class lw extends Kn{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 ai(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 ao=class Tl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Tl.defaultMaxIdle,this.checkCountMax=Tl.defaultCheckCountMax,this.mode=Tl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Al.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}};ao.defaultMode=Al.AUTO,ao.defaultMaxIdle=60*60,ao.defaultCheckCountMax=60*10,ao.extension={type:Q.RendererSystem,name:"textureGC"};let cs=ao;st.add(cs);class Oc{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=lt.UNSIGNED_BYTE,this.internalFormat=Y.RGBA,this.samplerType=0}}function cw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:it.FLOAT,[r.RGBA]:it.FLOAT,[r.ALPHA]:it.FLOAT,[r.LUMINANCE]:it.FLOAT,[r.LUMINANCE_ALPHA]:it.FLOAT,[r.R8]:it.FLOAT,[r.R8_SNORM]:it.FLOAT,[r.RG8]:it.FLOAT,[r.RG8_SNORM]:it.FLOAT,[r.RGB8]:it.FLOAT,[r.RGB8_SNORM]:it.FLOAT,[r.RGB565]:it.FLOAT,[r.RGBA4]:it.FLOAT,[r.RGB5_A1]:it.FLOAT,[r.RGBA8]:it.FLOAT,[r.RGBA8_SNORM]:it.FLOAT,[r.RGB10_A2]:it.FLOAT,[r.RGB10_A2UI]:it.FLOAT,[r.SRGB8]:it.FLOAT,[r.SRGB8_ALPHA8]:it.FLOAT,[r.R16F]:it.FLOAT,[r.RG16F]:it.FLOAT,[r.RGB16F]:it.FLOAT,[r.RGBA16F]:it.FLOAT,[r.R32F]:it.FLOAT,[r.RG32F]:it.FLOAT,[r.RGB32F]:it.FLOAT,[r.RGBA32F]:it.FLOAT,[r.R11F_G11F_B10F]:it.FLOAT,[r.RGB9_E5]:it.FLOAT,[r.R8I]:it.INT,[r.R8UI]:it.UINT,[r.R16I]:it.INT,[r.R16UI]:it.UINT,[r.R32I]:it.INT,[r.R32UI]:it.UINT,[r.RG8I]:it.INT,[r.RG8UI]:it.UINT,[r.RG16I]:it.INT,[r.RG16UI]:it.UINT,[r.RG32I]:it.INT,[r.RG32UI]:it.UINT,[r.RGB8I]:it.INT,[r.RGB8UI]:it.UINT,[r.RGB16I]:it.INT,[r.RGB16UI]:it.UINT,[r.RGB32I]:it.INT,[r.RGB32UI]:it.UINT,[r.RGBA8I]:it.INT,[r.RGBA8UI]:it.UINT,[r.RGBA16I]:it.INT,[r.RGBA16UI]:it.UINT,[r.RGBA32I]:it.INT,[r.RGBA32UI]:it.UINT,[r.DEPTH_COMPONENT16]:it.FLOAT,[r.DEPTH_COMPONENT24]:it.FLOAT,[r.DEPTH_COMPONENT32F]:it.FLOAT,[r.DEPTH_STENCIL]:it.FLOAT,[r.DEPTH24_STENCIL8]:it.FLOAT,[r.DEPTH32F_STENCIL8]:it.FLOAT}:t={[r.RGB]:it.FLOAT,[r.RGBA]:it.FLOAT,[r.ALPHA]:it.FLOAT,[r.LUMINANCE]:it.FLOAT,[r.LUMINANCE_ALPHA]:it.FLOAT,[r.DEPTH_STENCIL]:it.FLOAT},t}function uw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[lt.UNSIGNED_BYTE]:{[Y.RGBA]:r.RGBA8,[Y.RGB]:r.RGB8,[Y.RG]:r.RG8,[Y.RED]:r.R8,[Y.RGBA_INTEGER]:r.RGBA8UI,[Y.RGB_INTEGER]:r.RGB8UI,[Y.RG_INTEGER]:r.RG8UI,[Y.RED_INTEGER]:r.R8UI,[Y.ALPHA]:r.ALPHA,[Y.LUMINANCE]:r.LUMINANCE,[Y.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.BYTE]:{[Y.RGBA]:r.RGBA8_SNORM,[Y.RGB]:r.RGB8_SNORM,[Y.RG]:r.RG8_SNORM,[Y.RED]:r.R8_SNORM,[Y.RGBA_INTEGER]:r.RGBA8I,[Y.RGB_INTEGER]:r.RGB8I,[Y.RG_INTEGER]:r.RG8I,[Y.RED_INTEGER]:r.R8I},[lt.UNSIGNED_SHORT]:{[Y.RGBA_INTEGER]:r.RGBA16UI,[Y.RGB_INTEGER]:r.RGB16UI,[Y.RG_INTEGER]:r.RG16UI,[Y.RED_INTEGER]:r.R16UI,[Y.DEPTH_COMPONENT]:r.D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:r.RGB,[Y.ALPHA]:r.ALPHA,[Y.LUMINANCE]:r.LUMINANCE,[Y.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.UNSIGNED_SHORT_5_6_5]:{[Y.RGB]:r.RGB},[lt.UNSIGNED_SHORT_4_4_4_4]:{[Y.RGBA]:r.RGBA},[lt.UNSIGNED_SHORT_5_5_5_1]:{[Y.RGBA]:r.RGBA}},t}class Om{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xt,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=uw(t),this.samplerTypes=cw(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 Oc(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 Oc(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!==it.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Oc(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]??it.FLOAT,this.webGLVersion===2&&t.type===lt.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!==it.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&&en(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===wi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=vi.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!==wi.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===ji.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ji.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===ji.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===ji.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Om.extension={type:Q.RendererSystem,name:"texture"},st.add(Om);class Bm{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}}Bm.extension={type:Q.RendererSystem,name:"transformFeedback"},st.add(Bm);class Xa{constructor(t){this.renderer=t}init(t){this.screen=new mt(0,0,t.width,t.height),this.element=t.view||rt.ADAPTER.createCanvas(),this.resolution=t.resolution||rt.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}}Xa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Xa.extension={type:[Q.RendererSystem,Q.CanvasRendererSystem],name:"_view"},st.add(Xa),rt.PREFER_ENV=Jr.WEBGL2,rt.STRICT_TEXTURE_CACHE=!1,rt.RENDER_OPTIONS={...ka.defaultOptions,...Da.defaultOptions,...Xa.defaultOptions,...Wa.defaultOptions},Object.defineProperties(rt,{WRAP_MODE:{get(){return xt.defaultOptions.wrapMode},set(r){wt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),xt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return xt.defaultOptions.scaleMode},set(r){wt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),xt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return xt.defaultOptions.mipmap},set(r){wt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),xt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return xt.defaultOptions.anisotropicLevel},set(r){wt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),xt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return wt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),we.defaultResolution},set(r){we.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return wt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),we.defaultMultisample},set(r){we.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return as.defaultMaxTextures},set(r){wt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),as.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return as.defaultBatchSize},set(r){wt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),as.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return as.canUploadSameBuffer},set(r){wt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),as.canUploadSameBuffer=r}},GC_MODE:{get(){return cs.defaultMode},set(r){wt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),cs.defaultMode=r}},GC_MAX_IDLE:{get(){return cs.defaultMaxIdle},set(r){wt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),cs.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return cs.defaultCheckCountMax},set(r){wt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),cs.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return rr.defaultVertexPrecision},set(r){wt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),rr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return rr.defaultFragmentPrecision},set(r){wt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),rr.defaultFragmentPrecision=r}}});var us=(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))(us||{});class Bc{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 Um=class He{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 Bc(null,null,1/0),this.deltaMS=1/He.targetFPMS,this.elapsedMS=1/He.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=us.NORMAL){return this._addListener(new Bc(t,e,i))}addOnce(t,e,i=us.NORMAL){return this._addListener(new Bc(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*He.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,He.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(!He._shared){const t=He._shared=new He;t.autoStart=!0,t._protected=!0}return He._shared}static get system(){if(!He._system){const t=He._system=new He;t.autoStart=!0,t._protected=!0}return He._system}};Um.targetFPMS=.06;let Te=Um;Object.defineProperties(rt,{TARGET_FPMS:{get(){return Te.targetFPMS},set(r){wt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Te.targetFPMS=r}}});class Wm{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,us.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Te.shared:new Te,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Wm.extension=Q.Application,st.add(Wm);const Xm=[];st.handleByList(Q.Renderer,Xm);function dw(r){for(const t of Xm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var fw=`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 mw=fw,Zm=pw;class Vm{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>=Jt.HIGH?this.multisample=Jt.HIGH:e>=Jt.MEDIUM?this.multisample=Jt.MEDIUM:e>=Jt.LOW?this.multisample=Jt.LOW:this.multisample=Jt.NONE}destroy(){}}Vm.extension={type:Q.RendererSystem,name:"_multisample"},nt.add(Vm);class gw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Hm{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 gw(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Hm.extension={type:Q.RendererSystem,name:"buffer"},nt.add(Hm);class Km{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}}Km.extension={type:Q.RendererSystem,name:"objectRenderer"},nt.add(Km);const Xa=class Ef extends lw{constructor(t){super(),this.type=Gf.WEBGL,t=Object.assign({},rt.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new hi({projectionMatrix:new Ot},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Ef.__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&&(wt("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=Ef.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:B1()}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 wt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return wt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return wt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return wt("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)}};Xa.extension={type:Q.Renderer,priority:1},Xa.__plugins={},Xa.__systems={};let Wc=Xa;nt.handleByMap(Q.RendererPlugin,Wc.__plugins),nt.handleByMap(Q.RendererSystem,Wc.__systems),nt.add(Wc);class Ym extends io{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 xt;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 io?this.addResourceAt(t[i],i):this.addResourceAt(tm(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 yw extends Ym{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=Bs.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 bw extends Ir{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const zm=class ia extends Ym{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==ia.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<ia.SIDES;a++)this.items[a].target=Bs.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=Bs.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=Bs.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<ia.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===ia.SIDES}};zm.SIDES=6;let xw=zm;class en extends Ir{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=en.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 rt.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===Ce.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 en._EMPTY=en._EMPTY??rt.ADAPTER.createCanvas(0,0),en._EMPTY}}const Uc=class Sl extends Ir{constructor(t,e){e=e||{},super(rt.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)},Sl.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;Ir.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_${ts()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Sl.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"&&Sl.SVG_XML.test(t)}};Uc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Uc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Xc=Uc;const Zc=class Cf extends Ir{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];Ir.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(),c=l.slice(l.lastIndexOf(".")+1);h=h||Cf.MIME_TYPES[c]||`video/${c}`}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=Te.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&&(Te.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||(Te.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Te.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Cf.TYPES.includes(e)}};Zc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Zc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let jm=Zc;Sc.push(en,mm,bw,jm,Xc,Ta,xw,yw);class Za{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?gt.EMPTY:(t=t||new gt(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,c=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,c),this.maxY=Math.max(this.maxY,c)}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,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,m=this.maxX,p=this.maxY,g=o*e+h*i+c,y=a*e+l*i+u;d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*s+h*i+c,y=a*s+l*i+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*e+h*n+c,y=a*e+l*n+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*s+h*n+c,y=a*s+l*n+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,this.minX=d,this.minY=f,this.maxX=m,this.maxY=p}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],c=t[h+1];s=l<s?l:s,n=c<n?c:n,o=l>o?l:o,a=c>a?c: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,c=t.d,u=t.tx,d=t.ty;let f=this.minX,m=this.minY,p=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const x=e[y],b=e[y+1],v=a*x+l*b+u,T=c*b+h*x+d;f=Math.min(f,v-n),p=Math.max(p,v+n),m=Math.min(m,T-o),g=Math.max(g,T+o)}this.minX=f,this.minY=m,this.maxX=p,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,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}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,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}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 Zt extends Hn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Rc,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 Za,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(Zt.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 gt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new gt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Za);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 _w),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*fv}set angle(t){this.transform.rotation=t*pv}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 _w extends Zt{constructor(){super(...arguments),this.sortDirty=null}}Zt.prototype.displayObjectUpdateTransform=Zt.prototype.updateTransform;const vw=new Ot;function ww(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Jm=class If extends Zt{constructor(){super(),this.children=[],this.sortableChildren=If.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);Qs(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,Qs(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,Qs(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(ww),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!==If.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=vw.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!==ee.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}};Jm.defaultSortableChildren=!1;let Ct=Jm;Ct.prototype.containerUpdateTransform=Ct.prototype.updateTransform,Object.defineProperties(rt,{SORTABLE_CHILDREN:{get(){return Ct.defaultSortableChildren},set(r){wt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Ct.defaultSortableChildren=r}}});const ao=new dt,Tw=new Uint16Array([0,1,2,0,2,3]);class $t extends Ct{constructor(t){super(),this._anchor=new ir(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 kt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=pt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||ot.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Tw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=rt.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Sr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Sr(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,c=t.trim,u=t.orig,d=this._anchor;let f=0,m=0,p=0,g=0;if(c?(m=c.x-d._x*u.width,f=m+c.width,g=c.y-d._y*u.height,p=g+c.height):(m=-d._x*u.width,f=m+u.width,g=-d._y*u.height,p=g+u.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*f+n*g+a,l[3]=o*g+s*f+h,l[4]=i*f+n*p+a,l[5]=o*p+s*f+h,l[6]=i*m+n*p+a,l[7]=o*p+s*m+h,this._roundPixels){const y=rt.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*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,c=n.tx,u=n.ty,d=-s._x*i.width,f=d+i.width,m=-s._y*i.height,p=m+i.height;if(e[0]=o*d+h*m+c,e[1]=l*m+a*d+u,e[2]=o*f+h*m+c,e[3]=l*m+a*f+u,e[4]=o*f+h*p+c,e[5]=l*p+a*f+u,e[6]=o*d+h*p+c,e[7]=l*p+a*d+u,this._roundPixels){const g=rt.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 Za),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 gt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ao);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return ao.x>=s&&ao.x<s+e&&(n=-i*this.anchor.y,ao.y>=n&&ao.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 ot?t:ot.from(t,e);return new $t(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=Sr(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=Sr(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||ot.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const $m=new Ot;Zt.prototype._cacheAsBitmap=!1,Zt.prototype._cacheData=null,Zt.prototype._cacheAsBitmapResolution=null,Zt.prototype._cacheAsBitmapMultisample=null;class Sw{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(Zt.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 Sw),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)}}}),Zt.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))},Zt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new gt,!0);if((f=this.filters)!=null&&f.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=as.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${ts()}`;this._cacheData.textureCacheId=l,xt.addToCache(h.baseTexture,l),ot.addToCache(h,l);const c=this.transform.localTransform.copyTo($m).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:c,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 u=new $t(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},Zt.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))},Zt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new gt,!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=as.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${ts()}`;this._cacheData.textureCacheId=a,xt.addToCache(o.baseTexture,a),ot.addToCache(o,a);const h=$m;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 $t(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)},Zt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Zt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Zt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,xt.removeFromCache(this._cacheData.textureCacheId),ot.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Zt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Zt.prototype.name=null,Ct.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},Zt.prototype.getGlobalPosition=function(r=new dt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Ew=`varying vec2 vTextureCoord;
526
+ `;const mw=fw,Zm=pw;class Vm{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>=Jt.HIGH?this.multisample=Jt.HIGH:e>=Jt.MEDIUM?this.multisample=Jt.MEDIUM:e>=Jt.LOW?this.multisample=Jt.LOW:this.multisample=Jt.NONE}destroy(){}}Vm.extension={type:Q.RendererSystem,name:"_multisample"},st.add(Vm);class gw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Hm{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 gw(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Hm.extension={type:Q.RendererSystem,name:"buffer"},st.add(Hm);class Km{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}}Km.extension={type:Q.RendererSystem,name:"objectRenderer"},st.add(Km);const Za=class Ef extends lw{constructor(t){super(),this.type=Gf.WEBGL,t=Object.assign({},rt.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new hi({projectionMatrix:new Ot},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Ef.__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&&(wt("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=Ef.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:B1()}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 wt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return wt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return wt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return wt("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)}};Za.extension={type:Q.Renderer,priority:1},Za.__plugins={},Za.__systems={};let Uc=Za;st.handleByMap(Q.RendererPlugin,Uc.__plugins),st.handleByMap(Q.RendererSystem,Uc.__systems),st.add(Uc);class Ym extends ro{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 xt;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 ro?this.addResourceAt(t[i],i):this.addResourceAt(tm(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 yw extends Ym{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=Xs.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 bw extends Ir{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const zm=class ra extends Ym{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==ra.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<ra.SIDES;a++)this.items[a].target=Xs.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=Xs.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=Xs.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<ra.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===ra.SIDES}};zm.SIDES=6;let xw=zm;class nn extends Ir{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=nn.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 rt.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===Ce.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 nn._EMPTY=nn._EMPTY??rt.ADAPTER.createCanvas(0,0),nn._EMPTY}}const Wc=class Sl extends Ir{constructor(t,e){e=e||{},super(rt.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)},Sl.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;Ir.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_${es()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Sl.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"&&Sl.SVG_XML.test(t)}};Wc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Wc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Xc=Wc;const Zc=class Cf extends Ir{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];Ir.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(),c=l.slice(l.lastIndexOf(".")+1);h=h||Cf.MIME_TYPES[c]||`video/${c}`}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=Te.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&&(Te.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||(Te.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Te.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Cf.TYPES.includes(e)}};Zc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Zc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let jm=Zc;Sc.push(nn,mm,bw,jm,Xc,Sa,xw,yw);class Va{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?mt.EMPTY:(t=t||new mt(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,c=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,c),this.maxY=Math.max(this.maxY,c)}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,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=o*e+h*i+c,y=a*e+l*i+u;d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*s+h*i+c,y=a*s+l*i+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*e+h*n+c,y=a*e+l*n+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*s+h*n+c,y=a*s+l*n+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}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],c=t[h+1];s=l<s?l:s,n=c<n?c:n,o=l>o?l:o,a=c>a?c: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,c=t.d,u=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const x=e[y],b=e[y+1],v=a*x+l*b+u,w=c*b+h*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,w-o),g=Math.max(g,w+o)}this.minX=f,this.minY=p,this.maxX=m,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,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}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,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}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 Zt extends Kn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Rc,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 Va,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(Zt.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 mt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new mt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Va);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 _w),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*fv}set angle(t){this.transform.rotation=t*pv}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 _w extends Zt{constructor(){super(...arguments),this.sortDirty=null}}Zt.prototype.displayObjectUpdateTransform=Zt.prototype.updateTransform;const vw=new Ot;function ww(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Jm=class If extends Zt{constructor(){super(),this.children=[],this.sortableChildren=If.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);en(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,en(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,en(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(ww),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!==If.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=vw.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!==ie.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}};Jm.defaultSortableChildren=!1;let Ct=Jm;Ct.prototype.containerUpdateTransform=Ct.prototype.updateTransform,Object.defineProperties(rt,{SORTABLE_CHILDREN:{get(){return Ct.defaultSortableChildren},set(r){wt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Ct.defaultSortableChildren=r}}});const ho=new dt,Tw=new Uint16Array([0,1,2,0,2,3]);class $t extends Ct{constructor(t){super(),this._anchor=new ir(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 kt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=pt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||nt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Tw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=rt.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Sr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Sr(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,c=t.trim,u=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,g=c.y-d._y*u.height,m=g+c.height):(p=-d._x*u.width,f=p+u.width,g=-d._y*u.height,m=g+u.height),l[0]=i*p+n*g+a,l[1]=o*g+s*p+h,l[2]=i*f+n*g+a,l[3]=o*g+s*f+h,l[4]=i*f+n*m+a,l[5]=o*m+s*f+h,l[6]=i*p+n*m+a,l[7]=o*m+s*p+h,this._roundPixels){const y=rt.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*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,c=n.tx,u=n.ty,d=-s._x*i.width,f=d+i.width,p=-s._y*i.height,m=p+i.height;if(e[0]=o*d+h*p+c,e[1]=l*p+a*d+u,e[2]=o*f+h*p+c,e[3]=l*p+a*f+u,e[4]=o*f+h*m+c,e[5]=l*m+a*f+u,e[6]=o*d+h*m+c,e[7]=l*m+a*d+u,this._roundPixels){const g=rt.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 Va),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 mt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ho);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return ho.x>=s&&ho.x<s+e&&(n=-i*this.anchor.y,ho.y>=n&&ho.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 nt?t:nt.from(t,e);return new $t(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=Sr(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=Sr(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||nt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const $m=new Ot;Zt.prototype._cacheAsBitmap=!1,Zt.prototype._cacheData=null,Zt.prototype._cacheAsBitmapResolution=null,Zt.prototype._cacheAsBitmapMultisample=null;class Sw{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(Zt.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 Sw),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)}}}),Zt.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))},Zt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new mt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}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=hs.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${es()}`;this._cacheData.textureCacheId=l,xt.addToCache(h.baseTexture,l),nt.addToCache(h,l);const c=this.transform.localTransform.copyTo($m).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:c,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 u=new $t(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},Zt.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))},Zt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new mt,!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=hs.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${es()}`;this._cacheData.textureCacheId=a,xt.addToCache(o.baseTexture,a),nt.addToCache(o,a);const h=$m;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 $t(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)},Zt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Zt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Zt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,xt.removeFromCache(this._cacheData.textureCacheId),nt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Zt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Zt.prototype.name=null,Ct.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},Zt.prototype.getGlobalPosition=function(r=new dt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Ew=`varying vec2 vTextureCoord;
527
527
 
528
528
  uniform sampler2D uSampler;
529
529
  uniform float uAlpha;
@@ -617,7 +617,7 @@ void main(void)
617
617
 
618
618
  gl_FragColor = vec4(rgb, result.a);
619
619
  }
620
- `;class Hc extends we{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Zm,Gw,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=kt.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),h=i+(1-i)*o,l=o*(1-i)-a*s,c=o*(1-i)+a*s,u=o*(1-i)+a*s,d=i+o*(1-i),f=o*(1-i)-a*s,m=o*(1-i)-a*s,p=o*(1-i)+a*s,g=i+o*(1-i),y=[h,l,c,0,0,u,d,f,0,0,m,p,g,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=kt.shared,[a,h,l]=o.setValue(i).toArray(),[c,u,d]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,h,l,t,0,c,u,d,e,0,a-c,h-u,l-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}Hc.prototype.grayscale=Hc.prototype.greyscale;var Nw=`varying vec2 vFilterCoord;
620
+ `;class Hc extends we{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Zm,Gw,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=kt.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),h=i+(1-i)*o,l=o*(1-i)-a*s,c=o*(1-i)+a*s,u=o*(1-i)+a*s,d=i+o*(1-i),f=o*(1-i)-a*s,p=o*(1-i)-a*s,m=o*(1-i)+a*s,g=i+o*(1-i),y=[h,l,c,0,0,u,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=kt.shared,[a,h,l]=o.setValue(i).toArray(),[c,u,d]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,h,l,t,0,c,u,d,e,0,a-c,h-u,l-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}Hc.prototype.grayscale=Hc.prototype.greyscale;var Fw=`varying vec2 vFilterCoord;
621
621
  varying vec2 vTextureCoord;
622
622
 
623
623
  uniform vec2 scale;
@@ -637,7 +637,7 @@ void main(void)
637
637
 
638
638
  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
639
639
  }
640
- `,Fw=`attribute vec2 aVertexPosition;
640
+ `,Nw=`attribute vec2 aVertexPosition;
641
641
 
642
642
  uniform mat3 projectionMatrix;
643
643
  uniform mat3 filterMatrix;
@@ -666,7 +666,7 @@ void main(void)
666
666
  vTextureCoord = filterTextureCoord();
667
667
  vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
668
668
  }
669
- `;class Dw extends we{constructor(t,e){const i=new Ot;t.renderable=!1,super(Fw,Nw,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,e==null&&(e=20),this.scale=new dt(e,e)}apply(t,e,i,s){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),t.applyFilter(this,e,i,s)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var kw=`varying vec2 v_rgbNW;
669
+ `;class Dw extends we{constructor(t,e){const i=new Ot;t.renderable=!1,super(Nw,Fw,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,e==null&&(e=20),this.scale=new dt(e,e)}apply(t,e,i,s){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),t.applyFilter(this,e,i,s)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var kw=`varying vec2 v_rgbNW;
670
670
  varying vec2 v_rgbNE;
671
671
  varying vec2 v_rgbSW;
672
672
  varying vec2 v_rgbSE;
@@ -829,7 +829,7 @@ void main(void) {
829
829
 
830
830
  texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
831
831
  }
832
- `;class Bw extends we{constructor(){super(Ow,kw)}}var Ww=`precision highp float;
832
+ `;class Bw extends we{constructor(){super(Ow,kw)}}var Uw=`precision highp float;
833
833
 
834
834
  varying vec2 vTextureCoord;
835
835
  varying vec4 vColor;
@@ -863,8 +863,8 @@ void main()
863
863
 
864
864
  gl_FragColor = color;
865
865
  }
866
- `;class Uw extends we{constructor(t=.5,e=Math.random()){super(Zm,Ww,{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 Qm={AlphaFilter:Cw,BlurFilter:Pw,BlurFilterPass:Vc,ColorMatrixFilter:Hc,DisplacementFilter:Dw,FXAAFilter:Bw,NoiseFilter:Uw};Object.entries(Qm).forEach(([r,t])=>{Object.defineProperty(Qm,r,{get(){return wt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class Xw{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||(Te.system.add(this.tickerUpdate,this,cs.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Te.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 Ar=new Xw;class ho{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ho.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,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 Va extends ho{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}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,c,u,d,f,m,p){throw new Error("Method not implemented.")}}class li extends Va{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 rn extends Va{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}rn.DOM_DELTA_PIXEL=0,rn.DOM_DELTA_LINE=1,rn.DOM_DELTA_PAGE=2;const Zw=2048,Vw=new dt,Kc=new dt;class Hw{constructor(t){this.dispatch=new Hn,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){Ar.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,Vw.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<Zw&&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")&&(Ar.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let u=c.length-1;u>=0;u--){const d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),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")&&(Ar.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,s,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();return(u.length>0||d)&&u.push(t),u}}}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,Kc),!t.hitArea.contains(Kc.x,Kc.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 li)){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 li)){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 c=t.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(t,c,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"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(u)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}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 li)){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 li)){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 li)){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 li)){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 rn)){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(li);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(rn);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(li);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 li&&e instanceof li&&(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 Va&&e instanceof Va&&(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 Kw=1,Yw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Yc=class Af{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Hw(null),Ar.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new li(null),this.rootWheelEvent=new rn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Af.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,Af._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,Ar.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,Ar.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ar.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;Ar.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=Kw),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=Yw[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}};Yc.extension={name:"events",type:[Q.RendererSystem,Q.CanvasRendererSystem]},Yc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let zc=Yc;nt.add(zc);function qm(r){return r==="dynamic"||r==="static"}const zw={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??qm(zc.defaultEventMode)},set interactive(r){wt("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??zc.defaultEventMode},set eventMode(r){this._internalInteractive=qm(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 ho))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}};Zt.mixin(zw);const jw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Zt.mixin(jw);const Jw=9,Ha=100,$w=0,Qw=0,tg=2,eg=1,qw=-1e3,tT=-1e3,eT=2;class ig{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,($i.tablet||$i.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ha}px`,e.style.height=`${Ha}px`,e.style.position="absolute",e.style.top=`${$w}px`,e.style.left=`${Qw}px`,e.style.zIndex=tg.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=`${eg}px`,t.style.height=`${eg}px`,t.style.position="absolute",t.style.top=`${qw}px`,t.style.left=`${tT}px`,t.style.zIndex=eT.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($i.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,c=n/a*h;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Qs(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let m=f.hitArea;const p=f.worldTransform;f.hitArea?(u.style.left=`${(p.tx+m.x*p.a)*l}px`,u.style.top=`${(p.ty+m.y*p.d)*c}px`,u.style.width=`${m.width*p.a*l}px`,u.style.height=`${m.height*p.d*c}px`):(m=f.getBounds(),this.capHitArea(m),u.style.left=`${m.x*l}px`,u.style.top=`${m.y*c}px`,u.style.width=`${m.width*l}px`,u.style.height=`${m.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}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=`${Ha}px`,e.style.height=`${Ha}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=tg.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 ho(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===Jw&&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}}ig.extension={name:"accessibility",type:[Q.RendererPlugin,Q.CanvasRendererPlugin]},nt.add(ig);const rg=class Rf{constructor(t){this.stage=new Ct,t=Object.assign({forceCanvas:!1},t),this.renderer=dw(t),Rf._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=Rf._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}};rg._plugins=[];let sg=rg;nt.handleByList(Q.Application,sg._plugins);class ng{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}}ng.extension=Q.Application,nt.add(ng);const og={loader:Q.LoadParser,resolver:Q.ResolveParser,cache:Q.CacheParser,detection:Q.DetectionParser};nt.handle(Q.Asset,r=>{const t=r.ref;Object.entries(og).filter(([e])=>!!t[e]).forEach(([e,i])=>nt.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(og).filter(e=>!!t[e]).forEach(e=>nt.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 sn(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 Rr(r,t){const e=r.split("?")[0],i=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ci=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),jc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function ag(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?ag(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function rT(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)}),ag(r,s,0,e,i)}else i.push(r);return i}const Ka=r=>!Array.isArray(r);class sT{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=ci(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 ot){const a=e;i.forEach(h=>{a.baseTexture!==ot.EMPTY.baseTexture&&xt.addToCache(a.baseTexture,h),ot.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 us=new sT;class nT{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=Ka(t),o=ci(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
867
- ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ci(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=ie.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 ui=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ui||{});const oT=".json",aT="application/json",hT={extension:{type:Q.LoadParser,priority:ui.Low},name:"loadJson",test(r){return sn(r,aT)||Rr(r,oT)},async load(r){return await(await rt.ADAPTER.fetch(r)).json()}};nt.add(hT);const lT=".txt",cT="text/plain",uT={name:"loadTxt",extension:{type:Q.LoadParser,priority:ui.Low},test(r){return sn(r,cT)||Rr(r,lT)},async load(r){return await(await rt.ADAPTER.fetch(r)).text()}};nt.add(uT);const dT=["normal","bold","100","200","300","400","500","600","700","800","900"],fT=[".ttf",".otf",".woff",".woff2"],pT=["font/ttf","font/otf","font/woff","font/woff2"],mT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function gT(r){const t=ie.extname(r),e=ie.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(mT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const yT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function bT(r){return yT.test(r)?r:encodeURI(r)}const xT={extension:{type:Q.LoadParser,priority:ui.Low},name:"loadWebFont",test(r){return sn(r,pT)||Rr(r,fT)},async load(r,t){var i,s,n;const e=rt.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??gT(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>dT.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${bT(r)})`,{...l,weight:u});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=>rt.ADAPTER.getFontFaceSet().delete(t))}};nt.add(xT);let hg=0,Jc;const _T="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",vT={id:"checkImageBitmap",code:`
866
+ `;class Ww extends we{constructor(t=.5,e=Math.random()){super(Zm,Uw,{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 Qm={AlphaFilter:Cw,BlurFilter:Pw,BlurFilterPass:Vc,ColorMatrixFilter:Hc,DisplacementFilter:Dw,FXAAFilter:Bw,NoiseFilter:Ww};Object.entries(Qm).forEach(([r,t])=>{Object.defineProperty(Qm,r,{get(){return wt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class Xw{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||(Te.system.add(this.tickerUpdate,this,us.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Te.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 Ar=new Xw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,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 Ha extends lo{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}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,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class li extends Ha{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 on extends Ha{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}on.DOM_DELTA_PIXEL=0,on.DOM_DELTA_LINE=1,on.DOM_DELTA_PAGE=2;const Zw=2048,Vw=new dt,Kc=new dt;class Hw{constructor(t){this.dispatch=new Kn,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){Ar.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,Vw.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<Zw&&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")&&(Ar.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let u=c.length-1;u>=0;u--){const d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),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")&&(Ar.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,s,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();return(u.length>0||d)&&u.push(t),u}}}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,Kc),!t.hitArea.contains(Kc.x,Kc.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 li)){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 li)){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 c=t.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(t,c,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"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(u)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}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 li)){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 li)){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 li)){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 li)){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 on)){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(li);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(on);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(li);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 li&&e instanceof li&&(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 Ha&&e instanceof Ha&&(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 Kw=1,Yw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Yc=class Af{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Hw(null),Ar.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new li(null),this.rootWheelEvent=new on(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Af.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,Af._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,Ar.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,Ar.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ar.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;Ar.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=Kw),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=Yw[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}};Yc.extension={name:"events",type:[Q.RendererSystem,Q.CanvasRendererSystem]},Yc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let zc=Yc;st.add(zc);function qm(r){return r==="dynamic"||r==="static"}const zw={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??qm(zc.defaultEventMode)},set interactive(r){wt("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??zc.defaultEventMode},set eventMode(r){this._internalInteractive=qm(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 lo))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}};Zt.mixin(zw);const jw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Zt.mixin(jw);const Jw=9,Ka=100,$w=0,Qw=0,tg=2,eg=1,qw=-1e3,tT=-1e3,eT=2;class ig{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,($i.tablet||$i.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ka}px`,e.style.height=`${Ka}px`,e.style.position="absolute",e.style.top=`${$w}px`,e.style.left=`${Qw}px`,e.style.zIndex=tg.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=`${eg}px`,t.style.height=`${eg}px`,t.style.position="absolute",t.style.top=`${qw}px`,t.style.left=`${tT}px`,t.style.zIndex=eT.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($i.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,c=n/a*h;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,en(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*l}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*l}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*l}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*l}px`,u.style.height=`${p.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}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=`${Ka}px`,e.style.height=`${Ka}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=tg.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 lo(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===Jw&&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}}ig.extension={name:"accessibility",type:[Q.RendererPlugin,Q.CanvasRendererPlugin]},st.add(ig);const rg=class Rf{constructor(t){this.stage=new Ct,t=Object.assign({forceCanvas:!1},t),this.renderer=dw(t),Rf._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=Rf._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}};rg._plugins=[];let sg=rg;st.handleByList(Q.Application,sg._plugins);class ng{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}}ng.extension=Q.Application,st.add(ng);const og={loader:Q.LoadParser,resolver:Q.ResolveParser,cache:Q.CacheParser,detection:Q.DetectionParser};st.handle(Q.Asset,r=>{const t=r.ref;Object.entries(og).filter(([e])=>!!t[e]).forEach(([e,i])=>st.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(og).filter(e=>!!t[e]).forEach(e=>st.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 an(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 Rr(r,t){const e=r.split("?")[0],i=re.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ci=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),jc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function ag(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?ag(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function rT(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)}),ag(r,s,0,e,i)}else i.push(r);return i}const Ya=r=>!Array.isArray(r);class sT{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=ci(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 nt){const a=e;i.forEach(h=>{a.baseTexture!==nt.EMPTY.baseTexture&&xt.addToCache(a.baseTexture,h),nt.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 ds=new sT;class nT{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=Ya(t),o=ci(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=re.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
867
+ ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ci(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=re.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 ui=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ui||{});const oT=".json",aT="application/json",hT={extension:{type:Q.LoadParser,priority:ui.Low},name:"loadJson",test(r){return an(r,aT)||Rr(r,oT)},async load(r){return await(await rt.ADAPTER.fetch(r)).json()}};st.add(hT);const lT=".txt",cT="text/plain",uT={name:"loadTxt",extension:{type:Q.LoadParser,priority:ui.Low},test(r){return an(r,cT)||Rr(r,lT)},async load(r){return await(await rt.ADAPTER.fetch(r)).text()}};st.add(uT);const dT=["normal","bold","100","200","300","400","500","600","700","800","900"],fT=[".ttf",".otf",".woff",".woff2"],pT=["font/ttf","font/otf","font/woff","font/woff2"],mT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function gT(r){const t=re.extname(r),e=re.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(mT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const yT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function bT(r){return yT.test(r)?r:encodeURI(r)}const xT={extension:{type:Q.LoadParser,priority:ui.Low},name:"loadWebFont",test(r){return an(r,pT)||Rr(r,fT)},async load(r,t){var i,s,n;const e=rt.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??gT(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>dT.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${bT(r)})`,{...l,weight:u});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=>rt.ADAPTER.getFontFaceSet().delete(t))}};st.add(xT);let hg=0,Jc;const _T="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",vT={id:"checkImageBitmap",code:`
868
868
  async function checkImageBitmap()
869
869
  {
870
870
  try
@@ -919,8 +919,8 @@ ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ci
919
919
  id: event.data.id,
920
920
  });
921
921
  }
922
- };`};let $c;class TT{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([vT.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(){Jc===void 0&&(Jc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Jc&&($c||($c=URL.createObjectURL(new Blob([wT.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker($c),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[hg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:hg++,id:i})}}const lg=new TT;function lo(r,t,e){r.resource.internal=!0;const i=new ot(r),s=()=>{delete t.promiseCache[e],us.has(e)&&us.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 ST=[".jpeg",".jpg",".png",".webp",".avif"],ET=["image/jpeg","image/png","image/webp","image/avif"];async function CT(r){const t=await rt.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 Ya={name:"loadTextures",extension:{type:Q.LoadParser,priority:ui.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return sn(r,ET)||Rr(r,ST)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await lg.isImageBitmapSupported()?s=await lg.loadImageBitmap(r):s=await CT(r):s=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const n={...t.data};n.resolution??(n.resolution=er(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new xt(s,n);return o.resource.src=r,lo(o,e,r)},unload(r){r.destroy(!0)}};nt.add(Ya);const IT=".svg",AT="image/svg+xml",RT={extension:{type:Q.LoadParser,priority:ui.High},name:"loadSVG",test(r){return sn(r,AT)||Rr(r,IT)},async testParse(r){return Xc.test(r)},async parse(r,t,e){var n;const i=new Xc(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new xt(i,{resolution:er(r),...t==null?void 0:t.data});return s.resource.src=t.src,lo(s,e,t.src)},async load(r,t){return(await rt.ADAPTER.fetch(r)).text()},unload:Ya.unload};nt.add(RT);const MT=[".mp4",".m4v",".webm",".ogv"],LT=["video/mp4","video/webm","video/ogg"],PT={name:"loadVideo",extension:{type:Q.LoadParser,priority:ui.High},config:{defaultAutoPlay:!0},test(r){return sn(r,LT)||Rr(r,MT)},async load(r,t,e){var o;let i;const s=await(await rt.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 jm(n,a);await h.load();const l=new xt(h,{alphaMode:await O1(),resolution:er(r),...t==null?void 0:t.data});l.resource.src=r,i=lo(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};nt.add(PT);class GT{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 ci(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"?(wt("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`)},ci(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const m=ci(l||c).map(y=>typeof y=="string"?rT(y):Array.isArray(y)?y:[y]),p=this.getAlias(h);Array.isArray(p)?p.forEach(a):a(p);const g=[];m.forEach(y=>{y.forEach(x=>{let b={};if(typeof x!="object"){b.src=x;for(let v=0;v<this._parsers.length;v++){const T=this._parsers[v];if(T.test(x)){b=T.parse(x);break}}}else u=x.data??u,d=x.format??d,f=x.loadParser??f,b={...b,...x};if(!p)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:p,data:u,format:d,loadParser:f}),g.push(b)})}),p.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Ka(t);t=ci(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=Ka(t);t=ci(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 c=n.filter(u=>u[h]?u[h]===l:!1);c.length&&(n=c)})}),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=ie.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??ie.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class NT{constructor(){this._detections=[],this._initialized=!1,this.resolver=new GT,this.loader=new nT,this.cache=us,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=Ka(t),s=ci(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)},c=o.map(u=>{const d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[u]=f})});return await Promise.all(c),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 us.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=us.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],c=[a.src];a.alias&&c.push(...a.alias),o[s[h]]=l,us.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=ci(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=ci(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=>{us.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 Ya.config.preferWorkers}set preferWorkers(t){wt("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 za=new NT;nt.handleByList(Q.LoadParser,za.loader.parsers).handleByList(Q.ResolveParser,za.resolver.parsers).handleByList(Q.CacheParser,za.cache.parsers).handleByList(Q.DetectionParser,za.detections);const FT={extension:Q.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof ot),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};nt.add(FT);async function cg(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 DT={extension:{type:Q.DetectionParser,priority:1},test:async()=>cg("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};nt.add(DT);const kT={extension:{type:Q.DetectionParser,priority:0},test:async()=>cg("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};nt.add(kT);const ug=["png","jpg","jpeg"],OT={extension:{type:Q.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...ug],remove:async r=>r.filter(t=>!ug.includes(t))};nt.add(OT);const BT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Qc(r){return BT?!1:document.createElement("video").canPlayType(r)!==""}const WT={extension:{type:Q.DetectionParser,priority:0},test:async()=>Qc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};nt.add(WT);const UT={extension:{type:Q.DetectionParser,priority:0},test:async()=>Qc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};nt.add(UT);const XT={extension:{type:Q.DetectionParser,priority:0},test:async()=>Qc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};nt.add(XT);const ZT={extension:Q.ResolveParser,test:Ya.test,parse:r=>{var t;return{resolution:parseFloat(((t=rt.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:ie.extname(r).slice(1),src:r}}};nt.add(ZT);var De=(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))(De||{});const ja={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 sr,nn;function dg(){nn={s3tc:sr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:sr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:sr.getExtension("WEBGL_compressed_texture_etc"),etc1:sr.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:sr.getExtension("WEBGL_compressed_texture_pvrtc")||sr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:sr.getExtension("WEBGL_compressed_texture_atc"),astc:sr.getExtension("WEBGL_compressed_texture_astc")}}const VT={extension:{type:Q.DetectionParser,priority:2},test:async()=>{const r=rt.ADAPTER.createCanvas().getContext("webgl");return r?(sr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{nn||dg();const t=[];for(const e in nn)nn[e]&&t.push(e);return[...t,...r]},remove:async r=>(nn||dg(),r.filter(t=>!(t in nn)))};nt.add(VT);class HT extends Ta{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 yc(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 yc(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class ds extends HT{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=ds._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||ds._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:c}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=ds._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,c=o,u=a,d=c+s-1&~(s-1),f=u+n-1&~(n-1),m=d*f*ja[e];for(let p=0;p<i;p++)h[p]={levelID:p,levelWidth:i>1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,c=c>>1||1,u=u>>1||1,d=c+s-1&~(s-1),f=u+n-1&~(n-1),m=d*f*ja[e];return h}}const qc=4,Ja=124,KT=32,fg=20,YT=542327876,$a={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},zT={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},Qa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},jT=1,JT=2,$T=4,QT=64,qT=512,tS=131072,eS=827611204,iS=861165636,rS=894720068,sS=808540228,nS=4,oS={[eS]:De.COMPRESSED_RGBA_S3TC_DXT1_EXT,[iS]:De.COMPRESSED_RGBA_S3TC_DXT3_EXT,[rS]:De.COMPRESSED_RGBA_S3TC_DXT5_EXT},aS={70:De.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:De.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:De.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:De.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:De.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:De.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:De.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:De.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:De.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function hS(r){const t=new Uint32Array(r);if(t[0]!==YT)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Ja/Uint32Array.BYTES_PER_ELEMENT),i=e[$a.HEIGHT],s=e[$a.WIDTH],n=e[$a.MIPMAP_COUNT],o=new Uint32Array(r,$a.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,KT/Uint32Array.BYTES_PER_ELEMENT),a=o[jT];if(a&$T){const h=o[zT.FOURCC];if(h!==sS){const x=oS[h],b=qc+Ja,v=new Uint8Array(r,b);return[new ds(v,{format:x,width:s,height:i,levels:n})]}const l=qc+Ja,c=new Uint32Array(t.buffer,l,fg/Uint32Array.BYTES_PER_ELEMENT),u=c[Qa.DXGI_FORMAT],d=c[Qa.RESOURCE_DIMENSION],f=c[Qa.MISC_FLAG],m=c[Qa.ARRAY_SIZE],p=aS[u];if(p===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===nS)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=qc+Ja+fg;if(m===1)g.push(new Uint8Array(r,y));else{const x=ja[p];let b=0,v=s,T=i;for(let C=0;C<n;C++){const I=Math.max(1,v+3&-4),R=Math.max(1,T+3&-4),P=I*R*x;b+=P,v=v>>>1,T=T>>>1}let S=y;for(let C=0;C<m;C++)g.push(new Uint8Array(r,S,b)),S+=b}return g.map(x=>new ds(x,{format:p,width:s,height:i,levels:n}))}throw a&QT?new Error("DDSParser does not support uncompressed texture data."):a&qT?new Error("DDSParser does not supported YUV uncompressed texture data."):a&tS?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&JT?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 pg=[171,75,84,88,32,49,49,187,13,10,26,10],lS=67305985,di={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},tu=64,mg={[ct.UNSIGNED_BYTE]:1,[ct.UNSIGNED_SHORT]:2,[ct.INT]:4,[ct.UNSIGNED_INT]:4,[ct.FLOAT]:4,[ct.HALF_FLOAT]:8},cS={[Y.RGBA]:4,[Y.RGB]:3,[Y.RG]:2,[Y.RED]:1,[Y.LUMINANCE]:1,[Y.LUMINANCE_ALPHA]:2,[Y.ALPHA]:1},uS={[ct.UNSIGNED_SHORT_4_4_4_4]:2,[ct.UNSIGNED_SHORT_5_5_5_1]:2,[ct.UNSIGNED_SHORT_5_6_5]:2};function dS(r,t,e=!1){const i=new DataView(t);if(!fS(r,i))return null;const s=i.getUint32(di.ENDIANNESS,!0)===lS,n=i.getUint32(di.GL_TYPE,s),o=i.getUint32(di.GL_FORMAT,s),a=i.getUint32(di.GL_INTERNAL_FORMAT,s),h=i.getUint32(di.PIXEL_WIDTH,s),l=i.getUint32(di.PIXEL_HEIGHT,s)||1,c=i.getUint32(di.PIXEL_DEPTH,s)||1,u=i.getUint32(di.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(di.NUMBER_OF_FACES,s),f=i.getUint32(di.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(di.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const p=4,g=4,y=h+3&-4,x=l+3&-4,b=new Array(u);let v=h*l;n===0&&(v=y*x);let T;if(n!==0?mg[n]?T=mg[n]*cS[o]:T=uS[n]:T=ja[a],T===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=e?mS(i,m,s):null;let C=v*T,I=h,R=l,P=y,N=x,F=tu+m;for(let A=0;A<f;A++){const k=i.getUint32(F,s);let Z=F+4;for(let K=0;K<u;K++){let H=b[K];H||(H=b[K]=new Array(f)),H[A]={levelID:A,levelWidth:f>1||n!==0?I:P,levelHeight:f>1||n!==0?R:N,levelBuffer:new Uint8Array(t,Z,C)},Z+=C}F+=k+4,F=F%4!==0?F+4-F%4:F,I=I>>1||1,R=R>>1||1,P=I+p-1&~(p-1),N=R+g-1&~(g-1),C=P*N*T}return n!==0?{uncompressed:b.map(A=>{let k=A[0].levelBuffer,Z=!1;return n===ct.FLOAT?k=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===ct.UNSIGNED_INT?(Z=!0,k=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===ct.INT&&(Z=!0,k=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new Ta(k,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:Z?pS(o):o}}),kvData:S}:{compressed:b.map(A=>new ds(null,{format:a,width:h,height:l,levels:f,levelBuffers:A})),kvData:S}}function fS(r,t){for(let e=0;e<pg.length;e++)if(t.getUint8(e)!==pg[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function pS(r){switch(r){case Y.RGBA:return Y.RGBA_INTEGER;case Y.RGB:return Y.RGB_INTEGER;case Y.RG:return Y.RG_INTEGER;case Y.RED:return Y.RED_INTEGER;default:return r}}function mS(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(tu+s,e),o=tu+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)),c=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,c),s+=4+n+a}return i}const gS={extension:{type:Q.LoadParser,priority:ui.High},name:"loadDDS",test(r){return Rr(r,".dds")},async load(r,t,e){const i=await(await rt.ADAPTER.fetch(r)).arrayBuffer(),s=hS(i).map(n=>{const o=new xt(n,{mipmap:wi.OFF,alphaMode:Ce.NO_PREMULTIPLIED_ALPHA,resolution:er(r),...t.data});return lo(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};nt.add(gS);const yS={extension:{type:Q.LoadParser,priority:ui.High},name:"loadKTX",test(r){return Rr(r,".ktx")},async load(r,t,e){const i=await(await rt.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=dS(r,i),a=s??n,h={mipmap:wi.OFF,alphaMode:Ce.NO_PREMULTIPLIED_ALPHA,resolution:er(r),...t.data},l=a.map(c=>{a===n&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new xt(u,h);return d.ktxKeyValueData=o,lo(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};nt.add(yS);const bS={extension:Q.ResolveParser,test:r=>{const t=ie.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=ie.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=rt.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=rt.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};nt.add(bS);const qa=new gt,xS=4,gg=class ra{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&&ra._flipY(i,s,n),a&&ra._unpremultiplyAlpha(i);const h=new tv(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&&ra._flipY(i,s,n),a&&ra._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 as?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(qa.width=e.width,qa.height=e.height,e=qa)));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===Y.RGBA,!h){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=qa,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*s),1),u=Math.max(Math.round(e.height*s),1),d=new Uint8Array(xS*c*u);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),c,u,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,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}}}};gg.extension={name:"extract",type:Q.RendererSystem};let _S=gg;nt.add(_S);const th={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===fe.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===fe.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,p=m.width/2,g=m.height/2;e=m.x+p,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(p,g))),s=p-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 c=0,u=h*4+(s?2:0)+2,d=u,f=l;{const m=s+o,p=n,g=e+m,y=e-m,x=i+p;if(t[c++]=g,t[c++]=x,t[--u]=x,t[--u]=y,n){const b=i-p;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=g}}for(let m=1;m<h;m++){const p=Math.PI/2*(m/h),g=s+Math.cos(p)*o,y=n+Math.sin(p)*a,x=e+g,b=e-g,v=i+y,T=i-y;t[c++]=x,t[c++]=v,t[--u]=v,t[--u]=b,t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=x}{const m=s,p=n+a,g=e+m,y=e-m,x=i+p,b=i-p;t[c++]=g,t[c++]=x,t[--f]=b,t[--f]=g,s&&(t[c++]=y,t[c++]=x,t[--f]=b,t[--f]=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!==fe.RREC){const c=r.shape;a=c.x,h=c.y}else{const c=r.shape;a=c.x+c.width/2,h=c.y+c.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 c=2;c<e.length;c+=2)i.push(e[c],e[c+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function yg(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 bg={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){yg(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];yg(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=Mx(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])}}},vS={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)}},wS={build(r){th.build(r)},triangulate(r,t){th.triangulate(r,t)}};var je=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(je||{}),Mr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Mr||{});const on={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 xg{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,c=s-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=h*h+l*l,m=c*c+u*u,p=h*c+l*u,g=n*Math.sqrt(f)/d,y=n*Math.sqrt(m)/d,x=g*p/f,b=y*p/m,v=g*u+y*l,T=g*c+y*h,S=l*(y+x),C=h*(y+x),I=u*(g+b),R=c*(g+b),P=Math.atan2(C-T,S-v),N=Math.atan2(R-T,I-v);return{cx:v+t,cy:T+e,radius:n,startAngle:P,endAngle:N,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=on._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Ea)*40),d=c/(u*2),f=d*2,m=Math.cos(d),p=Math.sin(d),g=u-1,y=g%1/g;for(let x=0;x<=g;++x){const b=x+y*x,v=d+o+f*b,T=Math.cos(v),S=-Math.sin(v);l.push((m*T+p*S)*n+i,(m*-S+p*T)*n+s)}}}class TS{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 eu{static curveLength(t,e,i,s,n,o,a,h){let l=0,c=0,u=0,d=0,f=0,m=0,p=0,g=0,y=0,x=0,b=0,v=t,T=e;for(let S=1;S<=10;++S)c=S/10,u=c*c,d=u*c,f=1-c,m=f*f,p=m*f,g=p*t+3*m*c*i+3*f*u*n+d*a,y=p*e+3*m*c*s+3*f*u*o+d*h,x=v-g,b=T-y,v=g,T=y,l+=Math.sqrt(x*x+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 c=on._segmentsCount(eu.curveLength(h,l,t,e,i,s,n,o));let u=0,d=0,f=0,m=0,p=0;a.push(h,l);for(let g=1,y=0;g<=c;++g)y=g/c,u=1-y,d=u*u,f=d*u,m=y*y,p=m*y,a.push(f*h+3*d*y*t+3*u*m*i+p*n,f*l+3*d*y*e+3*u*m*s+p*o)}}function _g(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,c=r+e*n,u=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const m=h+d,p=l+f,g=c+d,y=u+f;return a.push(m,p,g,y),2}function fs(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(s-r,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,m=Math.abs(f),p=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(p)/Math.PI>>0)+1,y=f/g;if(d+=y,a){o.push(r,t,e,i);for(let x=1,b=d;x<g;x++,b+=y)o.push(r,t,r+Math.sin(b)*p,t+Math.cos(b)*p);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let x=1,b=d;x<g;x++,b+=y)o.push(r+Math.sin(b)*p,t+Math.cos(b)*p,r,t);o.push(s,n,r,t)}return g*2}function SS(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 dt(i[0],i[1]),a=new dt(i[i.length-2],i[i.length-1]),h=e.type!==fe.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 H=(o.x+a.x)*.5,J=(a.y+o.y)*.5;i.unshift(H,J),i.push(H,J)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,m=n.width/2,p=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],x=i[1],b=i[2],v=i[3],T=0,S=0,C=-(x-v),I=y-b,R=0,P=0,N=Math.sqrt(C*C+I*I);C/=N,I/=N,C*=m,I*=m;const F=n.alignment,A=(1-F)*2,k=F*2;h||(n.cap===Mr.ROUND?d+=fs(y-C*(A-k)*.5,x-I*(A-k)*.5,y-C*A,x-I*A,y+C*k,x+I*k,c,!0)+2:n.cap===Mr.SQUARE&&(d+=_g(y,x,C,I,A,k,!0,c))),c.push(y-C*A,x-I*A,y+C*k,x+I*k);for(let H=1;H<u-1;++H){y=i[(H-1)*2],x=i[(H-1)*2+1],b=i[H*2],v=i[H*2+1],T=i[(H+1)*2],S=i[(H+1)*2+1],C=-(x-v),I=y-b,N=Math.sqrt(C*C+I*I),C/=N,I/=N,C*=m,I*=m,R=-(v-S),P=b-T,N=Math.sqrt(R*R+P*P),R/=N,P/=N,R*=m,P*=m;const J=b-y,B=x-v,D=b-T,G=S-v,V=J*D+B*G,tt=B*D-G*J,ft=tt<0;if(Math.abs(tt)<.001*Math.abs(V)){c.push(b-C*A,v-I*A,b+C*k,v+I*k),V>=0&&(n.join===je.ROUND?d+=fs(b,v,b-C*A,v-I*A,b-R*A,v-P*A,c,!1)+4:d+=2,c.push(b-R*k,v-P*k,b+R*A,v+P*A));continue}const at=(-C+y)*(-I+v)-(-C+b)*(-I+x),Tt=(-R+T)*(-P+v)-(-R+b)*(-P+S),It=(J*Tt-D*at)/tt,et=(G*at-B*Tt)/tt,X=(It-b)*(It-b)+(et-v)*(et-v),$=b+(It-b)*A,j=v+(et-v)*A,O=b-(It-b)*k,mt=v-(et-v)*k,yt=Math.min(J*J+B*B,D*D+G*G),Mt=ft?A:k,Nt=yt+Mt*Mt*p,Ee=X<=Nt;let Ze=n.join;if(Ze===je.MITER&&X/p>g&&(Ze=je.BEVEL),Ee)switch(Ze){case je.MITER:{c.push($,j,O,mt);break}case je.BEVEL:{ft?c.push($,j,b+C*k,v+I*k,$,j,b+R*k,v+P*k):c.push(b-C*A,v-I*A,O,mt,b-R*A,v-P*A,O,mt),d+=2;break}case je.ROUND:{ft?(c.push($,j,b+C*k,v+I*k),d+=fs(b,v,b+C*k,v+I*k,b+R*k,v+P*k,c,!0)+4,c.push($,j,b+R*k,v+P*k)):(c.push(b-C*A,v-I*A,O,mt),d+=fs(b,v,b-C*A,v-I*A,b-R*A,v-P*A,c,!1)+4,c.push(b-R*A,v-P*A,O,mt));break}}else{switch(c.push(b-C*A,v-I*A,b+C*k,v+I*k),Ze){case je.MITER:{ft?c.push(O,mt,O,mt):c.push($,j,$,j),d+=2;break}case je.ROUND:{ft?d+=fs(b,v,b+C*k,v+I*k,b+R*k,v+P*k,c,!0)+2:d+=fs(b,v,b-C*A,v-I*A,b-R*A,v-P*A,c,!1)+2;break}}c.push(b-R*A,v-P*A,b+R*k,v+P*k),d+=2}}y=i[(u-2)*2],x=i[(u-2)*2+1],b=i[(u-1)*2],v=i[(u-1)*2+1],C=-(x-v),I=y-b,N=Math.sqrt(C*C+I*I),C/=N,I/=N,C*=m,I*=m,c.push(b-C*A,v-I*A,b+C*k,v+I*k),h||(n.cap===Mr.ROUND?d+=fs(b-C*(A-k)*.5,v-I*(A-k)*.5,b-C*A,v-I*A,b+C*k,v+I*k,c,!1)+2:n.cap===Mr.SQUARE&&(d+=_g(b,v,C,I,A,k,!1,c)));const Z=t.indices,K=on.epsilon*on.epsilon;for(let H=f;H<d+f-2;++H)y=c[H*2],x=c[H*2+1],b=c[(H+1)*2],v=c[(H+1)*2+1],T=c[(H+2)*2],S=c[(H+2)*2+1],!(Math.abs(y*(v-S)+b*(S-x)+T*(x-v))<K)&&Z.push(H,H+1,H+2)}function ES(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==fe.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let c=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(c,c+1),c++;n&&a.push(c,l)}function vg(r,t){r.lineStyle.native?ES(r,t):SS(r,t)}class iu{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,c=2*s-2*e,u=4*(a*a+h*h),d=4*(a*l+h*c),f=l*l+c*c,m=2*Math.sqrt(u+d+f),p=Math.sqrt(u),g=2*u*p,y=2*Math.sqrt(f),x=d/p;return(g*m+p*d*(m-y)+(4*f*u-d*d)*Math.log((2*p+x+m)/(x+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=on._segmentsCount(iu.curveLength(o,a,t,e,i,s));let l=0,c=0;for(let u=1;u<=h;++u){const d=u/h;l=o+(t-o)*d,c=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,c+(e+(s-e)*d-c)*d)}}}const ru={[fe.POLY]:bg,[fe.CIRC]:th,[fe.ELIP]:th,[fe.RECT]:vS,[fe.RREC]:wS},wg=[],eh=[];class ih{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 ih(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 an=new dt,Tg=class qb extends im{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 Za,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(),eh.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),wg.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 ih(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 ih(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,an):an.copyFrom(t),s.shape.contains(an.x,an.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(an.x,an.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],c=l.fillStyle,u=l.lineStyle;ru[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const m=f.texture.baseTexture,p=this.indices.length,g=this.points.length/2;m.wrapMode=vi.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(p,g),i=null),i||(i=wg.pop()||new TS,i.begin(f,p,g),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,g,y,f.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<qb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++xt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),eh.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=eh.pop();s||(s=new Cc,s.texArray=new Pc),s.texArray.count=0,s.start=0,s.size=0,s.type=_i.TRIANGLES;let n=0,o=null,a=0,h=!1,l=_i.TRIANGLES,c=0;this.drawCalls.push(s);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,m=d.style,p=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?_i.LINES:_i.TRIANGLES,o=null,n=f,t++),o!==p&&(o=p,p._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=eh.pop(),s||(s=new Cc,s.texArray=new Pc),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),p.touched=1,p._batchEnabled=t,p._batchLocation=n,p.wrapMode=vi.REPEAT,s.texArray.elements[s.texArray.count++]=p,n++)),s.size+=d.size,c+=d.size,a=p._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}xt._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?bg.triangulate(t,this):ru[t.type].triangulate(t,this)}processLine(t){vg(t,this);for(let e=0;e<t.holes.length;e++)vg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];ru[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=kt.shared.setValue(e).toLittleEndianNumber(),a=kt.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 u=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=f}a++,e.push(u/l.width,d/l.height)}const c=i.baseTexture;(l.width<c.width||l.height<c.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,c=h.height/n.height;let u=h.x/h.width,d=h.y/h.height,f=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let p=i+2;p<a;p+=2)f=Math.min(f,Math.floor(t[p]+o)),m=Math.min(m,Math.floor(t[p+1]+o));u-=f,d-=m;for(let p=i;p<a;p+=2)t[p]=(t[p]+u)*l,t[p+1]=(t[p+1]+d)*c}};Tg.BATCHABLE_SIZE=100;let CS=Tg;class rh{constructor(){this.color=16777215,this.alpha=1,this.texture=ot.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new rh;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=ot.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class su extends rh{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Mr.BUTT,this.join=je.MITER,this.miterLimit=10}clone(){const t=new su;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=Mr.BUTT,this.join=je.MITER,this.miterLimit=10}}const nu={},ou=class El extends Ct{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 rh,this._lineStyle=new su,this._matrix=null,this._holeMode=!1,this.state=Ri.for2d(),this._geometry=t||new CS,this._geometry.refCount++,this._transformID=-1,this._tintColor=new kt(16777215),this.blendMode=pt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new El(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:ot.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Mr.BUTT,join:je.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 es,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new es,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),iu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),eu.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=xg.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(h,l,c,u,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=Ea:o&&s<=n&&(s+=Ea),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-a),d=Math.abs(c[c.length-1]-h);u<l&&d<l||c.push(a,h)}else this.moveTo(a,h),c=this.currentPath.points;return xg.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:ot.WHITE,color:t,alpha:e})}normalizeColor(t){const e=kt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:ot.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 gt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new Ra(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new Ia(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new Aa(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 es(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===fe.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),c={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:kt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=c}}_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,kt.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(!nu[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 Ot,default:hi.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;nu[i]=new Mi(a,o)}e=nu[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,El._TEMP_POINT),this._geometry.containsPoint(El._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=kt.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,c=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const f=l[d],m=l[d+1];c[u++]=i*f+n*m+a,c[u++]=o*m+s*f+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};ou.curves=on,ou._TEMP_POINT=new dt;let hn=ou;class IS{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 au=new dt,Sg=new es,Eg=class tx extends Ct{constructor(t,e,i,s=_i.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ri.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=rt.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===_i.TRIANGLES&&e.length<tx.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,c=s.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=e[d*2],m=e[d*2+1];u[d*2]=n*f+a*m+l,u[d*2+1]=o*f+h*m+c}if(this._roundPixels){const d=rt.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*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 IS(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,au);const e=this.geometry.getBuffer("aVertexPosition").data,i=Sg.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,c=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[c],i[5]=e[c+1],Sg.contains(au.x,au.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}};Eg.BATCHABLE_SIZE=100;let hu=Eg;class Cg extends Cr{constructor(t,e,i){super();const s=new zt(t),n=new zt(e,!0),o=new zt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ct.FLOAT).addAttribute("aTextureCoord",n,2,!1,ct.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var AS=`varying vec2 vTextureCoord;
922
+ };`};let $c;class TT{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([vT.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(){Jc===void 0&&(Jc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Jc&&($c||($c=URL.createObjectURL(new Blob([wT.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker($c),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[hg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:hg++,id:i})}}const lg=new TT;function co(r,t,e){r.resource.internal=!0;const i=new nt(r),s=()=>{delete t.promiseCache[e],ds.has(e)&&ds.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 ST=[".jpeg",".jpg",".png",".webp",".avif"],ET=["image/jpeg","image/png","image/webp","image/avif"];async function CT(r){const t=await rt.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 za={name:"loadTextures",extension:{type:Q.LoadParser,priority:ui.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return an(r,ET)||Rr(r,ST)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await lg.isImageBitmapSupported()?s=await lg.loadImageBitmap(r):s=await CT(r):s=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const n={...t.data};n.resolution??(n.resolution=er(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new xt(s,n);return o.resource.src=r,co(o,e,r)},unload(r){r.destroy(!0)}};st.add(za);const IT=".svg",AT="image/svg+xml",RT={extension:{type:Q.LoadParser,priority:ui.High},name:"loadSVG",test(r){return an(r,AT)||Rr(r,IT)},async testParse(r){return Xc.test(r)},async parse(r,t,e){var n;const i=new Xc(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new xt(i,{resolution:er(r),...t==null?void 0:t.data});return s.resource.src=t.src,co(s,e,t.src)},async load(r,t){return(await rt.ADAPTER.fetch(r)).text()},unload:za.unload};st.add(RT);const MT=[".mp4",".m4v",".webm",".ogv"],LT=["video/mp4","video/webm","video/ogg"],PT={name:"loadVideo",extension:{type:Q.LoadParser,priority:ui.High},config:{defaultAutoPlay:!0},test(r){return an(r,LT)||Rr(r,MT)},async load(r,t,e){var o;let i;const s=await(await rt.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 jm(n,a);await h.load();const l=new xt(h,{alphaMode:await O1(),resolution:er(r),...t==null?void 0:t.data});l.resource.src=r,i=co(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};st.add(PT);class GT{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 ci(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"?(wt("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`)},ci(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=ci(l||c).map(y=>typeof y=="string"?rT(y):Array.isArray(y)?y:[y]),m=this.getAlias(h);Array.isArray(m)?m.forEach(a):a(m);const g=[];p.forEach(y=>{y.forEach(x=>{let b={};if(typeof x!="object"){b.src=x;for(let v=0;v<this._parsers.length;v++){const w=this._parsers[v];if(w.test(x)){b=w.parse(x);break}}}else u=x.data??u,d=x.format??d,f=x.loadParser??f,b={...b,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:m,data:u,format:d,loadParser:f}),g.push(b)})}),m.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Ya(t);t=ci(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=Ya(t);t=ci(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 c=n.filter(u=>u[h]?u[h]===l:!1);c.length&&(n=c)})}),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=re.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??re.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class FT{constructor(){this._detections=[],this._initialized=!1,this.resolver=new GT,this.loader=new nT,this.cache=ds,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=Ya(t),s=ci(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)},c=o.map(u=>{const d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[u]=f})});return await Promise.all(c),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 ds.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=ds.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],c=[a.src];a.alias&&c.push(...a.alias),o[s[h]]=l,ds.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=ci(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=ci(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=>{ds.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 za.config.preferWorkers}set preferWorkers(t){wt("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 ja=new FT;st.handleByList(Q.LoadParser,ja.loader.parsers).handleByList(Q.ResolveParser,ja.resolver.parsers).handleByList(Q.CacheParser,ja.cache.parsers).handleByList(Q.DetectionParser,ja.detections);const NT={extension:Q.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof nt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};st.add(NT);async function cg(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 DT={extension:{type:Q.DetectionParser,priority:1},test:async()=>cg("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};st.add(DT);const kT={extension:{type:Q.DetectionParser,priority:0},test:async()=>cg("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};st.add(kT);const ug=["png","jpg","jpeg"],OT={extension:{type:Q.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...ug],remove:async r=>r.filter(t=>!ug.includes(t))};st.add(OT);const BT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Qc(r){return BT?!1:document.createElement("video").canPlayType(r)!==""}const UT={extension:{type:Q.DetectionParser,priority:0},test:async()=>Qc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};st.add(UT);const WT={extension:{type:Q.DetectionParser,priority:0},test:async()=>Qc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};st.add(WT);const XT={extension:{type:Q.DetectionParser,priority:0},test:async()=>Qc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};st.add(XT);const ZT={extension:Q.ResolveParser,test:za.test,parse:r=>{var t;return{resolution:parseFloat(((t=rt.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:re.extname(r).slice(1),src:r}}};st.add(ZT);var De=(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))(De||{});const Ja={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 sr,hn;function dg(){hn={s3tc:sr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:sr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:sr.getExtension("WEBGL_compressed_texture_etc"),etc1:sr.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:sr.getExtension("WEBGL_compressed_texture_pvrtc")||sr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:sr.getExtension("WEBGL_compressed_texture_atc"),astc:sr.getExtension("WEBGL_compressed_texture_astc")}}const VT={extension:{type:Q.DetectionParser,priority:2},test:async()=>{const r=rt.ADAPTER.createCanvas().getContext("webgl");return r?(sr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{hn||dg();const t=[];for(const e in hn)hn[e]&&t.push(e);return[...t,...r]},remove:async r=>(hn||dg(),r.filter(t=>!(t in hn)))};st.add(VT);class HT extends Sa{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 yc(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 yc(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class fs extends HT{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=fs._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||fs._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:c}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=fs._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,c=o,u=a,d=c+s-1&~(s-1),f=u+n-1&~(n-1),p=d*f*Ja[e];for(let m=0;m<i;m++)h[m]={levelID:m,levelWidth:i>1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,c=c>>1||1,u=u>>1||1,d=c+s-1&~(s-1),f=u+n-1&~(n-1),p=d*f*Ja[e];return h}}const qc=4,$a=124,KT=32,fg=20,YT=542327876,Qa={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},zT={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},qa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},jT=1,JT=2,$T=4,QT=64,qT=512,tS=131072,eS=827611204,iS=861165636,rS=894720068,sS=808540228,nS=4,oS={[eS]:De.COMPRESSED_RGBA_S3TC_DXT1_EXT,[iS]:De.COMPRESSED_RGBA_S3TC_DXT3_EXT,[rS]:De.COMPRESSED_RGBA_S3TC_DXT5_EXT},aS={70:De.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:De.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:De.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:De.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:De.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:De.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:De.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:De.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:De.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function hS(r){const t=new Uint32Array(r);if(t[0]!==YT)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,$a/Uint32Array.BYTES_PER_ELEMENT),i=e[Qa.HEIGHT],s=e[Qa.WIDTH],n=e[Qa.MIPMAP_COUNT],o=new Uint32Array(r,Qa.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,KT/Uint32Array.BYTES_PER_ELEMENT),a=o[jT];if(a&$T){const h=o[zT.FOURCC];if(h!==sS){const x=oS[h],b=qc+$a,v=new Uint8Array(r,b);return[new fs(v,{format:x,width:s,height:i,levels:n})]}const l=qc+$a,c=new Uint32Array(t.buffer,l,fg/Uint32Array.BYTES_PER_ELEMENT),u=c[qa.DXGI_FORMAT],d=c[qa.RESOURCE_DIMENSION],f=c[qa.MISC_FLAG],p=c[qa.ARRAY_SIZE],m=aS[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===nS)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=qc+$a+fg;if(p===1)g.push(new Uint8Array(r,y));else{const x=Ja[m];let b=0,v=s,w=i;for(let C=0;C<n;C++){const I=Math.max(1,v+3&-4),R=Math.max(1,w+3&-4),P=I*R*x;b+=P,v=v>>>1,w=w>>>1}let S=y;for(let C=0;C<p;C++)g.push(new Uint8Array(r,S,b)),S+=b}return g.map(x=>new fs(x,{format:m,width:s,height:i,levels:n}))}throw a&QT?new Error("DDSParser does not support uncompressed texture data."):a&qT?new Error("DDSParser does not supported YUV uncompressed texture data."):a&tS?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&JT?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 pg=[171,75,84,88,32,49,49,187,13,10,26,10],lS=67305985,di={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},tu=64,mg={[lt.UNSIGNED_BYTE]:1,[lt.UNSIGNED_SHORT]:2,[lt.INT]:4,[lt.UNSIGNED_INT]:4,[lt.FLOAT]:4,[lt.HALF_FLOAT]:8},cS={[Y.RGBA]:4,[Y.RGB]:3,[Y.RG]:2,[Y.RED]:1,[Y.LUMINANCE]:1,[Y.LUMINANCE_ALPHA]:2,[Y.ALPHA]:1},uS={[lt.UNSIGNED_SHORT_4_4_4_4]:2,[lt.UNSIGNED_SHORT_5_5_5_1]:2,[lt.UNSIGNED_SHORT_5_6_5]:2};function dS(r,t,e=!1){const i=new DataView(t);if(!fS(r,i))return null;const s=i.getUint32(di.ENDIANNESS,!0)===lS,n=i.getUint32(di.GL_TYPE,s),o=i.getUint32(di.GL_FORMAT,s),a=i.getUint32(di.GL_INTERNAL_FORMAT,s),h=i.getUint32(di.PIXEL_WIDTH,s),l=i.getUint32(di.PIXEL_HEIGHT,s)||1,c=i.getUint32(di.PIXEL_DEPTH,s)||1,u=i.getUint32(di.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(di.NUMBER_OF_FACES,s),f=i.getUint32(di.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(di.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,y=h+3&-4,x=l+3&-4,b=new Array(u);let v=h*l;n===0&&(v=y*x);let w;if(n!==0?mg[n]?w=mg[n]*cS[o]:w=uS[n]:w=Ja[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=e?mS(i,p,s):null;let C=v*w,I=h,R=l,P=y,G=x,N=tu+p;for(let A=0;A<f;A++){const k=i.getUint32(N,s);let V=N+4;for(let K=0;K<u;K++){let H=b[K];H||(H=b[K]=new Array(f)),H[A]={levelID:A,levelWidth:f>1||n!==0?I:P,levelHeight:f>1||n!==0?R:G,levelBuffer:new Uint8Array(t,V,C)},V+=C}N+=k+4,N=N%4!==0?N+4-N%4:N,I=I>>1||1,R=R>>1||1,P=I+m-1&~(m-1),G=R+g-1&~(g-1),C=P*G*w}return n!==0?{uncompressed:b.map(A=>{let k=A[0].levelBuffer,V=!1;return n===lt.FLOAT?k=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===lt.UNSIGNED_INT?(V=!0,k=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===lt.INT&&(V=!0,k=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new Sa(k,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:V?pS(o):o}}),kvData:S}:{compressed:b.map(A=>new fs(null,{format:a,width:h,height:l,levels:f,levelBuffers:A})),kvData:S}}function fS(r,t){for(let e=0;e<pg.length;e++)if(t.getUint8(e)!==pg[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function pS(r){switch(r){case Y.RGBA:return Y.RGBA_INTEGER;case Y.RGB:return Y.RGB_INTEGER;case Y.RG:return Y.RG_INTEGER;case Y.RED:return Y.RED_INTEGER;default:return r}}function mS(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(tu+s,e),o=tu+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)),c=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,c),s+=4+n+a}return i}const gS={extension:{type:Q.LoadParser,priority:ui.High},name:"loadDDS",test(r){return Rr(r,".dds")},async load(r,t,e){const i=await(await rt.ADAPTER.fetch(r)).arrayBuffer(),s=hS(i).map(n=>{const o=new xt(n,{mipmap:wi.OFF,alphaMode:Ce.NO_PREMULTIPLIED_ALPHA,resolution:er(r),...t.data});return co(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};st.add(gS);const yS={extension:{type:Q.LoadParser,priority:ui.High},name:"loadKTX",test(r){return Rr(r,".ktx")},async load(r,t,e){const i=await(await rt.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=dS(r,i),a=s??n,h={mipmap:wi.OFF,alphaMode:Ce.NO_PREMULTIPLIED_ALPHA,resolution:er(r),...t.data},l=a.map(c=>{a===n&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new xt(u,h);return d.ktxKeyValueData=o,co(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};st.add(yS);const bS={extension:Q.ResolveParser,test:r=>{const t=re.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=re.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=rt.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=rt.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};st.add(bS);const th=new mt,xS=4,gg=class sa{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&&sa._flipY(i,s,n),a&&sa._unpremultiplyAlpha(i);const h=new tv(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&&sa._flipY(i,s,n),a&&sa._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 hs?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(th.width=e.width,th.height=e.height,e=th)));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===Y.RGBA,!h){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=th,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*s),1),u=Math.max(Math.round(e.height*s),1),d=new Uint8Array(xS*c*u);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),c,u,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,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}}}};gg.extension={name:"extract",type:Q.RendererSystem};let _S=gg;st.add(_S);const eh={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===fe.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===fe.ELIP){const p=r.shape;e=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,m=p.width/2,g=p.height/2;e=p.x+m,i=p.y+g,o=a=Math.max(0,Math.min(p.radius,Math.min(m,g))),s=m-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 c=0,u=h*4+(s?2:0)+2,d=u,f=l;{const p=s+o,m=n,g=e+p,y=e-p,x=i+m;if(t[c++]=g,t[c++]=x,t[--u]=x,t[--u]=y,n){const b=i-m;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=g}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),g=s+Math.cos(m)*o,y=n+Math.sin(m)*a,x=e+g,b=e-g,v=i+y,w=i-y;t[c++]=x,t[c++]=v,t[--u]=v,t[--u]=b,t[d++]=b,t[d++]=w,t[--f]=w,t[--f]=x}{const p=s,m=n+a,g=e+p,y=e-p,x=i+m,b=i-m;t[c++]=g,t[c++]=x,t[--f]=b,t[--f]=g,s&&(t[c++]=y,t[c++]=x,t[--f]=b,t[--f]=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!==fe.RREC){const c=r.shape;a=c.x,h=c.y}else{const c=r.shape;a=c.x+c.width/2,h=c.y+c.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 c=2;c<e.length;c+=2)i.push(e[c],e[c+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function yg(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 bg={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){yg(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];yg(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=Mx(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])}}},vS={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)}},wS={build(r){eh.build(r)},triangulate(r,t){eh.triangulate(r,t)}};var ze=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ze||{}),Mr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Mr||{});const ln={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 xg{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,c=s-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,g=n*Math.sqrt(f)/d,y=n*Math.sqrt(p)/d,x=g*m/f,b=y*m/p,v=g*u+y*l,w=g*c+y*h,S=l*(y+x),C=h*(y+x),I=u*(g+b),R=c*(g+b),P=Math.atan2(C-w,S-v),G=Math.atan2(R-w,I-v);return{cx:v+t,cy:w+e,radius:n,startAngle:P,endAngle:G,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=ln._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Ca)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=u-1,y=g%1/g;for(let x=0;x<=g;++x){const b=x+y*x,v=d+o+f*b,w=Math.cos(v),S=-Math.sin(v);l.push((p*w+m*S)*n+i,(p*-S+m*w)*n+s)}}}class TS{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 eu{static curveLength(t,e,i,s,n,o,a,h){let l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,y=0,x=0,b=0,v=t,w=e;for(let S=1;S<=10;++S)c=S/10,u=c*c,d=u*c,f=1-c,p=f*f,m=p*f,g=m*t+3*p*c*i+3*f*u*n+d*a,y=m*e+3*p*c*s+3*f*u*o+d*h,x=v-g,b=w-y,v=g,w=y,l+=Math.sqrt(x*x+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 c=ln._segmentsCount(eu.curveLength(h,l,t,e,i,s,n,o));let u=0,d=0,f=0,p=0,m=0;a.push(h,l);for(let g=1,y=0;g<=c;++g)y=g/c,u=1-y,d=u*u,f=d*u,p=y*y,m=p*y,a.push(f*h+3*d*y*t+3*u*p*i+m*n,f*l+3*d*y*e+3*u*p*s+m*o)}}function _g(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,c=r+e*n,u=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const p=h+d,m=l+f,g=c+d,y=u+f;return a.push(p,m,g,y),2}function ps(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(s-r,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,a){o.push(r,t,e,i);for(let x=1,b=d;x<g;x++,b+=y)o.push(r,t,r+Math.sin(b)*m,t+Math.cos(b)*m);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let x=1,b=d;x<g;x++,b+=y)o.push(r+Math.sin(b)*m,t+Math.cos(b)*m,r,t);o.push(s,n,r,t)}return g*2}function SS(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 dt(i[0],i[1]),a=new dt(i[i.length-2],i[i.length-1]),h=e.type!==fe.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 H=(o.x+a.x)*.5,$=(a.y+o.y)*.5;i.unshift(H,$),i.push(H,$)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let y=i[0],x=i[1],b=i[2],v=i[3],w=0,S=0,C=-(x-v),I=y-b,R=0,P=0,G=Math.sqrt(C*C+I*I);C/=G,I/=G,C*=p,I*=p;const N=n.alignment,A=(1-N)*2,k=N*2;h||(n.cap===Mr.ROUND?d+=ps(y-C*(A-k)*.5,x-I*(A-k)*.5,y-C*A,x-I*A,y+C*k,x+I*k,c,!0)+2:n.cap===Mr.SQUARE&&(d+=_g(y,x,C,I,A,k,!0,c))),c.push(y-C*A,x-I*A,y+C*k,x+I*k);for(let H=1;H<u-1;++H){y=i[(H-1)*2],x=i[(H-1)*2+1],b=i[H*2],v=i[H*2+1],w=i[(H+1)*2],S=i[(H+1)*2+1],C=-(x-v),I=y-b,G=Math.sqrt(C*C+I*I),C/=G,I/=G,C*=p,I*=p,R=-(v-S),P=b-w,G=Math.sqrt(R*R+P*P),R/=G,P/=G,R*=p,P*=p;const $=b-y,U=x-v,D=b-w,F=S-v,Z=$*D+U*F,tt=U*D-F*$,ft=tt<0;if(Math.abs(tt)<.001*Math.abs(Z)){c.push(b-C*A,v-I*A,b+C*k,v+I*k),Z>=0&&(n.join===ze.ROUND?d+=ps(b,v,b-C*A,v-I*A,b-R*A,v-P*A,c,!1)+4:d+=2,c.push(b-R*k,v-P*k,b+R*A,v+P*A));continue}const ot=(-C+y)*(-I+v)-(-C+b)*(-I+x),Et=(-R+w)*(-P+v)-(-R+b)*(-P+S),Mt=($*Et-D*ot)/tt,bt=(F*ot-U*Et)/tt,B=(Mt-b)*(Mt-b)+(bt-v)*(bt-v),j=b+(Mt-b)*A,J=v+(bt-v)*A,O=b-(Mt-b)*k,gt=v-(bt-v)*k,ut=Math.min($*$+U*U,D*D+F*F),It=ft?A:k,Dt=ut+It*It*m,Ee=B<=Dt;let ri=n.join;if(ri===ze.MITER&&B/m>g&&(ri=ze.BEVEL),Ee)switch(ri){case ze.MITER:{c.push(j,J,O,gt);break}case ze.BEVEL:{ft?c.push(j,J,b+C*k,v+I*k,j,J,b+R*k,v+P*k):c.push(b-C*A,v-I*A,O,gt,b-R*A,v-P*A,O,gt),d+=2;break}case ze.ROUND:{ft?(c.push(j,J,b+C*k,v+I*k),d+=ps(b,v,b+C*k,v+I*k,b+R*k,v+P*k,c,!0)+4,c.push(j,J,b+R*k,v+P*k)):(c.push(b-C*A,v-I*A,O,gt),d+=ps(b,v,b-C*A,v-I*A,b-R*A,v-P*A,c,!1)+4,c.push(b-R*A,v-P*A,O,gt));break}}else{switch(c.push(b-C*A,v-I*A,b+C*k,v+I*k),ri){case ze.MITER:{ft?c.push(O,gt,O,gt):c.push(j,J,j,J),d+=2;break}case ze.ROUND:{ft?d+=ps(b,v,b+C*k,v+I*k,b+R*k,v+P*k,c,!0)+2:d+=ps(b,v,b-C*A,v-I*A,b-R*A,v-P*A,c,!1)+2;break}}c.push(b-R*A,v-P*A,b+R*k,v+P*k),d+=2}}y=i[(u-2)*2],x=i[(u-2)*2+1],b=i[(u-1)*2],v=i[(u-1)*2+1],C=-(x-v),I=y-b,G=Math.sqrt(C*C+I*I),C/=G,I/=G,C*=p,I*=p,c.push(b-C*A,v-I*A,b+C*k,v+I*k),h||(n.cap===Mr.ROUND?d+=ps(b-C*(A-k)*.5,v-I*(A-k)*.5,b-C*A,v-I*A,b+C*k,v+I*k,c,!1)+2:n.cap===Mr.SQUARE&&(d+=_g(b,v,C,I,A,k,!1,c)));const V=t.indices,K=ln.epsilon*ln.epsilon;for(let H=f;H<d+f-2;++H)y=c[H*2],x=c[H*2+1],b=c[(H+1)*2],v=c[(H+1)*2+1],w=c[(H+2)*2],S=c[(H+2)*2+1],!(Math.abs(y*(v-S)+b*(S-x)+w*(x-v))<K)&&V.push(H,H+1,H+2)}function ES(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==fe.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let c=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(c,c+1),c++;n&&a.push(c,l)}function vg(r,t){r.lineStyle.native?ES(r,t):SS(r,t)}class iu{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,c=2*s-2*e,u=4*(a*a+h*h),d=4*(a*l+h*c),f=l*l+c*c,p=2*Math.sqrt(u+d+f),m=Math.sqrt(u),g=2*u*m,y=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-y)+(4*f*u-d*d)*Math.log((2*m+x+p)/(x+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=ln._segmentsCount(iu.curveLength(o,a,t,e,i,s));let l=0,c=0;for(let u=1;u<=h;++u){const d=u/h;l=o+(t-o)*d,c=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,c+(e+(s-e)*d-c)*d)}}}const ru={[fe.POLY]:bg,[fe.CIRC]:eh,[fe.ELIP]:eh,[fe.RECT]:vS,[fe.RREC]:wS},wg=[],ih=[];class rh{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 rh(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 cn=new dt,Tg=class qb extends im{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 Va,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(),ih.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),wg.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 rh(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 rh(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,cn):cn.copyFrom(t),s.shape.contains(cn.x,cn.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(cn.x,cn.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],c=l.fillStyle,u=l.lineStyle;ru[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=vi.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,g),i=null),i||(i=wg.pop()||new TS,i.begin(f,m,g),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,g,y,f.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<qb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++xt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),ih.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=ih.pop();s||(s=new Cc,s.texArray=new Pc),s.texArray.count=0,s.start=0,s.size=0,s.type=_i.TRIANGLES;let n=0,o=null,a=0,h=!1,l=_i.TRIANGLES,c=0;this.drawCalls.push(s);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,p=d.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,l=h?_i.LINES:_i.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=ih.pop(),s||(s=new Cc,s.texArray=new Pc),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=vi.REPEAT,s.texArray.elements[s.texArray.count++]=m,n++)),s.size+=d.size,c+=d.size,a=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}xt._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?bg.triangulate(t,this):ru[t.type].triangulate(t,this)}processLine(t){vg(t,this);for(let e=0;e<t.holes.length;e++)vg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];ru[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=kt.shared.setValue(e).toLittleEndianNumber(),a=kt.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 u=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=f}a++,e.push(u/l.width,d/l.height)}const c=i.baseTexture;(l.width<c.width||l.height<c.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,c=h.height/n.height;let u=h.x/h.width,d=h.y/h.height,f=Math.floor(t[i]+o),p=Math.floor(t[i+1]+o);for(let m=i+2;m<a;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));u-=f,d-=p;for(let m=i;m<a;m+=2)t[m]=(t[m]+u)*l,t[m+1]=(t[m+1]+d)*c}};Tg.BATCHABLE_SIZE=100;let CS=Tg;class sh{constructor(){this.color=16777215,this.alpha=1,this.texture=nt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new sh;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=nt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class su extends sh{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Mr.BUTT,this.join=ze.MITER,this.miterLimit=10}clone(){const t=new su;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=Mr.BUTT,this.join=ze.MITER,this.miterLimit=10}}const nu={},ou=class El extends Ct{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 sh,this._lineStyle=new su,this._matrix=null,this._holeMode=!1,this.state=Ri.for2d(),this._geometry=t||new CS,this._geometry.refCount++,this._transformID=-1,this._tintColor=new kt(16777215),this.blendMode=pt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new El(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:nt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Mr.BUTT,join:ze.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 is,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new is,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),iu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),eu.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=xg.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(h,l,c,u,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=Ca:o&&s<=n&&(s+=Ca),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-a),d=Math.abs(c[c.length-1]-h);u<l&&d<l||c.push(a,h)}else this.moveTo(a,h),c=this.currentPath.points;return xg.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:nt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=kt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:nt.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 mt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new Ma(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new Aa(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new Ra(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 is(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===fe.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),c={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:kt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=c}}_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,kt.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(!nu[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 Ot,default:hi.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;nu[i]=new Mi(a,o)}e=nu[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,El._TEMP_POINT),this._geometry.containsPoint(El._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=kt.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,c=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];c[u++]=i*f+n*p+a,c[u++]=o*p+s*f+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};ou.curves=ln,ou._TEMP_POINT=new dt;let un=ou;class IS{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 au=new dt,Sg=new is,Eg=class tx extends Ct{constructor(t,e,i,s=_i.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ri.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=rt.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===_i.TRIANGLES&&e.length<tx.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,c=s.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=e[d*2],p=e[d*2+1];u[d*2]=n*f+a*p+l,u[d*2+1]=o*f+h*p+c}if(this._roundPixels){const d=rt.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*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 IS(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,au);const e=this.geometry.getBuffer("aVertexPosition").data,i=Sg.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,c=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[c],i[5]=e[c+1],Sg.contains(au.x,au.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}};Eg.BATCHABLE_SIZE=100;let hu=Eg;class Cg extends Cr{constructor(t,e,i){super();const s=new zt(t),n=new zt(e,!0),o=new zt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,lt.FLOAT).addAttribute("aTextureCoord",n,2,!1,lt.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var AS=`varying vec2 vTextureCoord;
924
924
  uniform vec4 uColor;
925
925
 
926
926
  uniform sampler2D uSampler;
@@ -944,7 +944,7 @@ void main(void)
944
944
 
945
945
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
946
946
  }
947
- `;class lu extends Mi{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Ot.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(i,e.uniforms),super(e.program||rr.from(RS,AS),i),this._colorDirty=!1,this.uvMatrix=new Tm(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new kt(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;kt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class MS extends Cg{constructor(t=200,e,i=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=i,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,h=t[0];const l=this._width*this.textureScale,c=t.length;for(let d=0;d<c;d++){const f=d*4;if(this.textureScale>0){const m=h.x-t[d].x,p=h.y-t[d].y,g=Math.sqrt(m*m+p*p);h=t[d],a+=g/l}else a=d/(c-1);n[f]=a,n[f+1]=0,n[f+2]=a,n[f+3]=1}let u=0;for(let d=0;d<c-1;d++){const f=d*2;o[u++]=f,o[u++]=f+1,o[u++]=f+2,o[u++]=f+2,o[u++]=f+1,o[u++]=f+3}i.update(),s.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,s=0,n=0;const o=this.buffers[0].data,a=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<a;l++){const c=t[l],u=l*4;l<t.length-1?i=t[l+1]:i=c,n=-(i.x-e.x),s=i.y-e.y;const d=Math.sqrt(s*s+n*n);d<1e-6?(s=0,n=0):(s/=d,n/=d,s*=h,n*=h),o[u]=c.x+s,o[u+1]=c.y+n,o[u+2]=c.x-s,o[u+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class LS extends hu{constructor(t,e,i=0){const s=new MS(t.height,e,i),n=new lu(t);i>0&&(t.baseTexture.wrapMode=vi.REPEAT),super(s,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class Ig{constructor(t,e,i){this.geometry=new Cr,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<t.length;++s){let n=t[s];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||ct.FLOAT,offset:n.offset},e[s]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new zt(Q1(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=e,e+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new zt(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=s,s+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new zt(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===ct.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===ct.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(t,e,i){for(let s=0;s<this.dynamicProperties.length;s++){const n=this.dynamicProperties[s];n.uploadFunction(t,e,i,n.type===ct.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let s=0;s<this.staticProperties.length;s++){const n=this.staticProperties[s];n.uploadFunction(t,e,i,n.type===ct.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var PS=`varying vec2 vTextureCoord;
947
+ `;class lu extends Mi{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Ot.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(i,e.uniforms),super(e.program||rr.from(RS,AS),i),this._colorDirty=!1,this.uvMatrix=new Tm(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new kt(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;kt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class MS extends Cg{constructor(t=200,e,i=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=i,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,h=t[0];const l=this._width*this.textureScale,c=t.length;for(let d=0;d<c;d++){const f=d*4;if(this.textureScale>0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],a+=g/l}else a=d/(c-1);n[f]=a,n[f+1]=0,n[f+2]=a,n[f+3]=1}let u=0;for(let d=0;d<c-1;d++){const f=d*2;o[u++]=f,o[u++]=f+1,o[u++]=f+2,o[u++]=f+2,o[u++]=f+1,o[u++]=f+3}i.update(),s.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,s=0,n=0;const o=this.buffers[0].data,a=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<a;l++){const c=t[l],u=l*4;l<t.length-1?i=t[l+1]:i=c,n=-(i.x-e.x),s=i.y-e.y;const d=Math.sqrt(s*s+n*n);d<1e-6?(s=0,n=0):(s/=d,n/=d,s*=h,n*=h),o[u]=c.x+s,o[u+1]=c.y+n,o[u+2]=c.x-s,o[u+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class LS extends hu{constructor(t,e,i=0){const s=new MS(t.height,e,i),n=new lu(t);i>0&&(t.baseTexture.wrapMode=vi.REPEAT),super(s,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class Ig{constructor(t,e,i){this.geometry=new Cr,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<t.length;++s){let n=t[s];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||lt.FLOAT,offset:n.offset},e[s]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new zt(Q1(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=e,e+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new zt(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=s,s+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new zt(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===lt.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===lt.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(t,e,i){for(let s=0;s<this.dynamicProperties.length;s++){const n=this.dynamicProperties[s];n.uploadFunction(t,e,i,n.type===lt.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let s=0;s<this.staticProperties.length;s++){const n=this.staticProperties[s];n.uploadFunction(t,e,i,n.type===lt.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var PS=`varying vec2 vTextureCoord;
948
948
  varying vec4 vColor;
949
949
 
950
950
  uniform sampler2D uSampler;
@@ -977,8 +977,8 @@ void main(void){
977
977
  vTextureCoord = aTextureCoord;
978
978
  vColor = aColor * uColor;
979
979
  }
980
- `;class Ag extends Na{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Ot,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:ct.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Mi.from(GS,PS,{}),this.state=Ri.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=Hp(t.blendMode,l),n.state.set(this.state);const c=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=kt.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 f=0,m=0;f<o;f+=s,m+=1){let p=o-f;p>s&&(p=s),m>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[m];g.uploadDynamic(e,f,p);const y=t._bufferUpdateIDs[m]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,p)),n.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,p*6,c.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 Ig(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Ig(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,h=0,l=0,c=0;for(let u=0;u<i;++u){const d=t[e+u],f=d._texture,m=d.scale.x,p=d.scale.y,g=f.trim,y=f.orig;g?(h=g.x-d.anchor.x*y.width,a=h+g.width,c=g.y-d.anchor.y*y.height,l=c+g.height):(a=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),s[o]=h*m,s[o+1]=c*p,s[o+n]=a*m,s[o+n+1]=c*p,s[o+n*2]=a*m,s[o+n*2+1]=l*p,s[o+n*3]=h*m,s[o+n*3+1]=l*p,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=kt.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}}Ag.extension={name:"particle",type:Q.RendererPlugin},nt.add(Ag);var sh=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(sh||{});const nh={willReadFrequently:!0},Li=class ht{static get experimentalLetterSpacingSupported(){let t=ht._experimentalLetterSpacingSupported;if(t!==void 0){const e=rt.ADAPTER.getCanvasRenderingContext2D().prototype;t=ht._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=ht._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=ht.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",nh);a.font=n;const h=(i?ht.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let m=0;m<h.length;m++){const p=ht._measureText(h[m],e.letterSpacing,a);l[m]=p,c=Math.max(c,p)}let u=c+e.strokeThickness;e.dropShadow&&(u+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let f=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new ht(t,e,u,f,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;ht.experimentalLetterSpacingSupported&&(ht.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+=(ht.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=ht._canvas){const s=i.getContext("2d",nh);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=ht.collapseSpaces(c),d=ht.collapseNewlines(c);let f=!u;const m=e.wordWrapWidth+l,p=ht.tokenize(t);for(let g=0;g<p.length;g++){let y=p[g];if(ht.isNewline(y)){if(!d){a+=ht.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const b=ht.isBreakingSpace(y),v=ht.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const x=ht.getFromCache(y,l,h,s);if(x>m)if(o!==""&&(a+=ht.addLine(o),o="",n=0),ht.canBreakWords(y,e.breakWords)){const b=ht.wordWrapSplit(y);for(let v=0;v<b.length;v++){let T=b[v],S=T,C=1;for(;b[v+C];){const R=b[v+C];if(!ht.canBreakChars(S,R,y,v,e.breakWords))T+=R;else break;S=R,C++}v+=C-1;const I=ht.getFromCache(T,l,h,s);I+n>m&&(a+=ht.addLine(o),f=!1,o="",n=0),o+=T,n+=I}}else{o.length>0&&(a+=ht.addLine(o),o="",n=0);const b=g===p.length-1;a+=ht.addLine(y,!b),f=!1,o="",n=0}else x+n>m&&(f=!1,a+=ht.addLine(o),o="",n=0),(o.length>0||!ht.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return a+=ht.addLine(o,!1),a}static addLine(t,e=!0){return t=ht.trimRight(t),t=e?`${t}
981
- `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=ht._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(!ht.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:ht._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:ht._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(ht.isBreakingSpace(n,o)||ht.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 ht.graphemeSegmenter(t)}static measureFont(t){if(ht._fonts[t])return ht._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=ht._canvas,s=ht._context;s.font=t;const n=ht.METRICS_STRING+ht.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(ht.BASELINE_SYMBOL).width);const h=Math.ceil(ht.HEIGHT_MULTIPLIER*a);if(a=a*ht.BASELINE_MULTIPLIER|0,o===0||h===0)return ht._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,c=l.length,u=o*4;let d=0,f=0,m=!1;for(d=0;d<a;++d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f+=u;else break}for(e.ascent=a-d,f=c-u,m=!1,d=h;d>a;--d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,ht._fonts[t]=e,e}static clearMetrics(t=""){t?delete ht._fonts[t]:ht._fonts={}}static get _canvas(){var t;if(!ht.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",nh))!=null&&t.measureText)return ht.__canvas=i,i;e=rt.ADAPTER.createCanvas()}catch{e=rt.ADAPTER.createCanvas()}e.width=e.height=10,ht.__canvas=e}return ht.__canvas}static get _context(){return ht.__context||(ht.__context=ht._canvas.getContext("2d",nh)),ht.__context}};Li.METRICS_STRING="|ÉqÅ",Li.BASELINE_SYMBOL="M",Li.BASELINE_MULTIPLIER=1.4,Li.HEIGHT_MULTIPLIER=2,Li.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]})(),Li.experimentalLetterSpacing=!1,Li._fonts={},Li._newlines=[10,13],Li._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Lr=Li;const NS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Rg=class sa{constructor(t){this.styleID=0,this.reset(),uu(this,t,t)}clone(){const t={};return uu(t,this,sa.defaultStyle),new sa(t)}reset(){uu(this,sa.defaultStyle,sa.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=cu(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=cu(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){FS(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=cu(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(",")}`}};Rg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:sh.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 Pr=Rg;function cu(r){const t=kt.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 FS(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 uu(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const DS={texture:!0,children:!1,baseTexture:!0},Mg=class Mf extends $t{constructor(t,e,i){let s=!1;i||(i=rt.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=ot.from(i);n.orig=new gt,n.trim=new gt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Mf.defaultResolution??rt.RESOLUTION,this._autoResolution=Mf.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 Lr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){wt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Lr.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=Lr.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,c=s.maxLineWidth,u=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,f;const m=e.dropShadow?2:1;for(let p=0;p<m;++p){const g=e.dropShadow&&p===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,x=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,T=e.dropShadowBlur*this._resolution,S=e.dropShadowDistance*this._resolution;i.shadowColor=kt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=T,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*S,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*S+x}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-u.fontSize)/2;h-u.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*h+u.ascent+b,e.align==="right"?d+=c-l[v]:e.align==="center"&&(d+=(c-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Lr.experimentalLetterSpacingSupported&&(Lr.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=Lr.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let m=u+1;m<h.length;++m)f+=h[m];c=this.context.measureText(f).width,a+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=iv(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,c=s.slice(),u=t.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(c.unshift(s[0]),u.unshift(0),c.push(s[s.length-1]),u.push(1),t.fillGradientType===sh.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const m=i.lineHeight*(f-1)+d,p=i.lineHeight*f;let g=p;f>0&&m>p&&(g=(p+m)/2);const y=p+d,x=i.lineHeight*(f+1);let b=y;f+1<e.length&&x<y&&(b=(y+x)/2);const v=(b-g)/l;for(let T=0;T<c.length;T++){let S=0;typeof u[T]=="number"?S=u[T]:S=T/c.length;let C=Math.min(1,Math.max(0,g/l+S*v));C=Number(C.toFixed(5)),n.addColorStop(C,c[T])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=c.length+1;let f=1;for(let m=0;m<c.length;m++){let p;typeof u[m]=="number"?p=u[m]:p=f/d,n.addColorStop(p,c[m]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},DS,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=Sr(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=Sr(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 Pr?this._style=t:this._style=new Pr(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)}};Mg.defaultAutoResolution=!0;let Lg=Mg;class kS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function OS(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 ot){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function BS(r,t){if(r.baseTexture instanceof xt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function WS(r,t){if(r._texture&&r._texture instanceof ot){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function US(r,t){return t instanceof Lg?(t.updateText(!0),!0):!1}function XS(r,t){if(t instanceof Pr){const e=t.toFontString();return Lr.measureFont(e),!0}return!1}function ZS(r,t){if(r instanceof Lg){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 VS(r,t){return r instanceof Pr?(t.includes(r)||t.push(r),!0):!1}const Pg=class ex{constructor(t){this.limiter=new kS(ex.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(ZS),this.registerFindHook(VS),this.registerFindHook(OS),this.registerFindHook(BS),this.registerFindHook(WS),this.registerUploadHook(US),this.registerUploadHook(XS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Te.system.addOnce(this.tick,this,cs.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)Te.system.addOnce(this.tick,this,cs.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 Ct)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Te.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}};Pg.uploadsPerFrame=4;let du=Pg;Object.defineProperties(rt,{UPLOADS_PER_FRAME:{get(){return du.uploadsPerFrame},set(r){wt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),du.uploadsPerFrame=r}}});function Gg(r,t){return t instanceof xt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function HS(r,t){if(!(t instanceof hn))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&&Gg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function KS(r,t){return r instanceof hn?(t.push(r),!0):!1}class Ng extends du{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(KS),this.registerUploadHook(Gg),this.registerUploadHook(HS)}}Ng.extension={name:"prepare",type:Q.RendererSystem},nt.add(Ng);var YS=`#version 300 es
980
+ `;class Ag extends Na{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Ot,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:lt.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Mi.from(GS,PS,{}),this.state=Ri.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=Hp(t.blendMode,l),n.state.set(this.state);const c=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=kt.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 f=0,p=0;f<o;f+=s,p+=1){let m=o-f;m>s&&(m=s),p>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[p];g.uploadDynamic(e,f,m);const y=t._bufferUpdateIDs[p]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,m*6,c.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 Ig(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Ig(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,h=0,l=0,c=0;for(let u=0;u<i;++u){const d=t[e+u],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,y=f.orig;g?(h=g.x-d.anchor.x*y.width,a=h+g.width,c=g.y-d.anchor.y*y.height,l=c+g.height):(a=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),s[o]=h*p,s[o+1]=c*m,s[o+n]=a*p,s[o+n+1]=c*m,s[o+n*2]=a*p,s[o+n*2+1]=l*m,s[o+n*3]=h*p,s[o+n*3+1]=l*m,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=kt.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}}Ag.extension={name:"particle",type:Q.RendererPlugin},st.add(Ag);var nh=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(nh||{});const oh={willReadFrequently:!0},Li=class at{static get experimentalLetterSpacingSupported(){let t=at._experimentalLetterSpacingSupported;if(t!==void 0){const e=rt.ADAPTER.getCanvasRenderingContext2D().prototype;t=at._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=at._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=at.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",oh);a.font=n;const h=(i?at.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=at._measureText(h[p],e.letterSpacing,a);l[p]=m,c=Math.max(c,m)}let u=c+e.strokeThickness;e.dropShadow&&(u+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let f=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new at(t,e,u,f,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;at.experimentalLetterSpacingSupported&&(at.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+=(at.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=at._canvas){const s=i.getContext("2d",oh);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=at.collapseSpaces(c),d=at.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+l,m=at.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(at.isNewline(y)){if(!d){a+=at.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const b=at.isBreakingSpace(y),v=at.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const x=at.getFromCache(y,l,h,s);if(x>p)if(o!==""&&(a+=at.addLine(o),o="",n=0),at.canBreakWords(y,e.breakWords)){const b=at.wordWrapSplit(y);for(let v=0;v<b.length;v++){let w=b[v],S=w,C=1;for(;b[v+C];){const R=b[v+C];if(!at.canBreakChars(S,R,y,v,e.breakWords))w+=R;else break;S=R,C++}v+=C-1;const I=at.getFromCache(w,l,h,s);I+n>p&&(a+=at.addLine(o),f=!1,o="",n=0),o+=w,n+=I}}else{o.length>0&&(a+=at.addLine(o),o="",n=0);const b=g===m.length-1;a+=at.addLine(y,!b),f=!1,o="",n=0}else x+n>p&&(f=!1,a+=at.addLine(o),o="",n=0),(o.length>0||!at.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return a+=at.addLine(o,!1),a}static addLine(t,e=!0){return t=at.trimRight(t),t=e?`${t}
981
+ `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=at._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(!at.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:at._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:at._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(at.isBreakingSpace(n,o)||at.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 at.graphemeSegmenter(t)}static measureFont(t){if(at._fonts[t])return at._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=at._canvas,s=at._context;s.font=t;const n=at.METRICS_STRING+at.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(at.BASELINE_SYMBOL).width);const h=Math.ceil(at.HEIGHT_MULTIPLIER*a);if(a=a*at.BASELINE_MULTIPLIER|0,o===0||h===0)return at._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,c=l.length,u=o*4;let d=0,f=0,p=!1;for(d=0;d<a;++d){for(let m=0;m<u;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=u;else break}for(e.ascent=a-d,f=c-u,p=!1,d=h;d>a;--d){for(let m=0;m<u;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,at._fonts[t]=e,e}static clearMetrics(t=""){t?delete at._fonts[t]:at._fonts={}}static get _canvas(){var t;if(!at.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",oh))!=null&&t.measureText)return at.__canvas=i,i;e=rt.ADAPTER.createCanvas()}catch{e=rt.ADAPTER.createCanvas()}e.width=e.height=10,at.__canvas=e}return at.__canvas}static get _context(){return at.__context||(at.__context=at._canvas.getContext("2d",oh)),at.__context}};Li.METRICS_STRING="|ÉqÅ",Li.BASELINE_SYMBOL="M",Li.BASELINE_MULTIPLIER=1.4,Li.HEIGHT_MULTIPLIER=2,Li.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]})(),Li.experimentalLetterSpacing=!1,Li._fonts={},Li._newlines=[10,13],Li._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Lr=Li;const FS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Rg=class na{constructor(t){this.styleID=0,this.reset(),uu(this,t,t)}clone(){const t={};return uu(t,this,na.defaultStyle),new na(t)}reset(){uu(this,na.defaultStyle,na.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=cu(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=cu(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){NS(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=cu(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)&&!FS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Rg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:nh.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 Pr=Rg;function cu(r){const t=kt.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 NS(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 uu(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const DS={texture:!0,children:!1,baseTexture:!0},Mg=class Mf extends $t{constructor(t,e,i){let s=!1;i||(i=rt.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=nt.from(i);n.orig=new mt,n.trim=new mt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Mf.defaultResolution??rt.RESOLUTION,this._autoResolution=Mf.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 Lr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){wt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Lr.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=Lr.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,c=s.maxLineWidth,u=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,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,x=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,w=e.dropShadowBlur*this._resolution,S=e.dropShadowDistance*this._resolution;i.shadowColor=kt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*S,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*S+x}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-u.fontSize)/2;h-u.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*h+u.ascent+b,e.align==="right"?d+=c-l[v]:e.align==="center"&&(d+=(c-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Lr.experimentalLetterSpacingSupported&&(Lr.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=Lr.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let p=u+1;p<h.length;++p)f+=h[p];c=this.context.measureText(f).width,a+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=iv(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,c=s.slice(),u=t.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(c.unshift(s[0]),u.unshift(0),c.push(s[s.length-1]),u.push(1),t.fillGradientType===nh.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=i.lineHeight*(f-1)+d,m=i.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const y=m+d,x=i.lineHeight*(f+1);let b=y;f+1<e.length&&x<y&&(b=(y+x)/2);const v=(b-g)/l;for(let w=0;w<c.length;w++){let S=0;typeof u[w]=="number"?S=u[w]:S=w/c.length;let C=Math.min(1,Math.max(0,g/l+S*v));C=Number(C.toFixed(5)),n.addColorStop(C,c[w])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=c.length+1;let f=1;for(let p=0;p<c.length;p++){let m;typeof u[p]=="number"?m=u[p]:m=f/d,n.addColorStop(m,c[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},DS,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=Sr(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=Sr(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 Pr?this._style=t:this._style=new Pr(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)}};Mg.defaultAutoResolution=!0;let Lg=Mg;class kS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function OS(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 nt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function BS(r,t){if(r.baseTexture instanceof xt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function US(r,t){if(r._texture&&r._texture instanceof nt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function WS(r,t){return t instanceof Lg?(t.updateText(!0),!0):!1}function XS(r,t){if(t instanceof Pr){const e=t.toFontString();return Lr.measureFont(e),!0}return!1}function ZS(r,t){if(r instanceof Lg){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 VS(r,t){return r instanceof Pr?(t.includes(r)||t.push(r),!0):!1}const Pg=class ex{constructor(t){this.limiter=new kS(ex.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(ZS),this.registerFindHook(VS),this.registerFindHook(OS),this.registerFindHook(BS),this.registerFindHook(US),this.registerUploadHook(WS),this.registerUploadHook(XS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Te.system.addOnce(this.tick,this,us.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)Te.system.addOnce(this.tick,this,us.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 Ct)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Te.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}};Pg.uploadsPerFrame=4;let du=Pg;Object.defineProperties(rt,{UPLOADS_PER_FRAME:{get(){return du.uploadsPerFrame},set(r){wt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),du.uploadsPerFrame=r}}});function Gg(r,t){return t instanceof xt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function HS(r,t){if(!(t instanceof un))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&&Gg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function KS(r,t){return r instanceof un?(t.push(r),!0):!1}class Fg extends du{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(KS),this.registerUploadHook(Gg),this.registerUploadHook(HS)}}Fg.extension={name:"prepare",type:Q.RendererSystem},st.add(Fg);var YS=`#version 300 es
982
982
  #define SHADER_NAME Tiling-Sprite-100
983
983
 
984
984
  precision lowp float;
@@ -1057,7 +1057,7 @@ void main(void)
1057
1057
 
1058
1058
  gl_FragColor = texSample * uColor;
1059
1059
  }
1060
- `,Fg=`#version 100
1060
+ `,Ng=`#version 100
1061
1061
  #define SHADER_NAME Tiling-Sprite-100
1062
1062
 
1063
1063
  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 oh=new Ot;class Dg extends Na{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new bm,this.state=Ri.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Mi.from(Fg,JS,e),this.shader=t.context.webGLVersion>1?Mi.from(zS,YS,e):Mi.from(Fg,jS,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,c=t.tileTransform.localTransform,u=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!==vi.CLAMP:h.wrapMode===vi.CLAMP&&(h.wrapMode=vi.REPEAT));const f=d?this.simpleShader:this.shader,m=a.width,p=a.height,g=t._width,y=t._height;oh.set(c.a*m/g,c.b*m/y,c.c*p/g,c.d*p/y,c.tx/g,c.ty/y),oh.invert(),d?oh.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=oh.toArray(!0),f.uniforms.uColor=kt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=Hp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Dg.extension={name:"tilingSprite",type:Q.RendererPlugin},nt.add(Dg);const kg=class na{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof ot?t:null,this.baseTexture=t instanceof xt?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=er(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<=na.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=na.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,c=new gt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new gt(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 gt(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 gt(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 ot(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),ot.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*na.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*na.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=[]}};kg.BATCH_SIZE=1e3;let Og=kg;const $S=["jpg","png","jpeg","avif","webp"];function Bg(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=ie.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Bg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const QS={extension:Q.Asset,cache:{test:r=>r instanceof Og,getCacheableAssets:(r,t)=>Bg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&$S.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=rt.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:Q.LoadParser,priority:ui.Normal},async testParse(r,t){return ie.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=ie.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=jc(s,t.src);const n=(await e.load([s]))[s],o=new Og(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 c=[];for(const d of a){if(typeof d!="string")continue;let f=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(f=jc(f,t.src),c.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};nt.add(QS);class ah{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class hh{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 c=a[l].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f;h[u]=m}i[o].push(h)}const s=new ah;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 fu{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 ah,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 c=o[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.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 pu{static test(t){return typeof t=="string"&&t.includes("<font>")?fu.test(rt.ADAPTER.parseXML(t)):!1}static parse(t){return fu.parse(rt.ADAPTER.parseXML(t))}}const mu=[hh,fu,pu];function qS(r){for(let t=0;t<mu.length;t++)if(mu[t].test(r))return mu[t];return null}function tE(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,c=r.width/i-h-l*2,u=r.height/i-h-l*2,d=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const m=d.length+1;for(let p=1;p<m;++p)f.push(p/m)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===sh.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,l,c/2,u+l);let m=0;const p=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let x=0;x<d.length;x++){let b=0;typeof f[x]=="number"?b=f[x]:b=x/d.length;const v=y/u+b*p;let T=Math.max(m,v);T=Math.min(T,1),a.addColorStop(T,d[x]),m=T}}}else{a=t.createLinearGradient(l,u/2,c+l,u/2);const m=d.length+1;let p=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=p/m,a.addColorStop(y,d[g]),p++}}return a}function eE(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,c=-(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=tE(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*n,f=o.dropShadowDistance*n;t.shadowColor=kt.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,c+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,c+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function lh(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Wg(r){return Array.from?Array.from(r):r.split("")}function iE(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(...Wg(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Gr=class Yi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=er(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 u=0;u<t.page.length;u++){const{id:d,file:f}=t.page[u];l[d]=e instanceof Array?e[u]:e[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Ce.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=wi.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:m,y:p,width:g,height:y,xoffset:x,yoffset:b,xadvance:v}=t.char[u];m/=h,p/=h,g/=h,y/=h,x/=h,b/=h,v/=h;const T=new gt(m+l[f].frame.x/h,p+l[f].frame.y/h,g,y);this.chars[d]={xOffset:x,yOffset:b,xAdvance:v,kerning:{},texture:new ot(l[f].baseTexture,T),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:m}=t.kerning[u];d/=h,f/=h,m/=h,this.chars[f]&&(this.chars[f].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.fieldType)==null?void 0:c.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 ah)s=t;else{const o=qS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof ot&&(e=[e]);const n=new Yi(s,e,i);return Yi.available[n.font]=n,n}static uninstall(t){const e=Yi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Yi.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({},Yi.defaultOptions,i),c=iE(s),u=e instanceof Pr?e:new Pr(e),d=a,f=new ah;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let m=0,p=0,g,y,x,b=0;const v=[];for(let S=0;S<c.length;S++){g||(g=rt.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),x=new xt(g,{resolution:o,...l}),v.push(new ot(x)),f.page.push({id:v.length-1,file:""}));const C=c[S],I=Lr.measureText(C,u,!1,g),R=I.width,P=Math.ceil(I.height),N=Math.ceil((u.fontStyle==="italic"?2:1)*R);if(p>=h-P*o){if(p===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,g=null,y=null,x=null,p=0,m=0,b=0;continue}if(b=Math.max(P+I.fontProperties.descent,b),N*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,p+=b*o,p=Math.ceil(p),m=0,b=0;continue}eE(g,y,I,m,p,o,u);const F=lh(I.text);f.char.push({id:F,page:v.length-1,x:m/o,y:p/o,width:N,height:P,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(N+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let S=0,C=c.length;S<C;S++){const I=c[S];for(let R=0;R<C;R++){const P=c[R],N=y.measureText(I).width,F=y.measureText(P).width,A=y.measureText(I+P).width-(N+F);A&&f.kerning.push({first:lh(I),second:lh(P),amount:A})}}const T=new Yi(f,v,!0);return Yi.available[t]!==void 0&&Yi.uninstall(t),Yi.available[t]=T,T}};Gr.ALPHA=[["a","z"],["A","Z"]," "],Gr.NUMERIC=[["0","9"]],Gr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Gr.ASCII=[[" ","~"]],Gr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Gr.ALPHANUMERIC},Gr.available={};let fi=Gr;var rE=`// Pixi texture info\r
1095
+ `;const ah=new Ot;class Dg extends Na{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new bm,this.state=Ri.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Mi.from(Ng,JS,e),this.shader=t.context.webGLVersion>1?Mi.from(zS,YS,e):Mi.from(Ng,jS,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,c=t.tileTransform.localTransform,u=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!==vi.CLAMP:h.wrapMode===vi.CLAMP&&(h.wrapMode=vi.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,y=t._height;ah.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),ah.invert(),d?ah.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=ah.toArray(!0),f.uniforms.uColor=kt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=Hp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Dg.extension={name:"tilingSprite",type:Q.RendererPlugin},st.add(Dg);const kg=class oa{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof nt?t:null,this.baseTexture=t instanceof xt?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=er(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<=oa.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=oa.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,c=new mt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new mt(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 mt(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 mt(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 nt(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),nt.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*oa.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*oa.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=[]}};kg.BATCH_SIZE=1e3;let Og=kg;const $S=["jpg","png","jpeg","avif","webp"];function Bg(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=re.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Bg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const QS={extension:Q.Asset,cache:{test:r=>r instanceof Og,getCacheableAssets:(r,t)=>Bg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&$S.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=rt.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:Q.LoadParser,priority:ui.Normal},async testParse(r,t){return re.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=re.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=jc(s,t.src);const n=(await e.load([s]))[s],o=new Og(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 c=[];for(const d of a){if(typeof d!="string")continue;let f=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(f=jc(f,t.src),c.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};st.add(QS);class hh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class lh{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 c=a[l].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[u]=p}i[o].push(h)}const s=new hh;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 fu{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 hh,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 c=o[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.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 pu{static test(t){return typeof t=="string"&&t.includes("<font>")?fu.test(rt.ADAPTER.parseXML(t)):!1}static parse(t){return fu.parse(rt.ADAPTER.parseXML(t))}}const mu=[lh,fu,pu];function qS(r){for(let t=0;t<mu.length;t++)if(mu[t].test(r))return mu[t];return null}function tE(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,c=r.width/i-h-l*2,u=r.height/i-h-l*2,d=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===nh.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,l,c/2,u+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let x=0;x<d.length;x++){let b=0;typeof f[x]=="number"?b=f[x]:b=x/d.length;const v=y/u+b*m;let w=Math.max(p,v);w=Math.min(w,1),a.addColorStop(w,d[x]),p=w}}}else{a=t.createLinearGradient(l,u/2,c+l,u/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=m/p,a.addColorStop(y,d[g]),m++}}return a}function eE(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,c=-(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=tE(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*n,f=o.dropShadowDistance*n;t.shadowColor=kt.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,c+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,c+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function ch(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Ug(r){return Array.from?Array.from(r):r.split("")}function iE(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(...Ug(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Gr=class Yi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=er(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 u=0;u<t.page.length;u++){const{id:d,file:f}=t.page[u];l[d]=e instanceof Array?e[u]:e[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Ce.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=wi.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:p,y:m,width:g,height:y,xoffset:x,yoffset:b,xadvance:v}=t.char[u];p/=h,m/=h,g/=h,y/=h,x/=h,b/=h,v/=h;const w=new mt(p+l[f].frame.x/h,m+l[f].frame.y/h,g,y);this.chars[d]={xOffset:x,yOffset:b,xAdvance:v,kerning:{},texture:new nt(l[f].baseTexture,w),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:p}=t.kerning[u];d/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.fieldType)==null?void 0:c.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 hh)s=t;else{const o=qS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof nt&&(e=[e]);const n=new Yi(s,e,i);return Yi.available[n.font]=n,n}static uninstall(t){const e=Yi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Yi.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({},Yi.defaultOptions,i),c=iE(s),u=e instanceof Pr?e:new Pr(e),d=a,f=new hh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,g,y,x,b=0;const v=[];for(let S=0;S<c.length;S++){g||(g=rt.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),x=new xt(g,{resolution:o,...l}),v.push(new nt(x)),f.page.push({id:v.length-1,file:""}));const C=c[S],I=Lr.measureText(C,u,!1,g),R=I.width,P=Math.ceil(I.height),G=Math.ceil((u.fontStyle==="italic"?2:1)*R);if(m>=h-P*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,g=null,y=null,x=null,m=0,p=0,b=0;continue}if(b=Math.max(P+I.fontProperties.descent,b),G*o+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,m+=b*o,m=Math.ceil(m),p=0,b=0;continue}eE(g,y,I,p,m,o,u);const N=ch(I.text);f.char.push({id:N,page:v.length-1,x:p/o,y:m/o,width:G,height:P,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(G+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let S=0,C=c.length;S<C;S++){const I=c[S];for(let R=0;R<C;R++){const P=c[R],G=y.measureText(I).width,N=y.measureText(P).width,A=y.measureText(I+P).width-(G+N);A&&f.kerning.push({first:ch(I),second:ch(P),amount:A})}}const w=new Yi(f,v,!0);return Yi.available[t]!==void 0&&Yi.uninstall(t),Yi.available[t]=w,w}};Gr.ALPHA=[["a","z"],["A","Z"]," "],Gr.NUMERIC=[["0","9"]],Gr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Gr.ASCII=[[" ","~"]],Gr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Gr.ALPHANUMERIC},Gr.available={};let fi=Gr;var rE=`// Pixi texture info\r
1096
1096
  varying vec2 vTextureCoord;\r
1097
1097
  uniform sampler2D uSampler;\r
1098
1098
  \r
@@ -1146,17 +1146,17 @@ void main(void)\r
1146
1146
  \r
1147
1147
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
1148
1148
  }\r
1149
- `;const Ug=[],Xg=[],Zg=[],Vg=class ix extends Ct{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},ix.styleDefaults,e);if(!fi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new kt(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 ir(()=>{this.dirty=!0},this,0,0),this._roundPixels=rt.ROUND_PIXELS,this.dirty=!0,this._resolution=rt.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var N;const t=fi.available[this._fontName],e=this.fontSize,i=e/t.size,s=new dt,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1150
- `)||" ",l=Wg(h),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?Ug:Xg;let d=null,f=0,m=0,p=0,g=-1,y=0,x=0,b=0,v=0;for(let F=0;F<l.length;F++){const A=l[F],k=lh(A);if(/(?:\s)/.test(A)&&(g=F,y=f,v++),A==="\r"||A===`
1151
- `){o.push(f),a.push(-1),m=Math.max(m,f),++p,++x,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const Z=t.chars[k];if(!Z)continue;d&&Z.kerning[d]&&(s.x+=Z.kerning[d]);const K=Zg.pop()||{texture:ot.EMPTY,line:0,charCode:0,prevSpaces:0,position:new dt};K.texture=Z.texture,K.line=p,K.charCode=k,K.position.x=Math.round(s.x+Z.xOffset+this._letterSpacing/2),K.position.y=Math.round(s.y+Z.yOffset),K.prevSpaces=v,n.push(K),f=K.position.x+Math.max(Z.xAdvance-Z.xOffset,Z.texture.orig.width),s.x+=Z.xAdvance+this._letterSpacing,b=Math.max(b,Z.yOffset+Z.texture.height),d=k,g!==-1&&c>0&&s.x>c&&(++x,Qs(n,1+g-x,1+F-g),F=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),m=Math.max(m,y),p++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const T=l[l.length-1];T!=="\r"&&T!==`
1152
- `&&(/(?:\s)/.test(T)&&(f=y),o.push(f),m=Math.max(m,f),a.push(-1));const S=[];for(let F=0;F<=p;F++){let A=0;this._align==="right"?A=m-o[F]:this._align==="center"?A=(m-o[F])/2:this._align==="justify"&&(A=a[F]<0?0:(m-o[F])/a[F]),S.push(A)}const C=n.length,I={},R=[],P=this._activePagesMeshData;u.push(...P);for(let F=0;F<C;F++){const A=n[F].texture,k=A.baseTexture.uid;if(!I[k]){let Z=u.pop();if(!Z){const H=new Cg;let J,B;t.distanceFieldType==="none"?(J=new lu(ot.EMPTY),B=pt.NORMAL):(J=new lu(ot.EMPTY,{program:rr.from(sE,rE),uniforms:{uFWidth:0}}),B=pt.NORMAL_NPM);const D=new hu(H,J);D.blendMode=B,Z={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:D,vertices:null,uvs:null,indices:null}}Z.index=0,Z.indexCount=0,Z.vertexCount=0,Z.uvsCount=0,Z.total=0;const{_textureCache:K}=this;K[k]=K[k]||new ot(A.baseTexture),Z.mesh.texture=K[k],Z.mesh.tint=this._tintColor.value,R.push(Z),I[k]=Z}I[k].total++}for(let F=0;F<P.length;F++)R.includes(P[F])||this.removeChild(P[F].mesh);for(let F=0;F<R.length;F++)R[F].mesh.parent!==this&&this.addChild(R[F].mesh);this._activePagesMeshData=R;for(const F in I){const A=I[F],k=A.total;if(!(((N=A.indices)==null?void 0:N.length)>6*k)||A.vertices.length<hu.BATCHABLE_SIZE*2)A.vertices=new Float32Array(4*2*k),A.uvs=new Float32Array(4*2*k),A.indices=new Uint16Array(6*k);else{const Z=A.total,K=A.vertices;for(let H=Z*4*2;H<K.length;H++)K[H]=0}A.mesh.size=6*k}for(let F=0;F<C;F++){const A=n[F];let k=A.position.x+S[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(k=Math.round(k));const Z=k*i,K=A.position.y*i,H=A.texture,J=I[H.baseTexture.uid],B=H.frame,D=H._uvs,G=J.index++;J.indices[G*6+0]=0+G*4,J.indices[G*6+1]=1+G*4,J.indices[G*6+2]=2+G*4,J.indices[G*6+3]=0+G*4,J.indices[G*6+4]=2+G*4,J.indices[G*6+5]=3+G*4,J.vertices[G*8+0]=Z,J.vertices[G*8+1]=K,J.vertices[G*8+2]=Z+B.width*i,J.vertices[G*8+3]=K,J.vertices[G*8+4]=Z+B.width*i,J.vertices[G*8+5]=K+B.height*i,J.vertices[G*8+6]=Z,J.vertices[G*8+7]=K+B.height*i,J.uvs[G*8+0]=D.x0,J.uvs[G*8+1]=D.y0,J.uvs[G*8+2]=D.x1,J.uvs[G*8+3]=D.y1,J.uvs[G*8+4]=D.x2,J.uvs[G*8+5]=D.y2,J.uvs[G*8+6]=D.x3,J.uvs[G*8+7]=D.y3}this._textWidth=m*i,this._textHeight=(s.y+t.lineHeight)*i;for(const F in I){const A=I[F];if(this.anchor.x!==0||this.anchor.y!==0){let H=0;const J=this._textWidth*this.anchor.x,B=this._textHeight*this.anchor.y;for(let D=0;D<A.total;D++)A.vertices[H++]-=J,A.vertices[H++]-=B,A.vertices[H++]-=J,A.vertices[H++]-=B,A.vertices[H++]-=J,A.vertices[H++]-=B,A.vertices[H++]-=J,A.vertices[H++]-=B}this._maxLineHeight=b*i;const k=A.mesh.geometry.getBuffer("aVertexPosition"),Z=A.mesh.geometry.getBuffer("aTextureCoord"),K=A.mesh.geometry.getIndex();k.data=A.vertices,Z.data=A.uvs,K.data=A.indices,k.update(),Z.update(),K.update()}for(let F=0;F<n.length;F++)Zg.push(n[F]);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}=fi.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=this.fontSize/s,f=t._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=u*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=fi.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(!fi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??fi.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=fi.available[this._fontName].distanceFieldType==="none"?Ug:Xg;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=ot.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Vg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let nE=Vg;const oE=[".xml",".fnt"],aE={extension:{type:Q.LoadParser,priority:ui.Normal},name:"loadBitmapFont",test(r){return oE.includes(ie.extname(r).toLowerCase())},async testParse(r){return hh.test(r)||pu.test(r)},async parse(r,t,e){const i=hh.test(r)?hh.parse(r):pu.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=ie.join(ie.dirname(s),c);u=jc(u,s),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return fi.install(i,h,!0)},async load(r,t){return(await rt.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};nt.add(aE);const gu=class Zn extends Pr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Zn(Object.keys(Zn.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 Zn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Zn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return rt.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:ie.basename(t,ie.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 Wg=[],Xg=[],Zg=[],Vg=class ix extends Ct{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},ix.styleDefaults,e);if(!fi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new kt(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 ir(()=>{this.dirty=!0},this,0,0),this._roundPixels=rt.ROUND_PIXELS,this.dirty=!0,this._resolution=rt.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var G;const t=fi.available[this._fontName],e=this.fontSize,i=e/t.size,s=new dt,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1150
+ `)||" ",l=Ug(h),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?Wg:Xg;let d=null,f=0,p=0,m=0,g=-1,y=0,x=0,b=0,v=0;for(let N=0;N<l.length;N++){const A=l[N],k=ch(A);if(/(?:\s)/.test(A)&&(g=N,y=f,v++),A==="\r"||A===`
1151
+ `){o.push(f),a.push(-1),p=Math.max(p,f),++m,++x,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const V=t.chars[k];if(!V)continue;d&&V.kerning[d]&&(s.x+=V.kerning[d]);const K=Zg.pop()||{texture:nt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new dt};K.texture=V.texture,K.line=m,K.charCode=k,K.position.x=Math.round(s.x+V.xOffset+this._letterSpacing/2),K.position.y=Math.round(s.y+V.yOffset),K.prevSpaces=v,n.push(K),f=K.position.x+Math.max(V.xAdvance-V.xOffset,V.texture.orig.width),s.x+=V.xAdvance+this._letterSpacing,b=Math.max(b,V.yOffset+V.texture.height),d=k,g!==-1&&c>0&&s.x>c&&(++x,en(n,1+g-x,1+N-g),N=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,y),m++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const w=l[l.length-1];w!=="\r"&&w!==`
1152
+ `&&(/(?:\s)/.test(w)&&(f=y),o.push(f),p=Math.max(p,f),a.push(-1));const S=[];for(let N=0;N<=m;N++){let A=0;this._align==="right"?A=p-o[N]:this._align==="center"?A=(p-o[N])/2:this._align==="justify"&&(A=a[N]<0?0:(p-o[N])/a[N]),S.push(A)}const C=n.length,I={},R=[],P=this._activePagesMeshData;u.push(...P);for(let N=0;N<C;N++){const A=n[N].texture,k=A.baseTexture.uid;if(!I[k]){let V=u.pop();if(!V){const H=new Cg;let $,U;t.distanceFieldType==="none"?($=new lu(nt.EMPTY),U=pt.NORMAL):($=new lu(nt.EMPTY,{program:rr.from(sE,rE),uniforms:{uFWidth:0}}),U=pt.NORMAL_NPM);const D=new hu(H,$);D.blendMode=U,V={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:D,vertices:null,uvs:null,indices:null}}V.index=0,V.indexCount=0,V.vertexCount=0,V.uvsCount=0,V.total=0;const{_textureCache:K}=this;K[k]=K[k]||new nt(A.baseTexture),V.mesh.texture=K[k],V.mesh.tint=this._tintColor.value,R.push(V),I[k]=V}I[k].total++}for(let N=0;N<P.length;N++)R.includes(P[N])||this.removeChild(P[N].mesh);for(let N=0;N<R.length;N++)R[N].mesh.parent!==this&&this.addChild(R[N].mesh);this._activePagesMeshData=R;for(const N in I){const A=I[N],k=A.total;if(!(((G=A.indices)==null?void 0:G.length)>6*k)||A.vertices.length<hu.BATCHABLE_SIZE*2)A.vertices=new Float32Array(4*2*k),A.uvs=new Float32Array(4*2*k),A.indices=new Uint16Array(6*k);else{const V=A.total,K=A.vertices;for(let H=V*4*2;H<K.length;H++)K[H]=0}A.mesh.size=6*k}for(let N=0;N<C;N++){const A=n[N];let k=A.position.x+S[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(k=Math.round(k));const V=k*i,K=A.position.y*i,H=A.texture,$=I[H.baseTexture.uid],U=H.frame,D=H._uvs,F=$.index++;$.indices[F*6+0]=0+F*4,$.indices[F*6+1]=1+F*4,$.indices[F*6+2]=2+F*4,$.indices[F*6+3]=0+F*4,$.indices[F*6+4]=2+F*4,$.indices[F*6+5]=3+F*4,$.vertices[F*8+0]=V,$.vertices[F*8+1]=K,$.vertices[F*8+2]=V+U.width*i,$.vertices[F*8+3]=K,$.vertices[F*8+4]=V+U.width*i,$.vertices[F*8+5]=K+U.height*i,$.vertices[F*8+6]=V,$.vertices[F*8+7]=K+U.height*i,$.uvs[F*8+0]=D.x0,$.uvs[F*8+1]=D.y0,$.uvs[F*8+2]=D.x1,$.uvs[F*8+3]=D.y1,$.uvs[F*8+4]=D.x2,$.uvs[F*8+5]=D.y2,$.uvs[F*8+6]=D.x3,$.uvs[F*8+7]=D.y3}this._textWidth=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const N in I){const A=I[N];if(this.anchor.x!==0||this.anchor.y!==0){let H=0;const $=this._textWidth*this.anchor.x,U=this._textHeight*this.anchor.y;for(let D=0;D<A.total;D++)A.vertices[H++]-=$,A.vertices[H++]-=U,A.vertices[H++]-=$,A.vertices[H++]-=U,A.vertices[H++]-=$,A.vertices[H++]-=U,A.vertices[H++]-=$,A.vertices[H++]-=U}this._maxLineHeight=b*i;const k=A.mesh.geometry.getBuffer("aVertexPosition"),V=A.mesh.geometry.getBuffer("aTextureCoord"),K=A.mesh.geometry.getIndex();k.data=A.vertices,V.data=A.uvs,K.data=A.indices,k.update(),V.update(),K.update()}for(let N=0;N<n.length;N++)Zg.push(n[N]);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}=fi.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=this.fontSize/s,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=u*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=fi.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(!fi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??fi.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=fi.available[this._fontName].distanceFieldType==="none"?Wg:Xg;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=nt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Vg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let nE=Vg;const oE=[".xml",".fnt"],aE={extension:{type:Q.LoadParser,priority:ui.Normal},name:"loadBitmapFont",test(r){return oE.includes(re.extname(r).toLowerCase())},async testParse(r){return lh.test(r)||pu.test(r)},async parse(r,t,e){const i=lh.test(r)?lh.parse(r):pu.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=re.join(re.dirname(s),c);u=jc(u,s),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return fi.install(i,h,!0)},async load(r,t){return(await rt.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};st.add(aE);const gu=class Vn extends Pr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Vn(Object.keys(Vn.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 Vn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Vn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return rt.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:re.basename(t,re.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=J1(t)),typeof t=="number"?j1(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,Zn.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}=rt.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}};gu.availableFonts={},gu.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 yu=gu;const ch=class Vn extends $t{constructor(t="",e={}){super(ot.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=ot.from(i,{scaleMode:rt.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new gt,s.trim=new gt,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"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Vn.defaultMaxWidth,this.maxHeight=Vn.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Vn.defaultAutoResolution,this._resolution=Vn.defaultResolution??rt.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;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:(c=this._style)==null?void 0:c.toCSS(s)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.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({},Vn.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=Sr(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=Sr(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 yu?(this.ownsStyle=!1,this._style=t):t instanceof Pr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=yu.from(t)):(this.ownsStyle=!0,this._style=new yu(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;")}};ch.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},ch.defaultMaxWidth=2024,ch.defaultMaxHeight=2024,ch.defaultAutoResolution=!0;function hE(){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 q=hE();function Ie(r){let t;return new Promise(e=>{t=e,q.on(r,t)}).then(e=>(q.off(r,t),e))}let Pi=null;const Hg=new ResizeObserver(()=>{Pi&&q.emit("stageUpdated",Pi)});function lE(r){Pi=r,Hg.observe(Pi),q.emit("stageCreated",Pi)}function cE(){Pi&&Hg.unobserve(Pi),Pi=null}async function bu(){return Pi||await Ie("stageCreated")}let ke=null;async function uE(){const r=await bu();fE(r),q.on("stageUpdated",pE)}function dE(){ke&&(ke.destroy(!0,{children:!0}),ke=null)}function fE(r){ke=new sg({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),ke.stage.sortableChildren=!0,r.appendChild(ke.view),q.emit("applicationCreated",ke),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=ke)}async function Qt(){return ke||await Ie("applicationCreated")}function pE(r){ke&&(ke.resizeTo=r,q.emit("applicationResized",ke))}var uh={exports:{}};uh.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]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Proxy]",v="[object RegExp]",T="[object Set]",S="[object String]",C="[object Undefined]",I="[object WeakMap]",R="[object ArrayBuffer]",P="[object DataView]",N="[object Float32Array]",F="[object Float64Array]",A="[object Int8Array]",k="[object Int16Array]",Z="[object Int32Array]",K="[object Uint8Array]",H="[object Uint8ClampedArray]",J="[object Uint16Array]",B="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,G=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,tt={};tt[N]=tt[F]=tt[A]=tt[k]=tt[Z]=tt[K]=tt[H]=tt[J]=tt[B]=!0,tt[a]=tt[h]=tt[R]=tt[c]=tt[P]=tt[u]=tt[d]=tt[f]=tt[p]=tt[g]=tt[x]=tt[v]=tt[T]=tt[S]=tt[I]=!1;var ft=typeof ve=="object"&&ve&&ve.Object===Object&&ve,at=typeof self=="object"&&self&&self.Object===Object&&self,Tt=ft||at||Function("return this")(),It=t&&!t.nodeType&&t,et=It&&!0&&r&&!r.nodeType&&r,X=et&&et.exports===It,$=X&&ft.process,j=function(){try{var _=et&&et.require&&et.require("util").types;return _||$&&$.binding&&$.binding("util")}catch{}}(),O=j&&j.isTypedArray;function mt(_,E,L){switch(L.length){case 0:return _.call(E);case 1:return _.call(E,L[0]);case 2:return _.call(E,L[0],L[1]);case 3:return _.call(E,L[0],L[1],L[2])}return _.apply(E,L)}function yt(_,E){for(var L=-1,U=Array(_);++L<_;)U[L]=E(L);return U}function Mt(_){return function(E){return _(E)}}function Nt(_,E){return _==null?void 0:_[E]}function Ee(_,E){return function(L){return _(E(L))}}var Ze=Array.prototype,qh=Function.prototype,Mn=Object.prototype,Uo=Tt["__core-js_shared__"],Ln=qh.toString,gi=Mn.hasOwnProperty,tl=function(){var _=/[^.]+$/.exec(Uo&&Uo.keys&&Uo.keys.IE_PROTO||"");return _?"Symbol(src)_1."+_:""}(),el=Mn.toString,Ud=Ln.call(Object),Pn=RegExp("^"+Ln.call(gi).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kr=X?Tt.Buffer:void 0,Xo=Tt.Symbol,Ve=Tt.Uint8Array,Zo=Kr?Kr.allocUnsafe:void 0,Vo=Ee(Object.getPrototypeOf,Object),il=Object.create,rl=Mn.propertyIsEnumerable,Gn=Ze.splice,Xi=Xo?Xo.toStringTag:void 0,Gs=function(){try{var _=Qo(Object,"defineProperty");return _({},"",{}),_}catch{}}(),Xd=Kr?Kr.isBuffer:void 0,Zi=Math.max,sl=Date.now,nl=Qo(Tt,"Map"),Ns=Qo(Object,"create"),Ho=function(){function _(){}return function(E){if(!Ki(E))return{};if(il)return il(E);_.prototype=E;var L=new _;return _.prototype=void 0,L}}();function He(_){var E=-1,L=_==null?0:_.length;for(this.clear();++E<L;){var U=_[E];this.set(U[0],U[1])}}function Ko(){this.__data__=Ns?Ns(null):{},this.size=0}function Yo(_){var E=this.has(_)&&delete this.__data__[_];return this.size-=E?1:0,E}function zo(_){var E=this.__data__;if(Ns){var L=E[_];return L===i?void 0:L}return gi.call(E,_)?E[_]:void 0}function Fs(_){var E=this.__data__;return Ns?E[_]!==void 0:gi.call(E,_)}function Zd(_,E){var L=this.__data__;return this.size+=this.has(_)?0:1,L[_]=Ns&&E===void 0?i:E,this}He.prototype.clear=Ko,He.prototype.delete=Yo,He.prototype.get=zo,He.prototype.has=Fs,He.prototype.set=Zd;function yi(_){var E=-1,L=_==null?0:_.length;for(this.clear();++E<L;){var U=_[E];this.set(U[0],U[1])}}function Vd(){this.__data__=[],this.size=0}function Hd(_){var E=this.__data__,L=Nn(E,_);if(L<0)return!1;var U=E.length-1;return L==U?E.pop():Gn.call(E,L,1),--this.size,!0}function Kd(_){var E=this.__data__,L=Nn(E,_);return L<0?void 0:E[L][1]}function ol(_){return Nn(this.__data__,_)>-1}function jo(_,E){var L=this.__data__,U=Nn(L,_);return U<0?(++this.size,L.push([_,E])):L[U][1]=E,this}yi.prototype.clear=Vd,yi.prototype.delete=Hd,yi.prototype.get=Kd,yi.prototype.has=ol,yi.prototype.set=jo;function Fe(_){var E=-1,L=_==null?0:_.length;for(this.clear();++E<L;){var U=_[E];this.set(U[0],U[1])}}function Yd(){this.size=0,this.__data__={hash:new He,map:new(nl||yi),string:new He}}function zd(_){var E=Dn(this,_).delete(_);return this.size-=E?1:0,E}function jd(_){return Dn(this,_).get(_)}function Jd(_){return Dn(this,_).has(_)}function $d(_,E){var L=Dn(this,_),U=L.size;return L.set(_,E),this.size+=L.size==U?0:1,this}Fe.prototype.clear=Yd,Fe.prototype.delete=zd,Fe.prototype.get=jd,Fe.prototype.has=Jd,Fe.prototype.set=$d;function xe(_){var E=this.__data__=new yi(_);this.size=E.size}function Qd(){this.__data__=new yi,this.size=0}function qd(_){var E=this.__data__,L=E.delete(_);return this.size=E.size,L}function tf(_){return this.__data__.get(_)}function ef(_){return this.__data__.has(_)}function rf(_,E){var L=this.__data__;if(L instanceof yi){var U=L.__data__;if(!nl||U.length<e-1)return U.push([_,E]),this.size=++L.size,this;L=this.__data__=new Fe(U)}return L.set(_,E),this.size=L.size,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(_,E){var L=Bn(_),U=!L&&bi(_),ut=!L&&!U&&pl(_),bt=!L&&!U&&!ut&&zr(_),_t=L||U||ut||bt,lt=_t?yt(_.length,String):[],vt=lt.length;for(var Wt in _)(E||gi.call(_,Wt))&&!(_t&&(Wt=="length"||ut&&(Wt=="offset"||Wt=="parent")||bt&&(Wt=="buffer"||Wt=="byteLength"||Wt=="byteOffset")||dl(Wt,vt)))&&lt.push(Wt);return lt}function Jo(_,E,L){(L!==void 0&&!On(_[E],L)||L===void 0&&!(E in _))&&$o(_,E,L)}function sf(_,E,L){var U=_[E];(!(gi.call(_,E)&&On(U,L))||L===void 0&&!(E in _))&&$o(_,E,L)}function Nn(_,E){for(var L=_.length;L--;)if(On(_[L][0],E))return L;return-1}function $o(_,E,L){E=="__proto__"&&Gs?Gs(_,E,{configurable:!0,enumerable:!0,value:L,writable:!0}):_[E]=L}var nf=ff();function br(_){return _==null?_===void 0?C:y:Xi&&Xi in Object(_)?pf(_):yf(_)}function al(_){return Yr(_)&&br(_)==a}function of(_){if(!Ki(_)||kn(_))return!1;var E=ks(_)?Pn:G;return E.test(_f(_))}function Vi(_){return Yr(_)&&ml(_.length)&&!!tt[br(_)]}function af(_){if(!Ki(_))return gf(_);var E=xr(_),L=[];for(var U in _)U=="constructor"&&(E||!gi.call(_,U))||L.push(U);return L}function hl(_,E,L,U,ut){_!==E&&nf(E,function(bt,_t){if(ut||(ut=new xe),Ki(bt))hf(_,E,_t,L,hl,U,ut);else{var lt=U?U(qo(_,_t),bt,_t+"",_,E,ut):void 0;lt===void 0&&(lt=bt),Jo(_,_t,lt)}},bl)}function hf(_,E,L,U,ut,bt,_t){var lt=qo(_,L),vt=qo(E,L),Wt=_t.get(vt);if(Wt){Jo(_,L,Wt);return}var Lt=bt?bt(lt,vt,L+"",_,E,_t):void 0,de=Lt===void 0;if(de){var _e=Bn(vt),si=!_e&&pl(vt),ni=!_e&&!si&&zr(vt);Lt=vt,_e||si||ni?Bn(lt)?Lt=lt:Wn(lt)?Lt=Ds(lt):si?(de=!1,Lt=uf(vt,!0)):ni?(de=!1,Lt=df(vt,!0)):Lt=[]:gl(vt)||bi(vt)?(Lt=lt,bi(lt)?Lt=yl(lt):(!Ki(lt)||ks(lt))&&(Lt=ul(vt))):de=!1}de&&(_t.set(vt,Lt),ut(Lt,vt,U,bt,_t),_t.delete(vt)),Jo(_,L,Lt)}function lf(_,E){return bf(Hi(_,E,w),_+"")}var cf=Gs?function(_,E){return Gs(_,"toString",{configurable:!0,enumerable:!1,value:wf(E),writable:!0})}:w;function uf(_,E){if(E)return _.slice();var L=_.length,U=Zo?Zo(L):new _.constructor(L);return _.copy(U),U}function Fn(_){var E=new _.constructor(_.byteLength);return new Ve(E).set(new Ve(_)),E}function df(_,E){var L=E?Fn(_.buffer):_.buffer;return new _.constructor(L,_.byteOffset,_.length)}function Ds(_,E){var L=-1,U=_.length;for(E||(E=Array(U));++L<U;)E[L]=_[L];return E}function ll(_,E,L,U){var ut=!L;L||(L={});for(var bt=-1,_t=E.length;++bt<_t;){var lt=E[bt],vt=U?U(L[lt],_[lt],lt,L,_):void 0;vt===void 0&&(vt=_[lt]),ut?$o(L,lt,vt):sf(L,lt,vt)}return L}function cl(_){return lf(function(E,L){var U=-1,ut=L.length,bt=ut>1?L[ut-1]:void 0,_t=ut>2?L[2]:void 0;for(bt=_.length>3&&typeof bt=="function"?(ut--,bt):void 0,_t&&mf(L[0],L[1],_t)&&(bt=ut<3?void 0:bt,ut=1),E=Object(E);++U<ut;){var lt=L[U];lt&&_(E,lt,U,bt)}return E})}function ff(_){return function(E,L,U){for(var ut=-1,bt=Object(E),_t=U(E),lt=_t.length;lt--;){var vt=_t[_?lt:++ut];if(L(bt[vt],vt,bt)===!1)break}return E}}function Dn(_,E){var L=_.__data__;return fl(E)?L[typeof E=="string"?"string":"hash"]:L.map}function Qo(_,E){var L=Nt(_,E);return of(L)?L:void 0}function pf(_){var E=gi.call(_,Xi),L=_[Xi];try{_[Xi]=void 0;var U=!0}catch{}var ut=el.call(_);return U&&(E?_[Xi]=L:delete _[Xi]),ut}function ul(_){return typeof _.constructor=="function"&&!xr(_)?Ho(Vo(_)):{}}function dl(_,E){var L=typeof _;return E=E??o,!!E&&(L=="number"||L!="symbol"&&V.test(_))&&_>-1&&_%1==0&&_<E}function mf(_,E,L){if(!Ki(L))return!1;var U=typeof E;return(U=="number"?ta(L)&&dl(E,L.length):U=="string"&&E in L)?On(L[E],_):!1}function fl(_){var E=typeof _;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?_!=="__proto__":_===null}function kn(_){return!!tl&&tl in _}function xr(_){var E=_&&_.constructor,L=typeof E=="function"&&E.prototype||Mn;return _===L}function gf(_){var E=[];if(_!=null)for(var L in Object(_))E.push(L);return E}function yf(_){return el.call(_)}function Hi(_,E,L){return E=Zi(E===void 0?_.length-1:E,0),function(){for(var U=arguments,ut=-1,bt=Zi(U.length-E,0),_t=Array(bt);++ut<bt;)_t[ut]=U[E+ut];ut=-1;for(var lt=Array(E+1);++ut<E;)lt[ut]=U[ut];return lt[E]=L(_t),mt(_,this,lt)}}function qo(_,E){if(!(E==="constructor"&&typeof _[E]=="function")&&E!="__proto__")return _[E]}var bf=xf(cf);function xf(_){var E=0,L=0;return function(){var U=sl(),ut=n-(U-L);if(L=U,ut>0){if(++E>=s)return arguments[0]}else E=0;return _.apply(void 0,arguments)}}function _f(_){if(_!=null){try{return Ln.call(_)}catch{}try{return _+""}catch{}}return""}function On(_,E){return _===E||_!==_&&E!==E}var bi=al(function(){return arguments}())?al:function(_){return Yr(_)&&gi.call(_,"callee")&&!rl.call(_,"callee")},Bn=Array.isArray;function ta(_){return _!=null&&ml(_.length)&&!ks(_)}function Wn(_){return Yr(_)&&ta(_)}var pl=Xd||M;function ks(_){if(!Ki(_))return!1;var E=br(_);return E==f||E==m||E==l||E==b}function ml(_){return typeof _=="number"&&_>-1&&_%1==0&&_<=o}function Ki(_){var E=typeof _;return _!=null&&(E=="object"||E=="function")}function Yr(_){return _!=null&&typeof _=="object"}function gl(_){if(!Yr(_)||br(_)!=x)return!1;var E=Vo(_);if(E===null)return!0;var L=gi.call(E,"constructor")&&E.constructor;return typeof L=="function"&&L instanceof L&&Ln.call(L)==Ud}var zr=O?Mt(O):Vi;function yl(_){return ll(_,bl(_))}function bl(_){return ta(_)?yr(_,!0):af(_)}var vf=cl(function(_,E,L){hl(_,E,L)});function wf(_){return function(){return _}}function w(_){return _}function M(){return!1}r.exports=vf}(uh,uh.exports);var mE=uh.exports;const gE=Us(mE);let ps=null;function yE(){ps=z.effectScope()}function bE(){ps==null||ps.stop(),ps=null}async function xE(){return ps||await Ie("scopeCreated")}let Nr=null;const Kg={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,fetchEvents:()=>[],styles:{colorMode:"dark",rowGap:24,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",selectedBorderColor:"#3fa2c3",selectedBorderWidth:2,selectedBorderOffset:4,selectedBorderRadius:9,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeUnselectedAlpha:.2,artifactsGap:4,artifactsNodeOverlap:4,artifactPaddingLeft:2,artifactPaddingRight:4,artifactPaddingY:2,artifactTextColor:"#ffffff",artifactBgColor:"#35363b",artifactBorderRadius:4,artifactContentGap:4,artifactIconSize:16,artifactIconColor:"#ffffff",flowStateBarHeight:8,flowStateSelectedBarHeight:10,flowStateAreaAlpha:.1,eventTargetSize:30,eventBottomMargin:4,eventSelectedBorderInset:8,eventRadiusDefault:4,eventColor:"#A564F9",eventClusterRadiusDefault:6,eventClusterColor:"#A564F9",edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"}),state:()=>({background:"#ffffff"})}};function _E(r){const t=gE({},Kg,r);return t.styles.node=e=>{var i,s;return{...Kg.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function vE(r){(await xE()).run(()=>{z.watch(()=>r.config,e=>{const i=_E(e);if(!Nr){Nr=i,q.emit("configCreated",Nr);return}Object.assign(Nr,i),q.emit("configUpdated",Nr)},{immediate:!0})})}function wE(){Nr=null}async function Pt(){return Nr||await Ie("configCreated")}async function Yg(r,t){const e=await Pt();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(),zg(s)))}function o(){clearInterval(i)}return{start:n,stop:o}}function zg(r){const t=Math.floor(r.nodes.size/oa)*oa;return Math.max(oa,t)}function nr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function jg(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
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=J1(t)),typeof t=="number"?j1(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,Vn.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}=rt.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}};gu.availableFonts={},gu.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 yu=gu;const uh=class Hn extends $t{constructor(t="",e={}){super(nt.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=nt.from(i,{scaleMode:rt.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new mt,s.trim=new mt,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"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Hn.defaultMaxWidth,this.maxHeight=Hn.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Hn.defaultAutoResolution,this._resolution=Hn.defaultResolution??rt.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;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:(c=this._style)==null?void 0:c.toCSS(s)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.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({},Hn.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=Sr(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=Sr(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 yu?(this.ownsStyle=!1,this._style=t):t instanceof Pr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=yu.from(t)):(this.ownsStyle=!0,this._style=new yu(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;")}};uh.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},uh.defaultMaxWidth=2024,uh.defaultMaxHeight=2024,uh.defaultAutoResolution=!0;function hE(){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 q=hE();function Ie(r){let t;return new Promise(e=>{t=e,q.on(r,t)}).then(e=>(q.off(r,t),e))}let Pi=null;const Hg=new ResizeObserver(()=>{Pi&&q.emit("stageUpdated",Pi)});function lE(r){Pi=r,Hg.observe(Pi),q.emit("stageCreated",Pi)}function cE(){Pi&&Hg.unobserve(Pi),Pi=null}async function bu(){return Pi||await Ie("stageCreated")}let ke=null;async function uE(){const r=await bu();fE(r),q.on("stageUpdated",pE)}function dE(){ke&&(ke.destroy(!0,{children:!0}),ke=null)}function fE(r){ke=new sg({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),ke.stage.sortableChildren=!0,r.appendChild(ke.view),q.emit("applicationCreated",ke),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=ke)}async function Qt(){return ke||await Ie("applicationCreated")}function pE(r){ke&&(ke.resizeTo=r,q.emit("applicationResized",ke))}var dh={exports:{}};dh.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]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Proxy]",v="[object RegExp]",w="[object Set]",S="[object String]",C="[object Undefined]",I="[object WeakMap]",R="[object ArrayBuffer]",P="[object DataView]",G="[object Float32Array]",N="[object Float64Array]",A="[object Int8Array]",k="[object Int16Array]",V="[object Int32Array]",K="[object Uint8Array]",H="[object Uint8ClampedArray]",$="[object Uint16Array]",U="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,Z=/^(?:0|[1-9]\d*)$/,tt={};tt[G]=tt[N]=tt[A]=tt[k]=tt[V]=tt[K]=tt[H]=tt[$]=tt[U]=!0,tt[a]=tt[h]=tt[R]=tt[c]=tt[P]=tt[u]=tt[d]=tt[f]=tt[m]=tt[g]=tt[x]=tt[v]=tt[w]=tt[S]=tt[I]=!1;var ft=typeof ve=="object"&&ve&&ve.Object===Object&&ve,ot=typeof self=="object"&&self&&self.Object===Object&&self,Et=ft||ot||Function("return this")(),Mt=t&&!t.nodeType&&t,bt=Mt&&!0&&r&&!r.nodeType&&r,B=bt&&bt.exports===Mt,j=B&&ft.process,J=function(){try{var _=bt&&bt.require&&bt.require("util").types;return _||j&&j.binding&&j.binding("util")}catch{}}(),O=J&&J.isTypedArray;function gt(_,E,L){switch(L.length){case 0:return _.call(E);case 1:return _.call(E,L[0]);case 2:return _.call(E,L[0],L[1]);case 3:return _.call(E,L[0],L[1],L[2])}return _.apply(E,L)}function ut(_,E){for(var L=-1,X=Array(_);++L<_;)X[L]=E(L);return X}function It(_){return function(E){return _(E)}}function Dt(_,E){return _==null?void 0:_[E]}function Ee(_,E){return function(L){return _(E(L))}}var ri=Array.prototype,Xo=Function.prototype,Kr=Object.prototype,Fs=Et["__core-js_shared__"],Ns=Xo.toString,gi=Kr.hasOwnProperty,tl=function(){var _=/[^.]+$/.exec(Fs&&Fs.keys&&Fs.keys.IE_PROTO||"");return _?"Symbol(src)_1."+_:""}(),el=Kr.toString,Wd=Ns.call(Object),Gn=RegExp("^"+Ns.call(gi).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Yr=B?Et.Buffer:void 0,Zo=Et.Symbol,Ze=Et.Uint8Array,Vo=Yr?Yr.allocUnsafe:void 0,Ho=Ee(Object.getPrototypeOf,Object),il=Object.create,rl=Kr.propertyIsEnumerable,Fn=ri.splice,Xi=Zo?Zo.toStringTag:void 0,Ds=function(){try{var _=qo(Object,"defineProperty");return _({},"",{}),_}catch{}}(),Xd=Yr?Yr.isBuffer:void 0,Zi=Math.max,sl=Date.now,nl=qo(Et,"Map"),ks=qo(Object,"create"),Ko=function(){function _(){}return function(E){if(!Ki(E))return{};if(il)return il(E);_.prototype=E;var L=new _;return _.prototype=void 0,L}}();function Ve(_){var E=-1,L=_==null?0:_.length;for(this.clear();++E<L;){var X=_[E];this.set(X[0],X[1])}}function Yo(){this.__data__=ks?ks(null):{},this.size=0}function zo(_){var E=this.has(_)&&delete this.__data__[_];return this.size-=E?1:0,E}function jo(_){var E=this.__data__;if(ks){var L=E[_];return L===i?void 0:L}return gi.call(E,_)?E[_]:void 0}function Os(_){var E=this.__data__;return ks?E[_]!==void 0:gi.call(E,_)}function Zd(_,E){var L=this.__data__;return this.size+=this.has(_)?0:1,L[_]=ks&&E===void 0?i:E,this}Ve.prototype.clear=Yo,Ve.prototype.delete=zo,Ve.prototype.get=jo,Ve.prototype.has=Os,Ve.prototype.set=Zd;function yi(_){var E=-1,L=_==null?0:_.length;for(this.clear();++E<L;){var X=_[E];this.set(X[0],X[1])}}function Vd(){this.__data__=[],this.size=0}function Hd(_){var E=this.__data__,L=Nn(E,_);if(L<0)return!1;var X=E.length-1;return L==X?E.pop():Fn.call(E,L,1),--this.size,!0}function Kd(_){var E=this.__data__,L=Nn(E,_);return L<0?void 0:E[L][1]}function ol(_){return Nn(this.__data__,_)>-1}function Jo(_,E){var L=this.__data__,X=Nn(L,_);return X<0?(++this.size,L.push([_,E])):L[X][1]=E,this}yi.prototype.clear=Vd,yi.prototype.delete=Hd,yi.prototype.get=Kd,yi.prototype.has=ol,yi.prototype.set=Jo;function Ne(_){var E=-1,L=_==null?0:_.length;for(this.clear();++E<L;){var X=_[E];this.set(X[0],X[1])}}function Yd(){this.size=0,this.__data__={hash:new Ve,map:new(nl||yi),string:new Ve}}function zd(_){var E=kn(this,_).delete(_);return this.size-=E?1:0,E}function jd(_){return kn(this,_).get(_)}function Jd(_){return kn(this,_).has(_)}function $d(_,E){var L=kn(this,_),X=L.size;return L.set(_,E),this.size+=L.size==X?0:1,this}Ne.prototype.clear=Yd,Ne.prototype.delete=zd,Ne.prototype.get=jd,Ne.prototype.has=Jd,Ne.prototype.set=$d;function xe(_){var E=this.__data__=new yi(_);this.size=E.size}function Qd(){this.__data__=new yi,this.size=0}function qd(_){var E=this.__data__,L=E.delete(_);return this.size=E.size,L}function tf(_){return this.__data__.get(_)}function ef(_){return this.__data__.has(_)}function rf(_,E){var L=this.__data__;if(L instanceof yi){var X=L.__data__;if(!nl||X.length<e-1)return X.push([_,E]),this.size=++L.size,this;L=this.__data__=new Ne(X)}return L.set(_,E),this.size=L.size,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(_,E){var L=Un(_),X=!L&&bi(_),ct=!L&&!X&&pl(_),yt=!L&&!X&&!ct&&jr(_),_t=L||X||ct||yt,ht=_t?ut(_.length,String):[],vt=ht.length;for(var Ut in _)(E||gi.call(_,Ut))&&!(_t&&(Ut=="length"||ct&&(Ut=="offset"||Ut=="parent")||yt&&(Ut=="buffer"||Ut=="byteLength"||Ut=="byteOffset")||dl(Ut,vt)))&&ht.push(Ut);return ht}function $o(_,E,L){(L!==void 0&&!Bn(_[E],L)||L===void 0&&!(E in _))&&Qo(_,E,L)}function sf(_,E,L){var X=_[E];(!(gi.call(_,E)&&Bn(X,L))||L===void 0&&!(E in _))&&Qo(_,E,L)}function Nn(_,E){for(var L=_.length;L--;)if(Bn(_[L][0],E))return L;return-1}function Qo(_,E,L){E=="__proto__"&&Ds?Ds(_,E,{configurable:!0,enumerable:!0,value:L,writable:!0}):_[E]=L}var nf=ff();function br(_){return _==null?_===void 0?C:y:Xi&&Xi in Object(_)?pf(_):yf(_)}function al(_){return zr(_)&&br(_)==a}function of(_){if(!Ki(_)||On(_))return!1;var E=Us(_)?Gn:F;return E.test(_f(_))}function Vi(_){return zr(_)&&ml(_.length)&&!!tt[br(_)]}function af(_){if(!Ki(_))return gf(_);var E=xr(_),L=[];for(var X in _)X=="constructor"&&(E||!gi.call(_,X))||L.push(X);return L}function hl(_,E,L,X,ct){_!==E&&nf(E,function(yt,_t){if(ct||(ct=new xe),Ki(yt))hf(_,E,_t,L,hl,X,ct);else{var ht=X?X(ta(_,_t),yt,_t+"",_,E,ct):void 0;ht===void 0&&(ht=yt),$o(_,_t,ht)}},bl)}function hf(_,E,L,X,ct,yt,_t){var ht=ta(_,L),vt=ta(E,L),Ut=_t.get(vt);if(Ut){$o(_,L,Ut);return}var Lt=yt?yt(ht,vt,L+"",_,E,_t):void 0,de=Lt===void 0;if(de){var _e=Un(vt),si=!_e&&pl(vt),ni=!_e&&!si&&jr(vt);Lt=vt,_e||si||ni?Un(ht)?Lt=ht:Wn(ht)?Lt=Bs(ht):si?(de=!1,Lt=uf(vt,!0)):ni?(de=!1,Lt=df(vt,!0)):Lt=[]:gl(vt)||bi(vt)?(Lt=ht,bi(ht)?Lt=yl(ht):(!Ki(ht)||Us(ht))&&(Lt=ul(vt))):de=!1}de&&(_t.set(vt,Lt),ct(Lt,vt,X,yt,_t),_t.delete(vt)),$o(_,L,Lt)}function lf(_,E){return bf(Hi(_,E,T),_+"")}var cf=Ds?function(_,E){return Ds(_,"toString",{configurable:!0,enumerable:!1,value:wf(E),writable:!0})}:T;function uf(_,E){if(E)return _.slice();var L=_.length,X=Vo?Vo(L):new _.constructor(L);return _.copy(X),X}function Dn(_){var E=new _.constructor(_.byteLength);return new Ze(E).set(new Ze(_)),E}function df(_,E){var L=E?Dn(_.buffer):_.buffer;return new _.constructor(L,_.byteOffset,_.length)}function Bs(_,E){var L=-1,X=_.length;for(E||(E=Array(X));++L<X;)E[L]=_[L];return E}function ll(_,E,L,X){var ct=!L;L||(L={});for(var yt=-1,_t=E.length;++yt<_t;){var ht=E[yt],vt=X?X(L[ht],_[ht],ht,L,_):void 0;vt===void 0&&(vt=_[ht]),ct?Qo(L,ht,vt):sf(L,ht,vt)}return L}function cl(_){return lf(function(E,L){var X=-1,ct=L.length,yt=ct>1?L[ct-1]:void 0,_t=ct>2?L[2]:void 0;for(yt=_.length>3&&typeof yt=="function"?(ct--,yt):void 0,_t&&mf(L[0],L[1],_t)&&(yt=ct<3?void 0:yt,ct=1),E=Object(E);++X<ct;){var ht=L[X];ht&&_(E,ht,X,yt)}return E})}function ff(_){return function(E,L,X){for(var ct=-1,yt=Object(E),_t=X(E),ht=_t.length;ht--;){var vt=_t[_?ht:++ct];if(L(yt[vt],vt,yt)===!1)break}return E}}function kn(_,E){var L=_.__data__;return fl(E)?L[typeof E=="string"?"string":"hash"]:L.map}function qo(_,E){var L=Dt(_,E);return of(L)?L:void 0}function pf(_){var E=gi.call(_,Xi),L=_[Xi];try{_[Xi]=void 0;var X=!0}catch{}var ct=el.call(_);return X&&(E?_[Xi]=L:delete _[Xi]),ct}function ul(_){return typeof _.constructor=="function"&&!xr(_)?Ko(Ho(_)):{}}function dl(_,E){var L=typeof _;return E=E??o,!!E&&(L=="number"||L!="symbol"&&Z.test(_))&&_>-1&&_%1==0&&_<E}function mf(_,E,L){if(!Ki(L))return!1;var X=typeof E;return(X=="number"?ea(L)&&dl(E,L.length):X=="string"&&E in L)?Bn(L[E],_):!1}function fl(_){var E=typeof _;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?_!=="__proto__":_===null}function On(_){return!!tl&&tl in _}function xr(_){var E=_&&_.constructor,L=typeof E=="function"&&E.prototype||Kr;return _===L}function gf(_){var E=[];if(_!=null)for(var L in Object(_))E.push(L);return E}function yf(_){return el.call(_)}function Hi(_,E,L){return E=Zi(E===void 0?_.length-1:E,0),function(){for(var X=arguments,ct=-1,yt=Zi(X.length-E,0),_t=Array(yt);++ct<yt;)_t[ct]=X[E+ct];ct=-1;for(var ht=Array(E+1);++ct<E;)ht[ct]=X[ct];return ht[E]=L(_t),gt(_,this,ht)}}function ta(_,E){if(!(E==="constructor"&&typeof _[E]=="function")&&E!="__proto__")return _[E]}var bf=xf(cf);function xf(_){var E=0,L=0;return function(){var X=sl(),ct=n-(X-L);if(L=X,ct>0){if(++E>=s)return arguments[0]}else E=0;return _.apply(void 0,arguments)}}function _f(_){if(_!=null){try{return Ns.call(_)}catch{}try{return _+""}catch{}}return""}function Bn(_,E){return _===E||_!==_&&E!==E}var bi=al(function(){return arguments}())?al:function(_){return zr(_)&&gi.call(_,"callee")&&!rl.call(_,"callee")},Un=Array.isArray;function ea(_){return _!=null&&ml(_.length)&&!Us(_)}function Wn(_){return zr(_)&&ea(_)}var pl=Xd||M;function Us(_){if(!Ki(_))return!1;var E=br(_);return E==f||E==p||E==l||E==b}function ml(_){return typeof _=="number"&&_>-1&&_%1==0&&_<=o}function Ki(_){var E=typeof _;return _!=null&&(E=="object"||E=="function")}function zr(_){return _!=null&&typeof _=="object"}function gl(_){if(!zr(_)||br(_)!=x)return!1;var E=Ho(_);if(E===null)return!0;var L=gi.call(E,"constructor")&&E.constructor;return typeof L=="function"&&L instanceof L&&Ns.call(L)==Wd}var jr=O?It(O):Vi;function yl(_){return ll(_,bl(_))}function bl(_){return ea(_)?yr(_,!0):af(_)}var vf=cl(function(_,E,L){hl(_,E,L)});function wf(_){return function(){return _}}function T(_){return _}function M(){return!1}r.exports=vf}(dh,dh.exports);var mE=dh.exports;const gE=Vs(mE);let ms=null;function yE(){ms=z.effectScope()}function bE(){ms==null||ms.stop(),ms=null}async function xE(){return ms||await Ie("scopeCreated")}let Fr=null;const Kg={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,fetchEvents:()=>[],styles:{colorMode:"dark",rowGap:24,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",selectedBorderColor:"#3fa2c3",selectedBorderWidth:2,selectedBorderOffset:4,selectedBorderRadius:9,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeUnselectedAlpha:.2,artifactsGap:4,artifactsNodeOverlap:4,artifactPaddingLeft:2,artifactPaddingRight:4,artifactPaddingY:2,artifactTextColor:"#ffffff",artifactBgColor:"#35363b",artifactBorderRadius:4,artifactContentGap:4,artifactIconSize:16,artifactIconColor:"#ffffff",flowStateBarHeight:8,flowStateSelectedBarHeight:10,flowStateAreaAlpha:.1,eventTargetSize:30,eventBottomMargin:4,eventSelectedBorderInset:8,eventRadiusDefault:4,eventColor:"#A564F9",eventClusterRadiusDefault:6,eventClusterColor:"#A564F9",edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"}),state:()=>({background:"#ffffff"})}};function _E(r){const t=gE({},Kg,r);return t.styles.node=e=>{var i,s;return{...Kg.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function vE(r){(await xE()).run(()=>{z.watch(()=>r.config,e=>{const i=_E(e);if(!Fr){Fr=i,q.emit("configCreated",Fr);return}Object.assign(Fr,i),q.emit("configUpdated",Fr)},{immediate:!0})})}function wE(){Fr=null}async function Pt(){return Fr||await Ie("configCreated")}async function Yg(r,t){const e=await Pt();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(),zg(s)))}function o(){clearInterval(i)}return{start:n,stop:o}}function zg(r){const t=Math.floor(r.nodes.size/aa)*aa;return Math.max(aa,t)}function nr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function jg(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
1160
1160
  * GSAP 3.12.5
1161
1161
  * https://gsap.com
1162
1162
  *
@@ -1164,7 +1164,7 @@ void main(void)\r
1164
1164
  * Subject to the terms at https://gsap.com/standard-license or for
1165
1165
  * Club GSAP members, the agreement issued with that membership.
1166
1166
  * @author: Jack Doyle, jack@greensock.com
1167
- */var Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},ln={duration:.5,overwrite:!1,delay:0},xu,ge,Bt,Je=1e8,Dt=1/Je,_u=Math.PI*2,TE=_u/4,SE=0,Jg=Math.sqrt,EE=Math.cos,CE=Math.sin,he=function(t){return typeof t=="string"},Yt=function(t){return typeof t=="function"},or=function(t){return typeof t=="number"},vu=function(t){return typeof t>"u"},Gi=function(t){return typeof t=="object"},Ae=function(t){return t!==!1},wu=function(){return typeof window<"u"},dh=function(t){return Yt(t)||he(t)},$g=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ye=Array.isArray,Tu=/(?:-?\.?\d|\.)+/gi,Qg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,cn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Su=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,qg=/[+-]=-?[.\d]+/,t0=/[^,'"\[\]\s]+/gi,IE=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Vt,Ni,Eu,Cu,Be={},fh={},e0,i0=function(t){return(fh=gs(t,Be))&&Le},Iu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},co=function(t,e){return!e&&console.warn(t)},r0=function(t,e){return t&&(Be[t]=e)&&fh&&(fh[t]=e)||Be},uo=function(){return 0},AE={suppressEvents:!0,isStart:!0,kill:!1},ph={suppressEvents:!0,kill:!1},RE={suppressEvents:!0},Au={},Fr=[],Ru={},s0,We={},Mu={},n0=30,mh=[],Lu="",Pu=function(t){var e=t[0],i,s;if(Gi(e)||Yt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=mh.length;s--&&!mh[s].targetTest(e););i=mh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new N0(t[s],i)))||t.splice(s,1);return t},ms=function(t){return t._gsap||Pu(qe(t))[0]._gsap},o0=function(t,e,i){return(i=t[e])&&Yt(i)?t[e]():vu(i)&&t.getAttribute&&t.getAttribute(e)||i},Re=function(t,e){return(t=t.split(",")).forEach(e)||t},jt=function(t){return Math.round(t*1e5)/1e5||0},le=function(t){return Math.round(t*1e7)/1e7||0},un=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},ME=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},gh=function(){var t=Fr.length,e=Fr.slice(0),i,s;for(Ru={},Fr.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},a0=function(t,e,i,s){Fr.length&&!ge&&gh(),t.render(e,i,s||ge&&e<0&&(t._initted||t._startAt)),Fr.length&&!ge&&gh()},h0=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(t0).length<2?e:he(t)?t.trim():t},l0=function(t){return t},$e=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},LE=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},gs=function(t,e){for(var i in e)t[i]=e[i];return t},c0=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Gi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},yh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},fo=function(t){var e=t.parent||Vt,i=t.keyframes?LE(ye(t.keyframes)):$e;if(Ae(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},PE=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},u0=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},bh=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},Dr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},ys=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},GE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Gu=function(t,e,i,s){return t._startAt&&(ge?t._startAt.revert(ph):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},NE=function r(t){return!t||t._ts&&r(t.parent)},d0=function(t){return t._repeat?dn(t._tTime,t=t.duration()+t._rDelay)*t:0},dn=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},xh=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},_h=function(t){return t._end=le(t._start+(t._tDur/Math.abs(t._ts||t._rts||Dt)||0))},vh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=le(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),_h(t),i._dirty||ys(i,t)),t},f0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=xh(t.rawTime(),e),(!e._dur||mo(0,e.totalDuration(),i)-e._tTime>Dt)&&e.render(i,!0)),ys(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=-Dt}},Fi=function(t,e,i,s){return e.parent&&Dr(e),e._start=le((or(i)?i:i||t!==Vt?Qe(t,i,e):t._time)+e._delay),e._end=le(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),u0(t,e,"_first","_last",t._sort?"_start":0),Nu(e)||(t._recent=e),s||f0(t,e),t._ts<0&&vh(t,t._tTime),t},p0=function(t,e){return(Be.ScrollTrigger||Iu("scrollTrigger",e))&&Be.ScrollTrigger.create(e,t)},m0=function(t,e,i,s,n){if(Zu(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ge&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&s0!==Xe.frame)return Fr.push(t),t._lazy=[n,s],1},FE=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Nu=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},DE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&FE(t)&&!(!t._initted&&Nu(t))||(t._ts<0||t._dp._ts<0)&&!Nu(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=mo(0,t._tDur,e),c=dn(h,a),t._yoyo&&c&1&&(o=1-o),c!==dn(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ge||s||t._zTime===Dt||!e&&t._zTime){if(!t._initted&&m0(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Dt:0),i||(i=e&&!u),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&&Gu(t,e,i,!0),t._onUpdate&&!i&&Ue(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Ue(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Dr(t,1),!i&&!ge&&(Ue(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},kE=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}},fn=function(t,e,i,s){var n=t._repeat,o=le(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:le(o*(n+1)+t._rDelay*n):o,a>0&&!s&&vh(t,t._tTime=t._tDur*a),t.parent&&_h(t),i||ys(t.parent,t),t},g0=function(t){return t instanceof Se?ys(t):fn(t,t._dur)},OE={_start:0,endTime:uo,totalDuration:uo},Qe=function r(t,e,i){var s=t.labels,n=t._recent||OE,o=t.duration()>=Je?n.endTime(!1):t._dur,a,h,l;return he(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*(ye(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},po=function(t,e,i){var s=or(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=Ae(h.vars.inherit)&&h.parent;o.immediateRender=Ae(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new qt(e[0],o,e[n+1])},kr=function(t,e){return t||t===0?e(t):e},mo=function(t,e,i){return i<t?t:i>e?e:i},be=function(t,e){return!he(t)||!(e=IE.exec(t))?"":e[1]},BE=function(t,e,i){return kr(i,function(s){return mo(t,e,s)})},Fu=[].slice,y0=function(t,e){return t&&Gi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Gi(t[0]))&&!t.nodeType&&t!==Ni},WE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return he(s)&&!e||y0(s,1)?(n=i).push.apply(n,qe(s)):i.push(s)})||i},qe=function(t,e,i){return Bt&&!e&&Bt.selector?Bt.selector(t):he(t)&&!i&&(Eu||!mn())?Fu.call((e||Cu).querySelectorAll(t),0):ye(t)?WE(t,i):y0(t)?Fu.call(t,0):t?[t]:[]},Du=function(t){return t=qe(t)[0]||co("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return qe(e,i.querySelectorAll?i:i===t?co("Invalid scope")||Cu.createElement("div"):t)}},b0=function(t){return t.sort(function(){return .5-Math.random()})},x0=function(t){if(Yt(t))return t;var e=Gi(t)?t:{each:t},i=bs(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,c=s,u=s;return he(s)?c=u={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(c=s[0],u=s[1]),function(d,f,m){var p=(m||e).length,g=o[p],y,x,b,v,T,S,C,I,R;if(!g){if(R=e.grid==="auto"?0:(e.grid||[1,Je])[1],!R){for(C=-Je;C<(C=m[R++].getBoundingClientRect().left)&&R<p;);R<p&&R--}for(g=o[p]=[],y=h?Math.min(R,p)*c-.5:s%R,x=R===Je?0:h?p*u/R-.5:s/R|0,C=0,I=Je,S=0;S<p;S++)b=S%R-y,v=x-(S/R|0),g[S]=T=l?Math.abs(l==="y"?v:b):Jg(b*b+v*v),T>C&&(C=T),T<I&&(I=T);s==="random"&&b0(g),g.max=C-I,g.min=I,g.v=p=(parseFloat(e.amount)||parseFloat(e.each)*(R>p?p-1:l?l==="y"?p/R:R:Math.max(R,p/R))||0)*(s==="edges"?-1:1),g.b=p<0?n-p:n,g.u=be(e.amount||e.each)||0,i=i&&p<0?L0(i):i}return p=(g[d]-g.min)/g.max||0,le(g.b+(i?i(p):p)*g.v)+g.u}},ku=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=le(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(or(i)?0:be(i))}},_0=function(t,e){var i=ye(t),s,n;return!i&&Gi(t)&&(s=i=t.radius||Je,t.values?(t=qe(t.values),(n=!or(t[0]))&&(s*=s)):t=ku(t.increment)),kr(e,i?Yt(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=Je,c=0,u=t.length,d,f;u--;)n?(d=t[u].x-a,f=t[u].y-h,d=d*d+f*f):d=Math.abs(t[u]-a),d<l&&(l=d,c=u);return c=!s||l<=s?t[c]:o,n||c===o||or(o)?c:c+be(o)}:ku(t))},v0=function(t,e,i,s){return kr(ye(t)?!e:i===!0?!!(i=0):!s,function(){return ye(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})},UE=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)}},XE=function(t,e){return function(i){return t(parseFloat(i))+(e||be(i))}},ZE=function(t,e,i){return T0(t,e,0,1,i)},w0=function(t,e,i){return kr(i,function(s){return t[~~e(s)]})},VE=function r(t,e,i){var s=e-t;return ye(t)?w0(t,r(0,t.length),e):kr(i,function(n){return(s+(n-t)%s)%s+t})},HE=function r(t,e,i){var s=e-t,n=s*2;return ye(t)?w0(t,r(0,t.length-1),e):kr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},go=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?t0:Tu),i+=t.substr(e,s-e)+v0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},T0=function(t,e,i,s,n){var o=e-t,a=s-i;return kr(n,function(h){return i+((h-t)/o*a||0)})},KE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=he(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(ye(t)&&!ye(e)){for(c=[],u=t.length,d=u-2,l=1;l<u;l++)c.push(r(t[l-1],t[l]));u--,n=function(m){m*=u;var p=Math.min(d,~~m);return c[p](m-p)},i=e}else s||(t=gs(ye(t)?[]:{},t));if(!c){for(h in e)Uu.call(a,t,h,"get",e[h]);n=function(m){return Ku(m,a)||(o?t.p:t)}}}return kr(i,n)},S0=function(t,e,i){var s=t.labels,n=Je,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},Ue=function(t,e,i){var s=t.vars,n=s[e],o=Bt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Fr.length&&gh(),a&&(Bt=a),c=h?n.apply(l,h):n.call(l),Bt=o,c},yo=function(t){return Dr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ge),t.progress()<1&&Ue(t,"onInterrupt"),t},pn,E0=[],C0=function(t){if(t)if(t=!t.name&&t.default||t,wu()||t.headless){var e=t.name,i=Yt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:uo,render:Ku,add:Uu,kill:hC,modifier:aC,rawVars:0},o={targetTest:0,get:0,getSetter:Hu,aliases:{},register:0};if(mn(),t!==s){if(We[e])return;$e(s,$e(yh(t,n),o)),gs(s.prototype,gs(n,yh(t,o))),We[s.prop=e]=s,t.targetTest&&(mh.push(s),Au[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}r0(e,s),t.register&&t.register(Le,s,Me)}else E0.push(t)},Gt=255,bo={aqua:[0,Gt,Gt],lime:[0,Gt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Gt],navy:[0,0,128],white:[Gt,Gt,Gt],olive:[128,128,0],yellow:[Gt,Gt,0],orange:[Gt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Gt,0,0],pink:[Gt,192,203],cyan:[0,Gt,Gt],transparent:[Gt,Gt,Gt,0]},Ou=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)*Gt+.5|0},I0=function(t,e,i){var s=t?or(t)?[t>>16,t>>8&Gt,t&Gt]:0:bo.black,n,o,a,h,l,c,u,d,f,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),bo[t])s=bo[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&Gt,s&Gt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Gt,t&Gt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(Tu),!e)h=+s[0]%360/360,l=+s[1]/100,c=+s[2]/100,o=c<=.5?c*(l+1):c+l-c*l,n=c*2-o,s.length>3&&(s[3]*=1),s[0]=Ou(h+1/3,n,o),s[1]=Ou(h,n,o),s[2]=Ou(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(Qg),i&&s.length<4&&(s[3]=1),s}else s=t.match(Tu)||bo.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Gt,o=s[1]/Gt,a=s[2]/Gt,u=Math.max(n,o,a),d=Math.min(n,o,a),c=(u+d)/2,u===d?h=l=0:(f=u-d,l=c>.5?f/(2-u-d):f/(u+d),h=u===n?(o-a)/f+(o<a?6:0):u===o?(a-n)/f+2:(n-o)/f+4,h*=60),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(c*100+.5)),i&&s.length<4&&(s[3]=1),s},A0=function(t){var e=[],i=[],s=-1;return t.split(Or).forEach(function(n){var o=n.match(cn)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},R0=function(t,e,i){var s="",n=(t+s).match(Or),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=I0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=A0(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Or,"1").split(cn),u=l.length-1;a<u;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(c.length?c:n.length?n:i).shift());if(!l)for(l=t.split(Or),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Or=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in bo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),YE=/hsl[a]?\(/,M0=function(t){var e=t.join(" "),i;if(Or.lastIndex=0,Or.test(e))return i=YE.test(e),t[1]=R0(t[1],i),t[0]=R0(t[0],i,A0(t[1])),!0},xo,Xe=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,c,u,d,f,m=function p(g){var y=r()-s,x=g===!0,b,v,T,S;if((y>t||y<0)&&(i+=y-e),s+=y,T=s-i,b=T-o,(b>0||x)&&(S=++u.frame,d=T-u.time*1e3,u.time=T=T/1e3,o+=b+(b>=n?4:n-b),v=1),x||(h=l(p)),v)for(f=0;f<a.length;f++)a[f](T,d,S,g)};return u={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){e0&&(!Eu&&wu()&&(Ni=Eu=window,Cu=Ni.document||{},Be.gsap=Le,(Ni.gsapVersions||(Ni.gsapVersions=[])).push(Le.version),i0(fh||Ni.GreenSockGlobals||!Ni.gsap&&Ni||{}),E0.forEach(C0)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},xo=1,m(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),xo=0,l=uo},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=u.time*1e3+n},add:function(g,y,x){var b=y?function(v,T,S,C){g(v,T,S,C),u.remove(b)}:g;return u.remove(g),a[x?"unshift":"push"](b),mn(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),mn=function(){return!xo&&Xe.wake()},Et={},zE=/^[\d.\-M][\d.\-,\s]/,jE=/["']/g,JE=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(jE,"").trim():+l,s=h.substr(a+1).trim();return e},$E=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)},QE=function(t){var e=(t+"").split("("),i=Et[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[JE(e[1])]:$E(t).split(",").map(h0)):Et._CE&&zE.test(t)?Et._CE("",t):i},L0=function(t){return function(e){return 1-t(1-e)}},P0=function r(t,e){for(var i=t._first,s;i;)i instanceof Se?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},bs=function(t,e){return t&&(Yt(t)?t:Et[t]||QE(t))||e},xs=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 Re(t,function(a){Et[a]=Be[a]=n,Et[o=a.toLowerCase()]=i;for(var h in n)Et[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=Et[a+"."+h]=n[h]}),n},G0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Bu=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/_u*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*CE((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:G0(a);return n=_u/n,h.config=function(l,c){return r(t,l,c)},h},Wu=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)}:G0(i);return s.config=function(n){return r(t,n)},s};Re("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;xs(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})}),Et.Linear.easeNone=Et.none=Et.Linear.easeIn,xs("Elastic",Bu("in"),Bu("out"),Bu()),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};xs("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),xs("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),xs("Circ",function(r){return-(Jg(1-r*r)-1)}),xs("Sine",function(r){return r===1?1:-EE(r*TE)+1}),xs("Back",Wu("in"),Wu("out"),Wu()),Et.SteppedEase=Et.steps=Be.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-Dt;return function(a){return((s*mo(0,o,a)|0)+n)*i}}},ln.ease=Et["quad.out"],Re("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Lu+=r+","+r+"Params,"});var N0=function(t,e){this.id=SE++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:o0,this.set=e?e.getSetter:Hu},_o=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,fn(this,+e.duration,1,1),this.data=e.data,Bt&&(this._ctx=Bt,Bt.data.push(this)),xo||Xe.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,fn(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(mn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(vh(this,i),!n._dp||n.parent||f0(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)&&Fi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Dt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),a0(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+d0(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.rawTime()>0?1:0},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+d0(this),s):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?dn(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-Dt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?xh(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Dt?0:this._rts,this.totalTime(mo(-Math.abs(this._delay),this._tDur,n),s!==!1),_h(this),GE(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):(mn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Dt&&(this._tTime-=Dt)))),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)&&Fi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(Ae(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?xh(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=RE);var s=ge;return ge=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ge=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,g0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,g0(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(Qe(this,i),Ae(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,Ae(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?-Dt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Dt,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)-Dt)},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=Yt(i)?i:l0,a=function(){var l=s.then;s.then=null,Yt(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(){yo(this)},r}();$e(_o.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:-Dt,_prom:0,_ps:!1,_rts:1});var Se=function(r){jg(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=Ae(i.sortChildren),Vt&&Fi(i.parent||Vt,nr(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&p0(nr(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return po(0,arguments,this),this},e.from=function(s,n,o){return po(1,arguments,this),this},e.fromTo=function(s,n,o,a){return po(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,fo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new qt(s,n,Qe(this,o),1),this},e.call=function(s,n,o){return Fi(this,qt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,c){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=c,o.parent=this,new qt(s,o,Qe(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,fo(o).immediateRender=Ae(o.immediateRender),this.staggerTo(s,n,o,a,h,l,c)},e.staggerFromTo=function(s,n,o,a,h,l,c,u){return a.startAt=o,fo(a).immediateRender=Ae(a.immediateRender),this.staggerTo(s,n,a,h,l,c,u)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=s<=0?0:le(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,m,p,g,y,x,b,v,T,S,C;if(this!==Vt&&c>h&&s>=0&&(c=h),c!==this._tTime||o||u){if(a!==this._time&&l&&(c+=this._time-a,s+=this._time-a),d=c,v=this._start,b=this._ts,y=!b,u&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(S=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=le(c%g),c===h?(p=this._repeat,d=l):(p=~~(c/g),p&&p===c/g&&(d=l,p--),d>l&&(d=l)),T=dn(this._tTime,g),!a&&this._tTime&&T!==p&&this._tTime-T*g-this._dur<=0&&(T=p),S&&p&1&&(d=l-d,C=1),p!==T&&!this._lock){var I=S&&T&1,R=I===(S&&p&1);if(p<T&&(I=!I),a=I?0:c%l?l:c,this._lock=1,this.render(a||(C?0:le(p*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Ue(this,"onRepeat"),this.vars.repeatRefresh&&!C&&(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,R&&(this._lock=2,a=I?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;P0(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=kE(this,le(a),le(d)),x&&(c-=d-(d=x._start))),this._tTime=c,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!p&&(Ue(this,"onStart"),this._tTime!==c))return this;if(d>=a&&s>=0)for(f=this._first;f;){if(m=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,o),d!==this._time||!this._ts&&!y){x=0,m&&(c+=this._zTime=-Dt);break}}f=m}else{f=this._last;for(var P=s<0?s:d;f;){if(m=f._prev,(f._act||P<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(P-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(P-f._start)*f._ts,n,o||ge&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){x=0,m&&(c+=this._zTime=P?-Dt:Dt);break}}f=m}}if(x&&!n&&(this.pause(),x.render(d>=a?0:-Dt)._zTime=d>=a?1:-1,this._ts))return this._start=v,_h(this),this.render(s,n,o);this._onUpdate&&!n&&Ue(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&Dr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(Ue(this,c===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(or(n)||(n=Qe(this,n,s)),!(s instanceof _o)){if(ye(s))return s.forEach(function(a){return o.add(a,n)}),this;if(he(s))return this.addLabel(s,n);if(Yt(s))s=qt.delayedCall(0,s);else return this}return this!==s?Fi(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=-Je);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof qt?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 he(s)?this.removeLabel(s):Yt(s)?this.killTweensOf(s):(bh(this,s),s===this._recent&&(this._recent=this._last),ys(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=le(Xe.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]=Qe(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=qt.delayedCall(0,n||uo,o);return a.data="isPause",this._hasPause=1,Fi(this,a,Qe(this,s))},e.removePause=function(s){var n=this._first;for(s=Qe(this,s);n;)n._start===s&&n.data==="isPause"&&Dr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Br!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=qe(s),h=this._first,l=or(n),c;h;)h instanceof qt?ME(h._targets,a)&&(l?(!Br||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(c=h.getTweensOf(a,n)).length&&o.push.apply(o,c),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=Qe(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,m=qt.to(o,$e({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())||Dt,onStart:function(){if(o.pause(),!f){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&fn(m,g,0,1).render(m._time,!0,!0),f=1}c&&c.apply(m,u||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,$e({startAt:{time:Qe(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),S0(this,Qe(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),S0(this,Qe(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Dt)},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 ys(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={}),ys(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=Je,l,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(u=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Fi(o,a,c-a._delay,1)._lock=0):h=c,c<0&&a._ts&&(n-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;fn(o,o===Vt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Vt._ts&&(a0(Vt,xh(s,Vt)),s0=Xe.frame),Xe.frame>=n0){n0+=Oe.autoSleep||120;var n=Vt._first;if((!n||!n._ts)&&Oe.autoSleep&&Xe._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||Xe.sleep()}}},t}(_o);$e(Se.prototype,{_lock:0,_hasPause:0,_forcing:0});var qE=function(t,e,i,s,n,o,a){var h=new Me(this._pt,t,e,0,1,W0,null,n),l=0,c=0,u,d,f,m,p,g,y,x;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=go(s)),o&&(x=[i,s],o(x,t,e),i=x[0],s=x[1]),d=i.match(Su)||[];u=Su.exec(s);)m=u[0],p=s.substring(l,u.index),f?f=(f+1)%5:p.substr(-5)==="rgba("&&(f=1),m!==d[c++]&&(g=parseFloat(d[c-1])||0,h._pt={_next:h._pt,p:p||c===1?p:",",s:g,c:m.charAt(1)==="="?un(g,m)-g:parseFloat(m)-g,m:f&&f<4?Math.round:0},l=Su.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(qg.test(s)||y)&&(h.e=0),this._pt=h,h},Uu=function(t,e,i,s,n,o,a,h,l,c){Yt(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Yt(u)?l?t[e.indexOf("set")||!Yt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Yt(u)?l?sC:O0:Vu,m;if(he(s)&&(~s.indexOf("random(")&&(s=go(s)),s.charAt(1)==="="&&(m=un(d,s)+(be(d)||0),(m||m===0)&&(s=m))),!c||d!==s||Xu)return!isNaN(d*s)&&s!==""?(m=new Me(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?oC:B0,0,f),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!u&&!(e in t)&&Iu(e,s),qE.call(this,t,e,d,s,f,h||Oe.stringFilter,l))},tC=function(t,e,i,s,n){if(Yt(t)&&(t=vo(t,n,e,i,s)),!Gi(t)||t.style&&t.nodeType||ye(t)||$g(t))return he(t)?vo(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=vo(t[a],n,e,i,s);return o},F0=function(t,e,i,s,n,o){var a,h,l,c;if(We[t]&&(a=new We[t]).init(n,a.rawVars?e[t]:tC(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new Me(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==pn))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Br,Xu,Zu=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,c=s.runBackwards,u=s.yoyoEase,d=s.keyframes,f=s.autoRevert,m=t._dur,p=t._startAt,g=t._targets,y=t.parent,x=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!xu,v=t.timeline,T,S,C,I,R,P,N,F,A,k,Z,K,H;if(v&&(!d||!n)&&(n="none"),t._ease=bs(n,ln.ease),t._yEase=u?L0(bs(u===!0?n:u,ln.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!v&&!!s.runBackwards,!v||d&&!s.stagger){if(F=g[0]?ms(g[0]).harness:0,K=F&&s[F.prop],T=yh(s,Au),p&&(p._zTime<0&&p.progress(1),e<0&&c&&a&&!f?p.render(-1,!0):p.revert(c&&m?ph:AE),p._lazy=0),o){if(Dr(t._startAt=qt.set(g,$e({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!p&&Ae(h),startAt:null,delay:0,onUpdate:l&&function(){return Ue(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge||!a&&!f)&&t._startAt.revert(ph),a&&m&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&m&&!p){if(e&&(a=!1),C=$e({overwrite:!1,data:"isFromStart",lazy:a&&!p&&Ae(h),immediateRender:a,stagger:0,parent:y},T),K&&(C[F.prop]=K),Dr(t._startAt=qt.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge?t._startAt.revert(ph):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Dt,Dt);else if(!e)return}for(t._pt=t._ptCache=0,h=m&&Ae(h)||h&&!m,S=0;S<g.length;S++){if(R=g[S],N=R._gsap||Pu(g)[S]._gsap,t._ptLookup[S]=k={},Ru[N.id]&&Fr.length&&gh(),Z=x===g?S:x.indexOf(R),F&&(A=new F).init(R,K||T,t,Z,x)!==!1&&(t._pt=I=new Me(t._pt,R,A.name,0,1,A.render,A,0,A.priority),A._props.forEach(function(J){k[J]=I}),A.priority&&(P=1)),!F||K)for(C in T)We[C]&&(A=F0(C,T,t,Z,R,x))?A.priority&&(P=1):k[C]=I=Uu.call(t,R,C,"get",T[C],Z,x,0,s.stringFilter);t._op&&t._op[S]&&t.kill(R,t._op[S]),b&&t._pt&&(Br=t,Vt.killTweensOf(R,k,t.globalTime(e)),H=!t.parent,Br=0),t._pt&&h&&(Ru[N.id]=1)}P&&U0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!H,d&&e<=0&&v.render(Je,!0,!0)},eC=function(t,e,i,s,n,o,a,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,u,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(c=d[f][e],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==e&&c.fp!==e;)c=c._next;if(!c)return Xu=1,t.vars[e]="+=0",Zu(t,a),Xu=0,h?co(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)u=l[f],c=u._pt||u,c.s=(s||s===0)&&!n?s:c.s+(s||0)+o*c.c,c.c=i-c.s,u.e&&(u.e=jt(i)+be(u.e)),u.b&&(u.b=c.s+be(u.b))},iC=function(t,e){var i=t[0]?ms(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=gs({},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},rC=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(ye(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})},vo=function(t,e,i,s,n){return Yt(t)?t.call(e,i,s,n):he(t)&&~t.indexOf("random(")?go(t):t},D0=Lu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",k0={};Re(D0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return k0[r]=1});var qt=function(r){jg(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:fo(s))||this;var h=a.vars,l=h.duration,c=h.delay,u=h.immediateRender,d=h.stagger,f=h.overwrite,m=h.keyframes,p=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,x=s.parent||Vt,b=(ye(i)||$g(i)?or(i[0]):"length"in s)?[i]:qe(i),v,T,S,C,I,R,P,N;if(a._targets=b.length?Pu(b):co("GSAP target "+i+" not found. https://gsap.com",!Oe.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,m||d||dh(l)||dh(c)){if(s=a.vars,v=a.timeline=new Se({data:"nested",defaults:p||{},targets:x&&x.data==="nested"?x.vars.targets:b}),v.kill(),v.parent=v._dp=nr(a),v._start=0,d||dh(l)||dh(c)){if(C=b.length,P=d&&x0(d),Gi(d))for(I in d)~D0.indexOf(I)&&(N||(N={}),N[I]=d[I]);for(T=0;T<C;T++)S=yh(s,k0),S.stagger=0,y&&(S.yoyoEase=y),N&&gs(S,N),R=b[T],S.duration=+vo(l,nr(a),T,R,b),S.delay=(+vo(c,nr(a),T,R,b)||0)-a._delay,!d&&C===1&&S.delay&&(a._delay=c=S.delay,a._start+=c,S.delay=0),v.to(R,S,P?P(T,R,b):0),v._ease=Et.none;v.duration()?l=c=0:a.timeline=0}else if(m){fo($e(v.vars.defaults,{ease:"none"})),v._ease=bs(m.ease||s.ease||"none");var F=0,A,k,Z;if(ye(m))m.forEach(function(K){return v.to(b,K,">")}),v.duration();else{S={};for(I in m)I==="ease"||I==="easeEach"||rC(I,m[I],S,m.easeEach);for(I in S)for(A=S[I].sort(function(K,H){return K.t-H.t}),F=0,T=0;T<A.length;T++)k=A[T],Z={ease:k.e,duration:(k.t-(T?A[T-1].t:0))/100*l},Z[I]=k.v,v.to(b,Z,F),F+=Z.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return f===!0&&!xu&&(Br=nr(a),Vt.killTweensOf(b),Br=0),Fi(x,nr(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!m&&a._start===le(x._time)&&Ae(u)&&NE(nr(a))&&x.data!=="nested")&&(a._tTime=-Dt,a.render(Math.max(0,-c)||0)),g&&p0(nr(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,c=s<0,u=s>h-Dt&&!c?h:s<Dt?0:s,d,f,m,p,g,y,x,b,v;if(!l)DE(this,s,n,o);else if(u!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(d=u,b=this.timeline,this._repeat){if(p=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(p*100+s,n,o);if(d=le(u%p),u===h?(m=this._repeat,d=l):(m=~~(u/p),m&&m===le(u/p)&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=dn(this._tTime,p),d===a&&!o&&this._initted&&m===g)return this._tTime=u,this;m!==g&&(b&&this._yEase&&P0(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==p&&this._initted&&(this._lock=o=1,this.render(le(p*m),!0).invalidate()._lock=0))}if(!this._initted){if(m0(this,c?s:d,o,n,u))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=u,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!a&&!n&&!m&&(Ue(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;b&&b.render(s<0?s:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(c&&Gu(this,s,n,o),Ue(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&Ue(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&Gu(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&Dr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(Ue(this,u===h?"onComplete":"onReverseComplete",!0),this._prom&&!(u<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){xo||Xe.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Zu(this,l),c=this._ease(l/this._dur),eC(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(vh(this,0),this.parent||u0(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?yo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Br&&Br.vars.overwrite!==!0)._first||yo(this),this.parent&&o!==this.timeline.totalDuration()&&fn(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?qe(s):a,l=this._ptLookup,c=this._pt,u,d,f,m,p,g,y;if((!n||n==="all")&&PE(a,h))return n==="all"&&(this._pt=0),yo(this);for(u=this._op=this._op||[],n!=="all"&&(he(n)&&(p={},Re(n,function(x){return p[x]=1}),n=p),n=iC(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(u[y]=n,m=d,f={}):(f=u[y]=u[y]||{},m=n);for(p in m)g=d&&d[p],g&&((!("kill"in g.d)||g.d.kill(p)===!0)&&bh(this,g,"_pt"),delete d[p]),f!=="all"&&(f[p]=1)}return this._initted&&!this._pt&&c&&yo(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return po(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 po(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 Vt.killTweensOf(s,n,o)},t}(_o);$e(qt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Re("staggerTo,staggerFrom,staggerFromTo",function(r){qt[r]=function(){var t=new Se,e=Fu.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Vu=function(t,e,i){return t[e]=i},O0=function(t,e,i){return t[e](i)},sC=function(t,e,i,s){return t[e](s.fp,i)},nC=function(t,e,i){return t.setAttribute(e,i)},Hu=function(t,e){return Yt(t[e])?O0:vu(t[e])&&t.setAttribute?nC:Vu},B0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},oC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},W0=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)},Ku=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},aC=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},hC=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?bh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},lC=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},U0=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},Me=function(){function r(e,i,s,n,o,a,h,l,c){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||B0,this.d=h||this,this.set=l||Vu,this.pr=c||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=lC,this.m=i,this.mt=n,this.tween=s},r}();Re(Lu+"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 Au[r]=1}),Be.TweenMax=Be.TweenLite=qt,Be.TimelineLite=Be.TimelineMax=Se,Vt=new Se({sortChildren:!1,defaults:ln,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=M0;var _s=[],wh={},cC=[],X0=0,uC=0,Yu=function(t){return(wh[t]||cC).map(function(e){return e()})},zu=function(){var t=Date.now(),e=[];t-X0>2&&(Yu("matchMediaInit"),_s.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Ni.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Yu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),X0=t,Yu("matchMedia"))},Z0=function(){function r(e,i){this.selector=i&&Du(i),this.data=[],this._r=[],this.isReverted=!1,this.id=uC++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Yt(i)&&(n=s,s=i,i=Yt);var o=this,a=function(){var l=Bt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=Du(n)),Bt=o,u=s.apply(o,arguments),Yt(u)&&o._r.push(u),Bt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Yt?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Bt;Bt=null,i(this),Bt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof qt&&!(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(c){return a.splice(a.indexOf(c),1)}));for(a.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,u){return u.g-c.g||-1/0}).forEach(function(c){return c.t.revert(i)}),h=n.data.length;h--;)l=n.data[h],l instanceof Se?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof qt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=_s.length;o--;)_s[o].id===this.id&&_s.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),dC=function(){function r(e){this.contexts=[],this.scope=e,Bt&&Bt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Gi(i)||(i={matches:i});var o=new Z0(0,n||this.scope),a=o.conditions={},h,l,c;Bt&&!o.selector&&(o.selector=Bt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Ni.matchMedia(i[l]),h&&(_s.indexOf(o)<0&&_s.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(zu):h.addEventListener("change",zu)));return c&&s(o,function(u){return o.add(null,u)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),Th={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 C0(s)})},timeline:function(t){return new Se(t)},getTweensOf:function(t,e){return Vt.getTweensOf(t,e)},getProperty:function(t,e,i,s){he(t)&&(t=qe(t)[0]);var n=ms(t||{}).get,o=i?l0:h0;return i==="native"&&(i=""),t&&(e?o((We[e]&&We[e].get||n)(t,e,i,s)):function(a,h,l){return o((We[a]&&We[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=qe(t),t.length>1){var s=t.map(function(c){return Le.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=We[e],a=ms(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;pn._pt=0,u.init(t,i?c+i:c,pn,0,[t]),u.render(1,u),pn._pt&&Ku(1,pn)}:a.set(t,h);return o?l:function(c){return l(t,h,i?c+i:c,a,1)}},quickTo:function(t,e,i){var s,n=Le.to(t,gs((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,c){return n.resetTo(e,h,l,c)};return o.tween=n,o},isTweening:function(t){return Vt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=bs(t.ease,ln.ease)),c0(ln,t||{})},config:function(t){return c0(Oe,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&&!We[a]&&!Be[a]&&co(e+" effect requires "+a+" plugin.")}),Mu[e]=function(a,h,l){return i(qe(a),$e(h||{},n),l)},o&&(Se.prototype[e]=function(a,h,l){return this.add(Mu[e](a,Gi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){Et[t]=bs(e)},parseEase:function(t,e){return arguments.length?bs(t,e):Et},getById:function(t){return Vt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Se(t),s,n;for(i.smoothChildTiming=Ae(t.smoothChildTiming),Vt.remove(i),i._dp=0,i._time=i._tTime=Vt._time,s=Vt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof qt&&s.vars.onComplete===s._targets[0]))&&Fi(i,s,s._start-s._delay),s=n;return Fi(Vt,i,0),i},context:function(t,e){return t?new Z0(t,e):Bt},matchMedia:function(t){return new dC(t)},matchMediaRefresh:function(){return _s.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||zu()},addEventListener:function(t,e){var i=wh[t]||(wh[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=wh[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:VE,wrapYoyo:HE,distribute:x0,random:v0,snap:_0,normalize:ZE,getUnit:be,clamp:BE,splitColor:I0,toArray:qe,selector:Du,mapRange:T0,pipe:UE,unitize:XE,interpolate:KE,shuffle:b0},install:i0,effects:Mu,ticker:Xe,updateRoot:Se.updateRoot,plugins:We,globalTimeline:Vt,core:{PropTween:Me,globals:r0,Tween:qt,Timeline:Se,Animation:_o,getCache:ms,_removeLinkedListItem:bh,reverting:function(){return ge},context:function(t){return t&&Bt&&(Bt.data.push(t),t._ctx=Bt),Bt},suppressOverwrites:function(t){return xu=t}}};Re("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return Th[r]=qt[r]}),Xe.add(Se.updateRoot),pn=Th.to({},{duration:0});var fC=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},pC=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=fC(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},ju=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(he(n)&&(h={},Re(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}pC(a,n)}}}},Le=Th.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;)ge?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)}},ju("roundProps",ku),ju("modifiers"),ju("snap",_0))||Th;qt.version=Se.version=Le.version="3.12.5",e0=1,wu()&&mn(),Et.Power0,Et.Power1,Et.Power2,Et.Power3,Et.Power4,Et.Linear,Et.Quad,Et.Cubic,Et.Quart,Et.Quint,Et.Strong,Et.Elastic,Et.Back,Et.SteppedEase,Et.Bounce,Et.Sine,Et.Expo,Et.Circ;/*!
1167
+ */var Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},dn={duration:.5,overwrite:!1,delay:0},xu,ge,Bt,je=1e8,Nt=1/je,_u=Math.PI*2,TE=_u/4,SE=0,Jg=Math.sqrt,EE=Math.cos,CE=Math.sin,le=function(t){return typeof t=="string"},Yt=function(t){return typeof t=="function"},or=function(t){return typeof t=="number"},vu=function(t){return typeof t>"u"},Gi=function(t){return typeof t=="object"},Ae=function(t){return t!==!1},wu=function(){return typeof window<"u"},fh=function(t){return Yt(t)||le(t)},$g=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ye=Array.isArray,Tu=/(?:-?\.?\d|\.)+/gi,Qg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,fn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Su=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,qg=/[+-]=-?[.\d]+/,t0=/[^,'"\[\]\s]+/gi,IE=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Vt,Fi,Eu,Cu,Be={},ph={},e0,i0=function(t){return(ph=ys(t,Be))&&Le},Iu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},uo=function(t,e){return!e&&console.warn(t)},r0=function(t,e){return t&&(Be[t]=e)&&ph&&(ph[t]=e)||Be},fo=function(){return 0},AE={suppressEvents:!0,isStart:!0,kill:!1},mh={suppressEvents:!0,kill:!1},RE={suppressEvents:!0},Au={},Nr=[],Ru={},s0,Ue={},Mu={},n0=30,gh=[],Lu="",Pu=function(t){var e=t[0],i,s;if(Gi(e)||Yt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=gh.length;s--&&!gh[s].targetTest(e););i=gh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new F0(t[s],i)))||t.splice(s,1);return t},gs=function(t){return t._gsap||Pu(Qe(t))[0]._gsap},o0=function(t,e,i){return(i=t[e])&&Yt(i)?t[e]():vu(i)&&t.getAttribute&&t.getAttribute(e)||i},Re=function(t,e){return(t=t.split(",")).forEach(e)||t},jt=function(t){return Math.round(t*1e5)/1e5||0},ce=function(t){return Math.round(t*1e7)/1e7||0},pn=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},ME=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},yh=function(){var t=Nr.length,e=Nr.slice(0),i,s;for(Ru={},Nr.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},a0=function(t,e,i,s){Nr.length&&!ge&&yh(),t.render(e,i,s||ge&&e<0&&(t._initted||t._startAt)),Nr.length&&!ge&&yh()},h0=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(t0).length<2?e:le(t)?t.trim():t},l0=function(t){return t},Je=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},LE=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},ys=function(t,e){for(var i in e)t[i]=e[i];return t},c0=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Gi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},bh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},po=function(t){var e=t.parent||Vt,i=t.keyframes?LE(ye(t.keyframes)):Je;if(Ae(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},PE=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},u0=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},xh=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},Dr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},bs=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},GE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Gu=function(t,e,i,s){return t._startAt&&(ge?t._startAt.revert(mh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},FE=function r(t){return!t||t._ts&&r(t.parent)},d0=function(t){return t._repeat?mn(t._tTime,t=t.duration()+t._rDelay)*t:0},mn=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},_h=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},vh=function(t){return t._end=ce(t._start+(t._tDur/Math.abs(t._ts||t._rts||Nt)||0))},wh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=ce(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),vh(t),i._dirty||bs(i,t)),t},f0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=_h(t.rawTime(),e),(!e._dur||go(0,e.totalDuration(),i)-e._tTime>Nt)&&e.render(i,!0)),bs(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=-Nt}},Ni=function(t,e,i,s){return e.parent&&Dr(e),e._start=ce((or(i)?i:i||t!==Vt?$e(t,i,e):t._time)+e._delay),e._end=ce(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),u0(t,e,"_first","_last",t._sort?"_start":0),Fu(e)||(t._recent=e),s||f0(t,e),t._ts<0&&wh(t,t._tTime),t},p0=function(t,e){return(Be.ScrollTrigger||Iu("scrollTrigger",e))&&Be.ScrollTrigger.create(e,t)},m0=function(t,e,i,s,n){if(Zu(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ge&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&s0!==Xe.frame)return Nr.push(t),t._lazy=[n,s],1},NE=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Fu=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},DE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&NE(t)&&!(!t._initted&&Fu(t))||(t._ts<0||t._dp._ts<0)&&!Fu(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=go(0,t._tDur,e),c=mn(h,a),t._yoyo&&c&1&&(o=1-o),c!==mn(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ge||s||t._zTime===Nt||!e&&t._zTime){if(!t._initted&&m0(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Nt:0),i||(i=e&&!u),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&&Gu(t,e,i,!0),t._onUpdate&&!i&&We(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&We(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Dr(t,1),!i&&!ge&&(We(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},kE=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}},gn=function(t,e,i,s){var n=t._repeat,o=ce(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:ce(o*(n+1)+t._rDelay*n):o,a>0&&!s&&wh(t,t._tTime=t._tDur*a),t.parent&&vh(t),i||bs(t.parent,t),t},g0=function(t){return t instanceof Se?bs(t):gn(t,t._dur)},OE={_start:0,endTime:fo,totalDuration:fo},$e=function r(t,e,i){var s=t.labels,n=t._recent||OE,o=t.duration()>=je?n.endTime(!1):t._dur,a,h,l;return le(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*(ye(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},mo=function(t,e,i){var s=or(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=Ae(h.vars.inherit)&&h.parent;o.immediateRender=Ae(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new qt(e[0],o,e[n+1])},kr=function(t,e){return t||t===0?e(t):e},go=function(t,e,i){return i<t?t:i>e?e:i},be=function(t,e){return!le(t)||!(e=IE.exec(t))?"":e[1]},BE=function(t,e,i){return kr(i,function(s){return go(t,e,s)})},Nu=[].slice,y0=function(t,e){return t&&Gi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Gi(t[0]))&&!t.nodeType&&t!==Fi},UE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return le(s)&&!e||y0(s,1)?(n=i).push.apply(n,Qe(s)):i.push(s)})||i},Qe=function(t,e,i){return Bt&&!e&&Bt.selector?Bt.selector(t):le(t)&&!i&&(Eu||!bn())?Nu.call((e||Cu).querySelectorAll(t),0):ye(t)?UE(t,i):y0(t)?Nu.call(t,0):t?[t]:[]},Du=function(t){return t=Qe(t)[0]||uo("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Qe(e,i.querySelectorAll?i:i===t?uo("Invalid scope")||Cu.createElement("div"):t)}},b0=function(t){return t.sort(function(){return .5-Math.random()})},x0=function(t){if(Yt(t))return t;var e=Gi(t)?t:{each:t},i=xs(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,c=s,u=s;return le(s)?c=u={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(c=s[0],u=s[1]),function(d,f,p){var m=(p||e).length,g=o[m],y,x,b,v,w,S,C,I,R;if(!g){if(R=e.grid==="auto"?0:(e.grid||[1,je])[1],!R){for(C=-je;C<(C=p[R++].getBoundingClientRect().left)&&R<m;);R<m&&R--}for(g=o[m]=[],y=h?Math.min(R,m)*c-.5:s%R,x=R===je?0:h?m*u/R-.5:s/R|0,C=0,I=je,S=0;S<m;S++)b=S%R-y,v=x-(S/R|0),g[S]=w=l?Math.abs(l==="y"?v:b):Jg(b*b+v*v),w>C&&(C=w),w<I&&(I=w);s==="random"&&b0(g),g.max=C-I,g.min=I,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(R>m?m-1:l?l==="y"?m/R:R:Math.max(R,m/R))||0)*(s==="edges"?-1:1),g.b=m<0?n-m:n,g.u=be(e.amount||e.each)||0,i=i&&m<0?L0(i):i}return m=(g[d]-g.min)/g.max||0,ce(g.b+(i?i(m):m)*g.v)+g.u}},ku=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=ce(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(or(i)?0:be(i))}},_0=function(t,e){var i=ye(t),s,n;return!i&&Gi(t)&&(s=i=t.radius||je,t.values?(t=Qe(t.values),(n=!or(t[0]))&&(s*=s)):t=ku(t.increment)),kr(e,i?Yt(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=je,c=0,u=t.length,d,f;u--;)n?(d=t[u].x-a,f=t[u].y-h,d=d*d+f*f):d=Math.abs(t[u]-a),d<l&&(l=d,c=u);return c=!s||l<=s?t[c]:o,n||c===o||or(o)?c:c+be(o)}:ku(t))},v0=function(t,e,i,s){return kr(ye(t)?!e:i===!0?!!(i=0):!s,function(){return ye(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})},WE=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)}},XE=function(t,e){return function(i){return t(parseFloat(i))+(e||be(i))}},ZE=function(t,e,i){return T0(t,e,0,1,i)},w0=function(t,e,i){return kr(i,function(s){return t[~~e(s)]})},VE=function r(t,e,i){var s=e-t;return ye(t)?w0(t,r(0,t.length),e):kr(i,function(n){return(s+(n-t)%s)%s+t})},HE=function r(t,e,i){var s=e-t,n=s*2;return ye(t)?w0(t,r(0,t.length-1),e):kr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},yo=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?t0:Tu),i+=t.substr(e,s-e)+v0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},T0=function(t,e,i,s,n){var o=e-t,a=s-i;return kr(n,function(h){return i+((h-t)/o*a||0)})},KE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=le(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(ye(t)&&!ye(e)){for(c=[],u=t.length,d=u-2,l=1;l<u;l++)c.push(r(t[l-1],t[l]));u--,n=function(p){p*=u;var m=Math.min(d,~~p);return c[m](p-m)},i=e}else s||(t=ys(ye(t)?[]:{},t));if(!c){for(h in e)Wu.call(a,t,h,"get",e[h]);n=function(p){return Ku(p,a)||(o?t.p:t)}}}return kr(i,n)},S0=function(t,e,i){var s=t.labels,n=je,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},We=function(t,e,i){var s=t.vars,n=s[e],o=Bt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Nr.length&&yh(),a&&(Bt=a),c=h?n.apply(l,h):n.call(l),Bt=o,c},bo=function(t){return Dr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ge),t.progress()<1&&We(t,"onInterrupt"),t},yn,E0=[],C0=function(t){if(t)if(t=!t.name&&t.default||t,wu()||t.headless){var e=t.name,i=Yt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:fo,render:Ku,add:Wu,kill:hC,modifier:aC,rawVars:0},o={targetTest:0,get:0,getSetter:Hu,aliases:{},register:0};if(bn(),t!==s){if(Ue[e])return;Je(s,Je(bh(t,n),o)),ys(s.prototype,ys(n,bh(t,o))),Ue[s.prop=e]=s,t.targetTest&&(gh.push(s),Au[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}r0(e,s),t.register&&t.register(Le,s,Me)}else E0.push(t)},Gt=255,xo={aqua:[0,Gt,Gt],lime:[0,Gt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Gt],navy:[0,0,128],white:[Gt,Gt,Gt],olive:[128,128,0],yellow:[Gt,Gt,0],orange:[Gt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Gt,0,0],pink:[Gt,192,203],cyan:[0,Gt,Gt],transparent:[Gt,Gt,Gt,0]},Ou=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)*Gt+.5|0},I0=function(t,e,i){var s=t?or(t)?[t>>16,t>>8&Gt,t&Gt]:0:xo.black,n,o,a,h,l,c,u,d,f,p;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),xo[t])s=xo[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&Gt,s&Gt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Gt,t&Gt]}else if(t.substr(0,3)==="hsl"){if(s=p=t.match(Tu),!e)h=+s[0]%360/360,l=+s[1]/100,c=+s[2]/100,o=c<=.5?c*(l+1):c+l-c*l,n=c*2-o,s.length>3&&(s[3]*=1),s[0]=Ou(h+1/3,n,o),s[1]=Ou(h,n,o),s[2]=Ou(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(Qg),i&&s.length<4&&(s[3]=1),s}else s=t.match(Tu)||xo.transparent;s=s.map(Number)}return e&&!p&&(n=s[0]/Gt,o=s[1]/Gt,a=s[2]/Gt,u=Math.max(n,o,a),d=Math.min(n,o,a),c=(u+d)/2,u===d?h=l=0:(f=u-d,l=c>.5?f/(2-u-d):f/(u+d),h=u===n?(o-a)/f+(o<a?6:0):u===o?(a-n)/f+2:(n-o)/f+4,h*=60),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(c*100+.5)),i&&s.length<4&&(s[3]=1),s},A0=function(t){var e=[],i=[],s=-1;return t.split(Or).forEach(function(n){var o=n.match(fn)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},R0=function(t,e,i){var s="",n=(t+s).match(Or),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=I0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=A0(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Or,"1").split(fn),u=l.length-1;a<u;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(c.length?c:n.length?n:i).shift());if(!l)for(l=t.split(Or),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Or=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in xo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),YE=/hsl[a]?\(/,M0=function(t){var e=t.join(" "),i;if(Or.lastIndex=0,Or.test(e))return i=YE.test(e),t[1]=R0(t[1],i),t[0]=R0(t[0],i,A0(t[1])),!0},_o,Xe=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,c,u,d,f,p=function m(g){var y=r()-s,x=g===!0,b,v,w,S;if((y>t||y<0)&&(i+=y-e),s+=y,w=s-i,b=w-o,(b>0||x)&&(S=++u.frame,d=w-u.time*1e3,u.time=w=w/1e3,o+=b+(b>=n?4:n-b),v=1),x||(h=l(m)),v)for(f=0;f<a.length;f++)a[f](w,d,S,g)};return u={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){e0&&(!Eu&&wu()&&(Fi=Eu=window,Cu=Fi.document||{},Be.gsap=Le,(Fi.gsapVersions||(Fi.gsapVersions=[])).push(Le.version),i0(ph||Fi.GreenSockGlobals||!Fi.gsap&&Fi||{}),E0.forEach(C0)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},_o=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),_o=0,l=fo},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=u.time*1e3+n},add:function(g,y,x){var b=y?function(v,w,S,C){g(v,w,S,C),u.remove(b)}:g;return u.remove(g),a[x?"unshift":"push"](b),bn(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),bn=function(){return!_o&&Xe.wake()},St={},zE=/^[\d.\-M][\d.\-,\s]/,jE=/["']/g,JE=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(jE,"").trim():+l,s=h.substr(a+1).trim();return e},$E=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)},QE=function(t){var e=(t+"").split("("),i=St[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[JE(e[1])]:$E(t).split(",").map(h0)):St._CE&&zE.test(t)?St._CE("",t):i},L0=function(t){return function(e){return 1-t(1-e)}},P0=function r(t,e){for(var i=t._first,s;i;)i instanceof Se?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},xs=function(t,e){return t&&(Yt(t)?t:St[t]||QE(t))||e},_s=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 Re(t,function(a){St[a]=Be[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},G0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Bu=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/_u*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*CE((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:G0(a);return n=_u/n,h.config=function(l,c){return r(t,l,c)},h},Uu=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)}:G0(i);return s.config=function(n){return r(t,n)},s};Re("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;_s(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,_s("Elastic",Bu("in"),Bu("out"),Bu()),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};_s("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),_s("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),_s("Circ",function(r){return-(Jg(1-r*r)-1)}),_s("Sine",function(r){return r===1?1:-EE(r*TE)+1}),_s("Back",Uu("in"),Uu("out"),Uu()),St.SteppedEase=St.steps=Be.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-Nt;return function(a){return((s*go(0,o,a)|0)+n)*i}}},dn.ease=St["quad.out"],Re("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Lu+=r+","+r+"Params,"});var F0=function(t,e){this.id=SE++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:o0,this.set=e?e.getSetter:Hu},vo=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,gn(this,+e.duration,1,1),this.data=e.data,Bt&&(this._ctx=Bt,Bt.data.push(this)),_o||Xe.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,gn(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(bn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(wh(this,i),!n._dp||n.parent||f0(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)&&Ni(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Nt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),a0(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+d0(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.rawTime()>0?1:0},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+d0(this),s):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?mn(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-Nt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?_h(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Nt?0:this._rts,this.totalTime(go(-Math.abs(this._delay),this._tDur,n),s!==!1),vh(this),GE(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):(bn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Nt&&(this._tTime-=Nt)))),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)&&Ni(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(Ae(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?_h(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=RE);var s=ge;return ge=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ge=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,g0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,g0(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($e(this,i),Ae(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,Ae(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?-Nt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Nt,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)-Nt)},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=Yt(i)?i:l0,a=function(){var l=s.then;s.then=null,Yt(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(){bo(this)},r}();Je(vo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Nt,_prom:0,_ps:!1,_rts:1});var Se=function(r){jg(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=Ae(i.sortChildren),Vt&&Ni(i.parent||Vt,nr(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&p0(nr(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return mo(0,arguments,this),this},e.from=function(s,n,o){return mo(1,arguments,this),this},e.fromTo=function(s,n,o,a){return mo(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,po(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new qt(s,n,$e(this,o),1),this},e.call=function(s,n,o){return Ni(this,qt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,c){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=c,o.parent=this,new qt(s,o,$e(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,po(o).immediateRender=Ae(o.immediateRender),this.staggerTo(s,n,o,a,h,l,c)},e.staggerFromTo=function(s,n,o,a,h,l,c,u){return a.startAt=o,po(a).immediateRender=Ae(a.immediateRender),this.staggerTo(s,n,a,h,l,c,u)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=s<=0?0:ce(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,p,m,g,y,x,b,v,w,S,C;if(this!==Vt&&c>h&&s>=0&&(c=h),c!==this._tTime||o||u){if(a!==this._time&&l&&(c+=this._time-a,s+=this._time-a),d=c,v=this._start,b=this._ts,y=!b,u&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(S=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=ce(c%g),c===h?(m=this._repeat,d=l):(m=~~(c/g),m&&m===c/g&&(d=l,m--),d>l&&(d=l)),w=mn(this._tTime,g),!a&&this._tTime&&w!==m&&this._tTime-w*g-this._dur<=0&&(w=m),S&&m&1&&(d=l-d,C=1),m!==w&&!this._lock){var I=S&&w&1,R=I===(S&&m&1);if(m<w&&(I=!I),a=I?0:c%l?l:c,this._lock=1,this.render(a||(C?0:ce(m*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&We(this,"onRepeat"),this.vars.repeatRefresh&&!C&&(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,R&&(this._lock=2,a=I?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;P0(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=kE(this,ce(a),ce(d)),x&&(c-=d-(d=x._start))),this._tTime=c,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!m&&(We(this,"onStart"),this._tTime!==c))return this;if(d>=a&&s>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,o),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=-Nt);break}}f=p}else{f=this._last;for(var P=s<0?s:d;f;){if(p=f._prev,(f._act||P<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(P-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(P-f._start)*f._ts,n,o||ge&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=P?-Nt:Nt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=a?0:-Nt)._zTime=d>=a?1:-1,this._ts))return this._start=v,vh(this),this.render(s,n,o);this._onUpdate&&!n&&We(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&Dr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(We(this,c===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(or(n)||(n=$e(this,n,s)),!(s instanceof vo)){if(ye(s))return s.forEach(function(a){return o.add(a,n)}),this;if(le(s))return this.addLabel(s,n);if(Yt(s))s=qt.delayedCall(0,s);else return this}return this!==s?Ni(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=-je);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof qt?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 le(s)?this.removeLabel(s):Yt(s)?this.killTweensOf(s):(xh(this,s),s===this._recent&&(this._recent=this._last),bs(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ce(Xe.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]=$e(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=qt.delayedCall(0,n||fo,o);return a.data="isPause",this._hasPause=1,Ni(this,a,$e(this,s))},e.removePause=function(s){var n=this._first;for(s=$e(this,s);n;)n._start===s&&n.data==="isPause"&&Dr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Br!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=Qe(s),h=this._first,l=or(n),c;h;)h instanceof qt?ME(h._targets,a)&&(l?(!Br||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(c=h.getTweensOf(a,n)).length&&o.push.apply(o,c),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=$e(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,p=qt.to(o,Je({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())||Nt,onStart:function(){if(o.pause(),!f){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());p._dur!==g&&gn(p,g,0,1).render(p._time,!0,!0),f=1}c&&c.apply(p,u||[])}},n));return d?p.render(0):p},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Je({startAt:{time:$e(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),S0(this,$e(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),S0(this,$e(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Nt)},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 bs(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={}),bs(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=je,l,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(u=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ni(o,a,c-a._delay,1)._lock=0):h=c,c<0&&a._ts&&(n-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;gn(o,o===Vt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Vt._ts&&(a0(Vt,_h(s,Vt)),s0=Xe.frame),Xe.frame>=n0){n0+=Oe.autoSleep||120;var n=Vt._first;if((!n||!n._ts)&&Oe.autoSleep&&Xe._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||Xe.sleep()}}},t}(vo);Je(Se.prototype,{_lock:0,_hasPause:0,_forcing:0});var qE=function(t,e,i,s,n,o,a){var h=new Me(this._pt,t,e,0,1,U0,null,n),l=0,c=0,u,d,f,p,m,g,y,x;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=yo(s)),o&&(x=[i,s],o(x,t,e),i=x[0],s=x[1]),d=i.match(Su)||[];u=Su.exec(s);)p=u[0],m=s.substring(l,u.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[c++]&&(g=parseFloat(d[c-1])||0,h._pt={_next:h._pt,p:m||c===1?m:",",s:g,c:p.charAt(1)==="="?pn(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Su.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(qg.test(s)||y)&&(h.e=0),this._pt=h,h},Wu=function(t,e,i,s,n,o,a,h,l,c){Yt(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Yt(u)?l?t[e.indexOf("set")||!Yt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Yt(u)?l?sC:O0:Vu,p;if(le(s)&&(~s.indexOf("random(")&&(s=yo(s)),s.charAt(1)==="="&&(p=pn(d,s)+(be(d)||0),(p||p===0)&&(s=p))),!c||d!==s||Xu)return!isNaN(d*s)&&s!==""?(p=new Me(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?oC:B0,0,f),l&&(p.fp=l),a&&p.modifier(a,this,t),this._pt=p):(!u&&!(e in t)&&Iu(e,s),qE.call(this,t,e,d,s,f,h||Oe.stringFilter,l))},tC=function(t,e,i,s,n){if(Yt(t)&&(t=wo(t,n,e,i,s)),!Gi(t)||t.style&&t.nodeType||ye(t)||$g(t))return le(t)?wo(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=wo(t[a],n,e,i,s);return o},N0=function(t,e,i,s,n,o){var a,h,l,c;if(Ue[t]&&(a=new Ue[t]).init(n,a.rawVars?e[t]:tC(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new Me(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==yn))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Br,Xu,Zu=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,c=s.runBackwards,u=s.yoyoEase,d=s.keyframes,f=s.autoRevert,p=t._dur,m=t._startAt,g=t._targets,y=t.parent,x=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!xu,v=t.timeline,w,S,C,I,R,P,G,N,A,k,V,K,H;if(v&&(!d||!n)&&(n="none"),t._ease=xs(n,dn.ease),t._yEase=u?L0(xs(u===!0?n:u,dn.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!v&&!!s.runBackwards,!v||d&&!s.stagger){if(N=g[0]?gs(g[0]).harness:0,K=N&&s[N.prop],w=bh(s,Au),m&&(m._zTime<0&&m.progress(1),e<0&&c&&a&&!f?m.render(-1,!0):m.revert(c&&p?mh:AE),m._lazy=0),o){if(Dr(t._startAt=qt.set(g,Je({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&Ae(h),startAt:null,delay:0,onUpdate:l&&function(){return We(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge||!a&&!f)&&t._startAt.revert(mh),a&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(a=!1),C=Je({overwrite:!1,data:"isFromStart",lazy:a&&!m&&Ae(h),immediateRender:a,stagger:0,parent:y},w),K&&(C[N.prop]=K),Dr(t._startAt=qt.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge?t._startAt.revert(mh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Nt,Nt);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&Ae(h)||h&&!p,S=0;S<g.length;S++){if(R=g[S],G=R._gsap||Pu(g)[S]._gsap,t._ptLookup[S]=k={},Ru[G.id]&&Nr.length&&yh(),V=x===g?S:x.indexOf(R),N&&(A=new N).init(R,K||w,t,V,x)!==!1&&(t._pt=I=new Me(t._pt,R,A.name,0,1,A.render,A,0,A.priority),A._props.forEach(function($){k[$]=I}),A.priority&&(P=1)),!N||K)for(C in w)Ue[C]&&(A=N0(C,w,t,V,R,x))?A.priority&&(P=1):k[C]=I=Wu.call(t,R,C,"get",w[C],V,x,0,s.stringFilter);t._op&&t._op[S]&&t.kill(R,t._op[S]),b&&t._pt&&(Br=t,Vt.killTweensOf(R,k,t.globalTime(e)),H=!t.parent,Br=0),t._pt&&h&&(Ru[G.id]=1)}P&&W0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!H,d&&e<=0&&v.render(je,!0,!0)},eC=function(t,e,i,s,n,o,a,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,u,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(c=d[f][e],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==e&&c.fp!==e;)c=c._next;if(!c)return Xu=1,t.vars[e]="+=0",Zu(t,a),Xu=0,h?uo(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)u=l[f],c=u._pt||u,c.s=(s||s===0)&&!n?s:c.s+(s||0)+o*c.c,c.c=i-c.s,u.e&&(u.e=jt(i)+be(u.e)),u.b&&(u.b=c.s+be(u.b))},iC=function(t,e){var i=t[0]?gs(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=ys({},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},rC=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(ye(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})},wo=function(t,e,i,s,n){return Yt(t)?t.call(e,i,s,n):le(t)&&~t.indexOf("random(")?yo(t):t},D0=Lu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",k0={};Re(D0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return k0[r]=1});var qt=function(r){jg(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:po(s))||this;var h=a.vars,l=h.duration,c=h.delay,u=h.immediateRender,d=h.stagger,f=h.overwrite,p=h.keyframes,m=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,x=s.parent||Vt,b=(ye(i)||$g(i)?or(i[0]):"length"in s)?[i]:Qe(i),v,w,S,C,I,R,P,G;if(a._targets=b.length?Pu(b):uo("GSAP target "+i+" not found. https://gsap.com",!Oe.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,p||d||fh(l)||fh(c)){if(s=a.vars,v=a.timeline=new Se({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:b}),v.kill(),v.parent=v._dp=nr(a),v._start=0,d||fh(l)||fh(c)){if(C=b.length,P=d&&x0(d),Gi(d))for(I in d)~D0.indexOf(I)&&(G||(G={}),G[I]=d[I]);for(w=0;w<C;w++)S=bh(s,k0),S.stagger=0,y&&(S.yoyoEase=y),G&&ys(S,G),R=b[w],S.duration=+wo(l,nr(a),w,R,b),S.delay=(+wo(c,nr(a),w,R,b)||0)-a._delay,!d&&C===1&&S.delay&&(a._delay=c=S.delay,a._start+=c,S.delay=0),v.to(R,S,P?P(w,R,b):0),v._ease=St.none;v.duration()?l=c=0:a.timeline=0}else if(p){po(Je(v.vars.defaults,{ease:"none"})),v._ease=xs(p.ease||s.ease||"none");var N=0,A,k,V;if(ye(p))p.forEach(function(K){return v.to(b,K,">")}),v.duration();else{S={};for(I in p)I==="ease"||I==="easeEach"||rC(I,p[I],S,p.easeEach);for(I in S)for(A=S[I].sort(function(K,H){return K.t-H.t}),N=0,w=0;w<A.length;w++)k=A[w],V={ease:k.e,duration:(k.t-(w?A[w-1].t:0))/100*l},V[I]=k.v,v.to(b,V,N),N+=V.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return f===!0&&!xu&&(Br=nr(a),Vt.killTweensOf(b),Br=0),Ni(x,nr(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!p&&a._start===ce(x._time)&&Ae(u)&&FE(nr(a))&&x.data!=="nested")&&(a._tTime=-Nt,a.render(Math.max(0,-c)||0)),g&&p0(nr(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,c=s<0,u=s>h-Nt&&!c?h:s<Nt?0:s,d,f,p,m,g,y,x,b,v;if(!l)DE(this,s,n,o);else if(u!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(d=u,b=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(m*100+s,n,o);if(d=ce(u%m),u===h?(p=this._repeat,d=l):(p=~~(u/m),p&&p===ce(u/m)&&(d=l,p--),d>l&&(d=l)),y=this._yoyo&&p&1,y&&(v=this._yEase,d=l-d),g=mn(this._tTime,m),d===a&&!o&&this._initted&&p===g)return this._tTime=u,this;p!==g&&(b&&this._yEase&&P0(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(ce(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(m0(this,c?s:d,o,n,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=u,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!a&&!n&&!p&&(We(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;b&&b.render(s<0?s:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(c&&Gu(this,s,n,o),We(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&We(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&Gu(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&Dr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(We(this,u===h?"onComplete":"onReverseComplete",!0),this._prom&&!(u<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){_o||Xe.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Zu(this,l),c=this._ease(l/this._dur),eC(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(wh(this,0),this.parent||u0(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?bo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Br&&Br.vars.overwrite!==!0)._first||bo(this),this.parent&&o!==this.timeline.totalDuration()&&gn(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?Qe(s):a,l=this._ptLookup,c=this._pt,u,d,f,p,m,g,y;if((!n||n==="all")&&PE(a,h))return n==="all"&&(this._pt=0),bo(this);for(u=this._op=this._op||[],n!=="all"&&(le(n)&&(m={},Re(n,function(x){return m[x]=1}),n=m),n=iC(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(u[y]=n,p=d,f={}):(f=u[y]=u[y]||{},p=n);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&xh(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&bo(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return mo(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 mo(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 Vt.killTweensOf(s,n,o)},t}(vo);Je(qt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Re("staggerTo,staggerFrom,staggerFromTo",function(r){qt[r]=function(){var t=new Se,e=Nu.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Vu=function(t,e,i){return t[e]=i},O0=function(t,e,i){return t[e](i)},sC=function(t,e,i,s){return t[e](s.fp,i)},nC=function(t,e,i){return t.setAttribute(e,i)},Hu=function(t,e){return Yt(t[e])?O0:vu(t[e])&&t.setAttribute?nC:Vu},B0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},oC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},U0=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)},Ku=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},aC=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},hC=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?xh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},lC=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},W0=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},Me=function(){function r(e,i,s,n,o,a,h,l,c){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||B0,this.d=h||this,this.set=l||Vu,this.pr=c||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=lC,this.m=i,this.mt=n,this.tween=s},r}();Re(Lu+"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 Au[r]=1}),Be.TweenMax=Be.TweenLite=qt,Be.TimelineLite=Be.TimelineMax=Se,Vt=new Se({sortChildren:!1,defaults:dn,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=M0;var vs=[],Th={},cC=[],X0=0,uC=0,Yu=function(t){return(Th[t]||cC).map(function(e){return e()})},zu=function(){var t=Date.now(),e=[];t-X0>2&&(Yu("matchMediaInit"),vs.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Fi.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Yu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),X0=t,Yu("matchMedia"))},Z0=function(){function r(e,i){this.selector=i&&Du(i),this.data=[],this._r=[],this.isReverted=!1,this.id=uC++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Yt(i)&&(n=s,s=i,i=Yt);var o=this,a=function(){var l=Bt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=Du(n)),Bt=o,u=s.apply(o,arguments),Yt(u)&&o._r.push(u),Bt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Yt?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Bt;Bt=null,i(this),Bt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof qt&&!(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(c){return a.splice(a.indexOf(c),1)}));for(a.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,u){return u.g-c.g||-1/0}).forEach(function(c){return c.t.revert(i)}),h=n.data.length;h--;)l=n.data[h],l instanceof Se?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof qt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=vs.length;o--;)vs[o].id===this.id&&vs.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),dC=function(){function r(e){this.contexts=[],this.scope=e,Bt&&Bt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Gi(i)||(i={matches:i});var o=new Z0(0,n||this.scope),a=o.conditions={},h,l,c;Bt&&!o.selector&&(o.selector=Bt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Fi.matchMedia(i[l]),h&&(vs.indexOf(o)<0&&vs.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(zu):h.addEventListener("change",zu)));return c&&s(o,function(u){return o.add(null,u)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),Sh={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 C0(s)})},timeline:function(t){return new Se(t)},getTweensOf:function(t,e){return Vt.getTweensOf(t,e)},getProperty:function(t,e,i,s){le(t)&&(t=Qe(t)[0]);var n=gs(t||{}).get,o=i?l0:h0;return i==="native"&&(i=""),t&&(e?o((Ue[e]&&Ue[e].get||n)(t,e,i,s)):function(a,h,l){return o((Ue[a]&&Ue[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=Qe(t),t.length>1){var s=t.map(function(c){return Le.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=Ue[e],a=gs(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;yn._pt=0,u.init(t,i?c+i:c,yn,0,[t]),u.render(1,u),yn._pt&&Ku(1,yn)}:a.set(t,h);return o?l:function(c){return l(t,h,i?c+i:c,a,1)}},quickTo:function(t,e,i){var s,n=Le.to(t,ys((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,c){return n.resetTo(e,h,l,c)};return o.tween=n,o},isTweening:function(t){return Vt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=xs(t.ease,dn.ease)),c0(dn,t||{})},config:function(t){return c0(Oe,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&&!Ue[a]&&!Be[a]&&uo(e+" effect requires "+a+" plugin.")}),Mu[e]=function(a,h,l){return i(Qe(a),Je(h||{},n),l)},o&&(Se.prototype[e]=function(a,h,l){return this.add(Mu[e](a,Gi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){St[t]=xs(e)},parseEase:function(t,e){return arguments.length?xs(t,e):St},getById:function(t){return Vt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Se(t),s,n;for(i.smoothChildTiming=Ae(t.smoothChildTiming),Vt.remove(i),i._dp=0,i._time=i._tTime=Vt._time,s=Vt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof qt&&s.vars.onComplete===s._targets[0]))&&Ni(i,s,s._start-s._delay),s=n;return Ni(Vt,i,0),i},context:function(t,e){return t?new Z0(t,e):Bt},matchMedia:function(t){return new dC(t)},matchMediaRefresh:function(){return vs.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||zu()},addEventListener:function(t,e){var i=Th[t]||(Th[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=Th[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:VE,wrapYoyo:HE,distribute:x0,random:v0,snap:_0,normalize:ZE,getUnit:be,clamp:BE,splitColor:I0,toArray:Qe,selector:Du,mapRange:T0,pipe:WE,unitize:XE,interpolate:KE,shuffle:b0},install:i0,effects:Mu,ticker:Xe,updateRoot:Se.updateRoot,plugins:Ue,globalTimeline:Vt,core:{PropTween:Me,globals:r0,Tween:qt,Timeline:Se,Animation:vo,getCache:gs,_removeLinkedListItem:xh,reverting:function(){return ge},context:function(t){return t&&Bt&&(Bt.data.push(t),t._ctx=Bt),Bt},suppressOverwrites:function(t){return xu=t}}};Re("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return Sh[r]=qt[r]}),Xe.add(Se.updateRoot),yn=Sh.to({},{duration:0});var fC=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},pC=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=fC(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},ju=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(le(n)&&(h={},Re(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}pC(a,n)}}}},Le=Sh.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;)ge?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)}},ju("roundProps",ku),ju("modifiers"),ju("snap",_0))||Sh;qt.version=Se.version=Le.version="3.12.5",e0=1,wu()&&bn(),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
1168
  * CSSPlugin 3.12.5
1169
1169
  * https://gsap.com
1170
1170
  *
@@ -1172,6 +1172,6 @@ void main(void)\r
1172
1172
  * Subject to the terms at https://gsap.com/standard-license or for
1173
1173
  * Club GSAP members, the agreement issued with that membership.
1174
1174
  * @author: Jack Doyle, jack@greensock.com
1175
- */var V0,Wr,gn,Ju,vs,H0,$u,mC=function(){return typeof window<"u"},ar={},ws=180/Math.PI,yn=Math.PI/180,bn=Math.atan2,K0=1e8,Qu=/([A-Z])/g,gC=/(left|right|width|margin|padding|x)/i,yC=/[\s,\(]\S/,Di={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bC=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)},xC=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)},_C=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Y0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},z0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},vC=function(t,e,i){return t.style[e]=i},wC=function(t,e,i){return t.style.setProperty(e,i)},TC=function(t,e,i){return t._gsap[e]=i},SC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},EC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},CC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ht="transform",Pe=Ht+"Origin",IC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in ar&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Di[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=hr(s,a)}):this.tfm[t]=o.x?o[t]:hr(s,t),t===Pe&&(this.tfm.zOrigin=o.zOrigin);else return Di.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ht)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Pe,e,"")),t=Ht}(n||e)&&this.props.push(t,e,n[t])},j0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},AC=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(Qu,"-$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=$u(),(!n||!n.isStart)&&!i[Ht]&&(j0(i),s.zOrigin&&i[Pe]&&(i[Pe]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},J0=function(t,e){var i={target:t,props:[],revert:AC,save:IC};return t._gsap||Le.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},$0,td=function(t,e){var i=Wr.createElementNS?Wr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Wr.createElement(t);return i&&i.style?i:Wr.createElement(t)},ki=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Qu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,xn(e)||e,1)||""},Q0="O,Moz,ms,Ms,Webkit".split(","),xn=function(t,e,i){var s=e||vs,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Q0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Q0[o]:"")+t},ed=function(){mC()&&window.document&&(V0=window,Wr=V0.document,gn=Wr.documentElement,vs=td("div")||{style:{}},td("div"),Ht=xn(Ht),Pe=Ht+"Origin",vs.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",$0=!!xn("perspective"),$u=Le.core.reverting,Ju=1)},id=function r(t){var e=td("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(gn.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)),gn.removeChild(e),this.style.cssText=n,o},q0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},ty=function(t){var e;try{e=t.getBBox()}catch{e=id.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===id||(e=id.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+q0(t,["x","cx","x1"])||0,y:+q0(t,["y","cy","y1"])||0,width:0,height:0}:e},ey=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&ty(t))},Ts=function(t,e){if(e){var i=t.style,s;e in ar&&e!==Pe&&(e=Ht),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Qu,"-$1").toLowerCase())):i.removeAttribute(e)}},Ur=function(t,e,i,s,n,o){var a=new Me(t._pt,e,i,0,1,o?z0:Y0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},iy={deg:1,rad:1,turn:1},RC={grid:1,flex:1},Xr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=vs.style,h=gC.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",m,p,g,y;if(s===o||!n||iy[s]||iy[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&ey(t),(f||o==="%")&&(ar[e]||~e.indexOf("adius")))return m=y?t.getBBox()[h?"width":"height"]:t[c],jt(f?n/m*u:n/100*m);if(a[h?"width":"height"]=u+(d?o:s),p=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===Wr||!p.appendChild)&&(p=Wr.body),g=p._gsap,g&&f&&g.width&&h&&g.time===Xe.time&&!g.uncache)return jt(n/g.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+s,m=t[c],x?t.style[e]=x:Ts(t,e)}else(f||o==="%")&&!RC[ki(p,"display")]&&(a.position=ki(t,"position")),p===t&&(a.position="static"),p.appendChild(vs),m=vs[c],p.removeChild(vs),a.position="absolute";return h&&f&&(g=ms(p),g.time=Xe.time,g.width=p[c]),jt(d?m*n/u:m&&n?u/m*n:0)},hr=function(t,e,i,s){var n;return Ju||ed(),e in Di&&e!=="transform"&&(e=Di[e],~e.indexOf(",")&&(e=e.split(",")[0])),ar[e]&&e!=="transform"?(n=To(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:Eh(ki(t,Pe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=Sh[e]&&Sh[e](t,e,i)||ki(t,e)||o0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Xr(t,e,n,i)+i:n},MC=function(t,e,i,s){if(!i||i==="none"){var n=xn(e,t,1),o=n&&ki(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=ki(t,"borderTopColor"))}var a=new Me(this._pt,t.style,e,0,1,W0),h=0,l=0,c,u,d,f,m,p,g,y,x,b,v,T;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(p=t.style[e],t.style[e]=s,s=ki(t,e)||s,p?t.style[e]=p:Ts(t,e)),c=[i,s],M0(c),i=c[0],s=c[1],d=i.match(cn)||[],T=s.match(cn)||[],T.length){for(;u=cn.exec(s);)g=u[0],x=s.substring(h,u.index),m?m=(m+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(m=1),g!==(p=d[l++]||"")&&(f=parseFloat(p)||0,v=p.substr((f+"").length),g.charAt(1)==="="&&(g=un(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=cn.lastIndex-b.length,b||(b=b||Oe.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=Xr(t,e,p,b)||0),a._pt={_next:a._pt,p:x||l===1?x:",",s:f,c:y-f,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"?z0:Y0;return qg.test(s)&&(a.e=0),this._pt=a,a},ry={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},LC=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]=ry[i]||i,e[1]=ry[s]||s,e.join(" ")},PC=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],ar[a]&&(h=1,a=a==="transformOrigin"?Pe:Ht),Ts(i,a);h&&(Ts(i,Ht),o&&(o.svg&&i.removeAttribute("transform"),To(i,1),o.uncache=1,j0(s)))}},Sh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Me(t._pt,e,i,0,0,PC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},wo=[1,0,0,1,0,0],sy={},ny=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},oy=function(t){var e=ki(t,Ht);return ny(e)?wo:e.substr(7).match(Qg).map(jt)},rd=function(t,e){var i=t._gsap||ms(t),s=t.style,n=oy(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"?wo:n):(n===wo&&!t.offsetParent&&t!==gn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,gn.appendChild(t)),n=oy(t),h?s.display=h:Ts(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):gn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},sd=function(t,e,i,s,n,o){var a=t._gsap,h=n||rd(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],m=h[1],p=h[2],g=h[3],y=h[4],x=h[5],b=e.split(" "),v=parseFloat(b[0])||0,T=parseFloat(b[1])||0,S,C,I,R;i?h!==wo&&(C=f*g-m*p)&&(I=v*(g/C)+T*(-p/C)+(p*x-g*y)/C,R=v*(-m/C)+T*(f/C)-(f*x-m*y)/C,v=I,T=R):(S=ty(t),v=S.x+(~b[0].indexOf("%")?v/100*S.width:v),T=S.y+(~(b[1]||b[0]).indexOf("%")?T/100*S.height:T)),s||s!==!1&&a.smooth?(y=v-l,x=T-c,a.xOffset=u+(y*f+x*p)-y,a.yOffset=d+(y*m+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=T,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Pe]="0px 0px",o&&(Ur(o,a,"xOrigin",l,v),Ur(o,a,"yOrigin",c,T),Ur(o,a,"xOffset",u,a.xOffset),Ur(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+T)},To=function(t,e){var i=t._gsap||new N0(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=ki(t,Pe)||"0",c,u,d,f,m,p,g,y,x,b,v,T,S,C,I,R,P,N,F,A,k,Z,K,H,J,B,D,G,V,tt,ft,at;return c=u=d=p=g=y=x=b=v=0,f=m=1,i.svg=!!(t.getCTM&&ey(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ht]=(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[Ht]!=="none"?h[Ht]:"")),s.scale=s.rotate=s.translate="none"),C=rd(t,i.svg),i.svg&&(i.uncache?(J=t.getBBox(),l=i.xOrigin-J.x+"px "+(i.yOrigin-J.y)+"px",H=""):H=!e&&t.getAttribute("data-svg-origin"),sd(t,H||l,!!H||i.originIsAbsolute,i.smooth!==!1,C)),T=i.xOrigin||0,S=i.yOrigin||0,C!==wo&&(N=C[0],F=C[1],A=C[2],k=C[3],c=Z=C[4],u=K=C[5],C.length===6?(f=Math.sqrt(N*N+F*F),m=Math.sqrt(k*k+A*A),p=N||F?bn(F,N)*ws:0,x=A||k?bn(A,k)*ws+p:0,x&&(m*=Math.abs(Math.cos(x*yn))),i.svg&&(c-=T-(T*N+S*A),u-=S-(T*F+S*k))):(at=C[6],tt=C[7],D=C[8],G=C[9],V=C[10],ft=C[11],c=C[12],u=C[13],d=C[14],I=bn(at,V),g=I*ws,I&&(R=Math.cos(-I),P=Math.sin(-I),H=Z*R+D*P,J=K*R+G*P,B=at*R+V*P,D=Z*-P+D*R,G=K*-P+G*R,V=at*-P+V*R,ft=tt*-P+ft*R,Z=H,K=J,at=B),I=bn(-A,V),y=I*ws,I&&(R=Math.cos(-I),P=Math.sin(-I),H=N*R-D*P,J=F*R-G*P,B=A*R-V*P,ft=k*P+ft*R,N=H,F=J,A=B),I=bn(F,N),p=I*ws,I&&(R=Math.cos(I),P=Math.sin(I),H=N*R+F*P,J=Z*R+K*P,F=F*R-N*P,K=K*R-Z*P,N=H,Z=J),g&&Math.abs(g)+Math.abs(p)>359.9&&(g=p=0,y=180-y),f=jt(Math.sqrt(N*N+F*F+A*A)),m=jt(Math.sqrt(K*K+at*at)),I=bn(Z,K),x=Math.abs(I)>2e-4?I*ws:0,v=ft?1/(ft<0?-ft:ft):0),i.svg&&(H=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!ny(ki(t,Ht)),H&&t.setAttribute("transform",H))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=p<=0?180:-180,p+=p<=0?180:-180):(m*=-1,x+=x<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=jt(f),i.scaleY=jt(m),i.rotation=jt(p)+a,i.rotationX=jt(g)+a,i.rotationY=jt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Pe]=Eh(l)),i.xOffset=i.yOffset=0,i.force3D=Oe.force3D,i.renderTransform=i.svg?NC:$0?ay:GC,i.uncache=0,i},Eh=function(t){return(t=t.split(" "))[0]+" "+t[1]},nd=function(t,e,i){var s=be(e);return jt(parseFloat(e)+parseFloat(Xr(t,"x",i+"px",s)))+s},GC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ay(t,e)},Ss="0deg",So="0px",Es=") ",ay=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,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,m=i.scaleX,p=i.scaleY,g=i.transformPerspective,y=i.force3D,x=i.target,b=i.zOrigin,v="",T=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==Ss||c!==Ss)){var S=parseFloat(c)*yn,C=Math.sin(S),I=Math.cos(S),R;S=parseFloat(u)*yn,R=Math.cos(S),o=nd(x,o,C*R*-b),a=nd(x,a,-Math.sin(S)*-b),h=nd(x,h,I*R*-b+b)}g!==So&&(v+="perspective("+g+Es),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(T||o!==So||a!==So||h!==So)&&(v+=h!==So||T?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Es),l!==Ss&&(v+="rotate("+l+Es),c!==Ss&&(v+="rotateY("+c+Es),u!==Ss&&(v+="rotateX("+u+Es),(d!==Ss||f!==Ss)&&(v+="skew("+d+", "+f+Es),(m!==1||p!==1)&&(v+="scale("+m+", "+p+Es),x.style[Ht]=v||"translate(0, 0)"},NC=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,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,m=i.xOrigin,p=i.yOrigin,g=i.xOffset,y=i.yOffset,x=i.forceCSS,b=parseFloat(o),v=parseFloat(a),T,S,C,I,R;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=yn,l*=yn,T=Math.cos(h)*u,S=Math.sin(h)*u,C=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(c*=yn,R=Math.tan(l-c),R=Math.sqrt(1+R*R),C*=R,I*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),T*=R,S*=R)),T=jt(T),S=jt(S),C=jt(C),I=jt(I)):(T=u,I=d,S=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Xr(f,"x",o,"px"),v=Xr(f,"y",a,"px")),(m||p||g||y)&&(b=jt(b+m-(m*T+p*C)+g),v=jt(v+p-(m*S+p*I)+y)),(s||n)&&(R=f.getBBox(),b=jt(b+s/100*R.width),v=jt(v+n/100*R.height)),R="matrix("+T+","+S+","+C+","+I+","+b+","+v+")",f.setAttribute("transform",R),x&&(f.style[Ht]=R)},FC=function(t,e,i,s,n){var o=360,a=he(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?ws:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*K0)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*K0)%o-~~(l/o)*o)),t._pt=d=new Me(t._pt,e,i,s,l,bC),d.e=c,d.u="deg",t._props.push(i),d},hy=function(t,e){for(var i in e)t[i]=e[i];return t},DC=function(t,e,i){var s=hy({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Ht]=e,a=To(i,1),Ts(i,Ht),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ht],o[Ht]=e,a=To(i,1),o[Ht]=l);for(h in ar)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=be(l),m=be(c),u=f!==m?Xr(i,h,l,m):parseFloat(l),d=parseFloat(c),t._pt=new Me(t._pt,a,h,u,d-u,qu),t._pt.u=m||0,t._props.push(h));hy(a,s)};Re("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});Sh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(m){return hr(a,m,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(m,p){return f[m]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,u)}});var ly={name:"css",register:ed,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,c,u,d,f,m,p,g,y,x,b,v,T,S,C,I;Ju||ed(),this.styles=this.styles||J0(t),I=this.styles.props,this.tween=i;for(p in e)if(p!=="autoRound"&&(c=e[p],!(We[p]&&F0(p,e,i,s,t,n)))){if(f=typeof c,m=Sh[p],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=go(c)),m)m(this,t,p,c,i)&&(C=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),c+="",Or.lastIndex=0,Or.test(l)||(g=be(l),y=be(c)),y?g!==y&&(l=Xr(t,p,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,p),o.push(p),I.push(p,0,a[p]);else if(f!=="undefined"){if(h&&p in h?(l=typeof h[p]=="function"?h[p].call(i,s,t,n):h[p],he(l)&&~l.indexOf("random(")&&(l=go(l)),be(l+"")||l==="auto"||(l+=Oe.units[p]||be(hr(t,p))||""),(l+"").charAt(1)==="="&&(l=hr(t,p))):l=hr(t,p),d=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),p in Di&&(p==="autoAlpha"&&(d===1&&hr(t,"visibility")==="hidden"&&u&&(d=0),I.push("visibility",0,a.visibility),Ur(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),p!=="scale"&&p!=="transform"&&(p=Di[p],~p.indexOf(",")&&(p=p.split(",")[0]))),b=p in ar,b){if(this.styles.save(p),v||(T=t._gsap,T.renderTransform&&!e.parseTransform||To(t,e.parseTransform),S=e.smoothOrigin!==!1&&T.smooth,v=this._pt=new Me(this._pt,a,Ht,0,1,T.renderTransform,T,0,-1),v.dep=1),p==="scale")this._pt=new Me(this._pt,T,"scaleY",T.scaleY,(x?un(T.scaleY,x+u):u)-T.scaleY||0,qu),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){I.push(Pe,0,a[Pe]),c=LC(c),T.svg?sd(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==T.zOrigin&&Ur(this,T,"zOrigin",T.zOrigin,y),Ur(this,a,p,Eh(l),Eh(c)));continue}else if(p==="svgOrigin"){sd(t,c,1,S,0,this);continue}else if(p in sy){FC(this,T,p,d,x?un(d,x+c):c);continue}else if(p==="smoothOrigin"){Ur(this,T,"smooth",T.smooth,c);continue}else if(p==="force3D"){T[p]=c;continue}else if(p==="transform"){DC(this,c,t);continue}}else p in a||(p=xn(p)||p);if(b||(u||u===0)&&(d||d===0)&&!yC.test(c)&&p in a)g=(l+"").substr((d+"").length),u||(u=0),y=be(c)||(p in Oe.units?Oe.units[p]:g),g!==y&&(d=Xr(t,p,l,y)),this._pt=new Me(this._pt,b?T:a,p,d,(x?un(d,x+u):u)-d,!b&&(y==="px"||p==="zIndex")&&e.autoRound!==!1?_C:qu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=xC);else if(p in a)MC.call(this,t,p,l,x?x+c:c);else if(p in t)this.add(t,p,l||t[p],x?x+c:c,s,n);else if(p!=="parseTransform"){Iu(p,c);continue}b||(p in a?I.push(p,0,a[p]):I.push(p,1,l||t[p])),o.push(p)}}C&&U0(this)},render:function(t,e){if(e.tween._time||!$u())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:hr,aliases:Di,getSetter:function(t,e,i){var s=Di[e];return s&&s.indexOf(",")<0&&(e=s),e in ar&&e!==Pe&&(t._gsap.x||hr(t,"x"))?i&&H0===i?e==="scale"?SC:TC:(H0=i||{})&&(e==="scale"?EC:CC):t.style&&!vu(t.style[e])?vC:~e.indexOf("-")?wC:Hu(t,e)},core:{_removeProperty:Ts,_getMatrix:rd}};Le.utils.checkPrefix=xn,Le.core.getStyleSaver=J0,function(r,t,e,i){var s=Re(r+","+t+","+e,function(n){ar[n]=1});Re(t,function(n){Oe.units[n]="deg",sy[n]=1}),Di[s[13]]=r+","+t,Re(i,function(n){var o=n.split(":");Di[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"),Re("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Oe.units[r]="px"}),Le.registerPlugin(ly);var cy=Le.registerPlugin(ly)||Le;cy.core.Tween;const Cs=new gt;class kC{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,Cs),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=Cs.right>t.left&&Cs.left<t.right&&Cs.bottom>t.top&&Cs.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(Cs):e.getBounds(!0,Cs);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 Ch={exports:{}};Ch.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]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Promise]",v="[object Proxy]",T="[object RegExp]",S="[object Set]",C="[object String]",I="[object Symbol]",R="[object Undefined]",P="[object WeakMap]",N="[object ArrayBuffer]",F="[object DataView]",A="[object Float32Array]",k="[object Float64Array]",Z="[object Int8Array]",K="[object Int16Array]",H="[object Int32Array]",J="[object Uint8Array]",B="[object Uint8ClampedArray]",D="[object Uint16Array]",G="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,tt=/^\[object .+?Constructor\]$/,ft=/^(?:0|[1-9]\d*)$/,at={};at[A]=at[k]=at[Z]=at[K]=at[H]=at[J]=at[B]=at[D]=at[G]=!0,at[a]=at[h]=at[N]=at[c]=at[F]=at[u]=at[d]=at[f]=at[p]=at[g]=at[x]=at[T]=at[S]=at[C]=at[P]=!1;var Tt=typeof ve=="object"&&ve&&ve.Object===Object&&ve,It=typeof self=="object"&&self&&self.Object===Object&&self,et=Tt||It||Function("return this")(),X=t&&!t.nodeType&&t,$=X&&!0&&r&&!r.nodeType&&r,j=$&&$.exports===X,O=j&&Tt.process,mt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),yt=mt&&mt.isTypedArray;function Mt(w,M){for(var _=-1,E=w==null?0:w.length,L=0,U=[];++_<E;){var ut=w[_];M(ut,_,w)&&(U[L++]=ut)}return U}function Nt(w,M){for(var _=-1,E=M.length,L=w.length;++_<E;)w[L+_]=M[_];return w}function Ee(w,M){for(var _=-1,E=w==null?0:w.length;++_<E;)if(M(w[_],_,w))return!0;return!1}function Ze(w,M){for(var _=-1,E=Array(w);++_<w;)E[_]=M(_);return E}function qh(w){return function(M){return w(M)}}function Mn(w,M){return w.has(M)}function Uo(w,M){return w==null?void 0:w[M]}function Ln(w){var M=-1,_=Array(w.size);return w.forEach(function(E,L){_[++M]=[L,E]}),_}function gi(w,M){return function(_){return w(M(_))}}function tl(w){var M=-1,_=Array(w.size);return w.forEach(function(E){_[++M]=E}),_}var el=Array.prototype,Ud=Function.prototype,Pn=Object.prototype,Kr=et["__core-js_shared__"],Xo=Ud.toString,Ve=Pn.hasOwnProperty,Zo=function(){var w=/[^.]+$/.exec(Kr&&Kr.keys&&Kr.keys.IE_PROTO||"");return w?"Symbol(src)_1."+w:""}(),Vo=Pn.toString,il=RegExp("^"+Xo.call(Ve).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rl=j?et.Buffer:void 0,Gn=et.Symbol,Xi=et.Uint8Array,Gs=Pn.propertyIsEnumerable,Xd=el.splice,Zi=Gn?Gn.toStringTag:void 0,sl=Object.getOwnPropertySymbols,nl=rl?rl.isBuffer:void 0,Ns=gi(Object.keys,Object),Ho=xr(et,"DataView"),He=xr(et,"Map"),Ko=xr(et,"Promise"),Yo=xr(et,"Set"),zo=xr(et,"WeakMap"),Fs=xr(Object,"create"),Zd=bi(Ho),yi=bi(He),Vd=bi(Ko),Hd=bi(Yo),Kd=bi(zo),ol=Gn?Gn.prototype:void 0,jo=ol?ol.valueOf:void 0;function Fe(w){var M=-1,_=w==null?0:w.length;for(this.clear();++M<_;){var E=w[M];this.set(E[0],E[1])}}function Yd(){this.__data__=Fs?Fs(null):{},this.size=0}function zd(w){var M=this.has(w)&&delete this.__data__[w];return this.size-=M?1:0,M}function jd(w){var M=this.__data__;if(Fs){var _=M[w];return _===i?void 0:_}return Ve.call(M,w)?M[w]:void 0}function Jd(w){var M=this.__data__;return Fs?M[w]!==void 0:Ve.call(M,w)}function $d(w,M){var _=this.__data__;return this.size+=this.has(w)?0:1,_[w]=Fs&&M===void 0?i:M,this}Fe.prototype.clear=Yd,Fe.prototype.delete=zd,Fe.prototype.get=jd,Fe.prototype.has=Jd,Fe.prototype.set=$d;function xe(w){var M=-1,_=w==null?0:w.length;for(this.clear();++M<_;){var E=w[M];this.set(E[0],E[1])}}function Qd(){this.__data__=[],this.size=0}function qd(w){var M=this.__data__,_=Fn(M,w);if(_<0)return!1;var E=M.length-1;return _==E?M.pop():Xd.call(M,_,1),--this.size,!0}function tf(w){var M=this.__data__,_=Fn(M,w);return _<0?void 0:M[_][1]}function ef(w){return Fn(this.__data__,w)>-1}function rf(w,M){var _=this.__data__,E=Fn(_,w);return E<0?(++this.size,_.push([w,M])):_[E][1]=M,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(w){var M=-1,_=w==null?0:w.length;for(this.clear();++M<_;){var E=w[M];this.set(E[0],E[1])}}function Jo(){this.size=0,this.__data__={hash:new Fe,map:new(He||xe),string:new Fe}}function sf(w){var M=kn(this,w).delete(w);return this.size-=M?1:0,M}function Nn(w){return kn(this,w).get(w)}function $o(w){return kn(this,w).has(w)}function nf(w,M){var _=kn(this,w),E=_.size;return _.set(w,M),this.size+=_.size==E?0:1,this}yr.prototype.clear=Jo,yr.prototype.delete=sf,yr.prototype.get=Nn,yr.prototype.has=$o,yr.prototype.set=nf;function br(w){var M=-1,_=w==null?0:w.length;for(this.__data__=new yr;++M<_;)this.add(w[M])}function al(w){return this.__data__.set(w,i),this}function of(w){return this.__data__.has(w)}br.prototype.add=br.prototype.push=al,br.prototype.has=of;function Vi(w){var M=this.__data__=new xe(w);this.size=M.size}function af(){this.__data__=new xe,this.size=0}function hl(w){var M=this.__data__,_=M.delete(w);return this.size=M.size,_}function hf(w){return this.__data__.get(w)}function lf(w){return this.__data__.has(w)}function cf(w,M){var _=this.__data__;if(_ instanceof xe){var E=_.__data__;if(!He||E.length<e-1)return E.push([w,M]),this.size=++_.size,this;_=this.__data__=new yr(E)}return _.set(w,M),this.size=_.size,this}Vi.prototype.clear=af,Vi.prototype.delete=hl,Vi.prototype.get=hf,Vi.prototype.has=lf,Vi.prototype.set=cf;function uf(w,M){var _=Wn(w),E=!_&&ta(w),L=!_&&!E&&ks(w),U=!_&&!E&&!L&&yl(w),ut=_||E||L||U,bt=ut?Ze(w.length,String):[],_t=bt.length;for(var lt in w)(M||Ve.call(w,lt))&&!(ut&&(lt=="length"||L&&(lt=="offset"||lt=="parent")||U&&(lt=="buffer"||lt=="byteLength"||lt=="byteOffset")||qo(lt,_t)))&&bt.push(lt);return bt}function Fn(w,M){for(var _=w.length;_--;)if(Bn(w[_][0],M))return _;return-1}function df(w,M,_){var E=M(w);return Wn(w)?E:Nt(E,_(w))}function Ds(w){return w==null?w===void 0?R:y:Zi&&Zi in Object(w)?gf(w):On(w)}function ll(w){return zr(w)&&Ds(w)==a}function cl(w,M,_,E,L){return w===M?!0:w==null||M==null||!zr(w)&&!zr(M)?w!==w&&M!==M:ff(w,M,_,E,cl,L)}function ff(w,M,_,E,L,U){var ut=Wn(w),bt=Wn(M),_t=ut?h:Hi(w),lt=bt?h:Hi(M);_t=_t==a?x:_t,lt=lt==a?x:lt;var vt=_t==x,Wt=lt==x,Lt=_t==lt;if(Lt&&ks(w)){if(!ks(M))return!1;ut=!0,vt=!1}if(Lt&&!vt)return U||(U=new Vi),ut||yl(w)?ul(w,M,_,E,L,U):dl(w,M,_t,_,E,L,U);if(!(_&s)){var de=vt&&Ve.call(w,"__wrapped__"),_e=Wt&&Ve.call(M,"__wrapped__");if(de||_e){var si=de?w.value():w,ni=_e?M.value():M;return U||(U=new Vi),L(si,ni,_,E,U)}}return Lt?(U||(U=new Vi),mf(w,M,_,E,L,U)):!1}function Dn(w){if(!gl(w)||xf(w))return!1;var M=Ki(w)?il:tt;return M.test(bi(w))}function Qo(w){return zr(w)&&Yr(w.length)&&!!at[Ds(w)]}function pf(w){if(!_f(w))return Ns(w);var M=[];for(var _ in Object(w))Ve.call(w,_)&&_!="constructor"&&M.push(_);return M}function ul(w,M,_,E,L,U){var ut=_&s,bt=w.length,_t=M.length;if(bt!=_t&&!(ut&&_t>bt))return!1;var lt=U.get(w);if(lt&&U.get(M))return lt==M;var vt=-1,Wt=!0,Lt=_&n?new br:void 0;for(U.set(w,M),U.set(M,w);++vt<bt;){var de=w[vt],_e=M[vt];if(E)var si=ut?E(_e,de,vt,M,w,U):E(de,_e,vt,w,M,U);if(si!==void 0){if(si)continue;Wt=!1;break}if(Lt){if(!Ee(M,function(ni,Os){if(!Mn(Lt,Os)&&(de===ni||L(de,ni,_,E,U)))return Lt.push(Os)})){Wt=!1;break}}else if(!(de===_e||L(de,_e,_,E,U))){Wt=!1;break}}return U.delete(w),U.delete(M),Wt}function dl(w,M,_,E,L,U,ut){switch(_){case F:if(w.byteLength!=M.byteLength||w.byteOffset!=M.byteOffset)return!1;w=w.buffer,M=M.buffer;case N:return!(w.byteLength!=M.byteLength||!U(new Xi(w),new Xi(M)));case c:case u:case g:return Bn(+w,+M);case d:return w.name==M.name&&w.message==M.message;case T:case C:return w==M+"";case p:var bt=Ln;case S:var _t=E&s;if(bt||(bt=tl),w.size!=M.size&&!_t)return!1;var lt=ut.get(w);if(lt)return lt==M;E|=n,ut.set(w,M);var vt=ul(bt(w),bt(M),E,L,U,ut);return ut.delete(w),vt;case I:if(jo)return jo.call(w)==jo.call(M)}return!1}function mf(w,M,_,E,L,U){var ut=_&s,bt=fl(w),_t=bt.length,lt=fl(M),vt=lt.length;if(_t!=vt&&!ut)return!1;for(var Wt=_t;Wt--;){var Lt=bt[Wt];if(!(ut?Lt in M:Ve.call(M,Lt)))return!1}var de=U.get(w);if(de&&U.get(M))return de==M;var _e=!0;U.set(w,M),U.set(M,w);for(var si=ut;++Wt<_t;){Lt=bt[Wt];var ni=w[Lt],Os=M[Lt];if(E)var Qb=ut?E(Os,ni,Lt,M,w,U):E(ni,Os,Lt,w,M,U);if(!(Qb===void 0?ni===Os||L(ni,Os,_,E,U):Qb)){_e=!1;break}si||(si=Lt=="constructor")}if(_e&&!si){var xl=w.constructor,_l=M.constructor;xl!=_l&&"constructor"in w&&"constructor"in M&&!(typeof xl=="function"&&xl instanceof xl&&typeof _l=="function"&&_l instanceof _l)&&(_e=!1)}return U.delete(w),U.delete(M),_e}function fl(w){return df(w,bl,yf)}function kn(w,M){var _=w.__data__;return bf(M)?_[typeof M=="string"?"string":"hash"]:_.map}function xr(w,M){var _=Uo(w,M);return Dn(_)?_:void 0}function gf(w){var M=Ve.call(w,Zi),_=w[Zi];try{w[Zi]=void 0;var E=!0}catch{}var L=Vo.call(w);return E&&(M?w[Zi]=_:delete w[Zi]),L}var yf=sl?function(w){return w==null?[]:(w=Object(w),Mt(sl(w),function(M){return Gs.call(w,M)}))}:vf,Hi=Ds;(Ho&&Hi(new Ho(new ArrayBuffer(1)))!=F||He&&Hi(new He)!=p||Ko&&Hi(Ko.resolve())!=b||Yo&&Hi(new Yo)!=S||zo&&Hi(new zo)!=P)&&(Hi=function(w){var M=Ds(w),_=M==x?w.constructor:void 0,E=_?bi(_):"";if(E)switch(E){case Zd:return F;case yi:return p;case Vd:return b;case Hd:return S;case Kd:return P}return M});function qo(w,M){return M=M??o,!!M&&(typeof w=="number"||ft.test(w))&&w>-1&&w%1==0&&w<M}function bf(w){var M=typeof w;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?w!=="__proto__":w===null}function xf(w){return!!Zo&&Zo in w}function _f(w){var M=w&&w.constructor,_=typeof M=="function"&&M.prototype||Pn;return w===_}function On(w){return Vo.call(w)}function bi(w){if(w!=null){try{return Xo.call(w)}catch{}try{return w+""}catch{}}return""}function Bn(w,M){return w===M||w!==w&&M!==M}var ta=ll(function(){return arguments}())?ll:function(w){return zr(w)&&Ve.call(w,"callee")&&!Gs.call(w,"callee")},Wn=Array.isArray;function pl(w){return w!=null&&Yr(w.length)&&!Ki(w)}var ks=nl||wf;function ml(w,M){return cl(w,M)}function Ki(w){if(!gl(w))return!1;var M=Ds(w);return M==f||M==m||M==l||M==v}function Yr(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=o}function gl(w){var M=typeof w;return w!=null&&(M=="object"||M=="function")}function zr(w){return w!=null&&typeof w=="object"}var yl=yt?qh(yt):Qo;function bl(w){return pl(w)?uf(w):pf(w)}function vf(){return[]}function wf(){return!1}r.exports=ml}(Ch,Ch.exports);var OC=Ch.exports;const uy=Us(OC);var BC=Object.defineProperty,WC=(r,t,e)=>t in r?BC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t,e)=>(WC(r,typeof t!="symbol"?t+"":t,e),e);class ti{constructor(t){W(this,"parent"),W(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 UC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dy={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,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(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(UC)})(dy);const fy=dy.exports;function Ih(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return fy[r]}else return fy[t]}const XC={removeOnInterrupt:!1,ease:"linear",time:1e3};class ZC extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"startX"),W(this,"startY"),W(this,"deltaX"),W(this,"deltaY"),W(this,"keepCenter"),W(this,"startWidth",null),W(this,"startHeight",null),W(this,"deltaWidth",null),W(this,"deltaHeight",null),W(this,"width",null),W(this,"height",null),W(this,"time",0),this.options=Object.assign({},XC,e),this.options.ease=Ih(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 dt(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 dt(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 VC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class HC extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"underflowX"),W(this,"underflowY"),W(this,"ease"),W(this,"toX"),W(this,"toY"),this.options=Object.assign({},VC,e),this.ease=Ih(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 dt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new dt(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 dt(0,0),bottomRight:new dt(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 KC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class YC extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"last"),W(this,"noUnderflow"),W(this,"underflowX"),W(this,"underflowY"),this.options=Object.assign({},KC,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 dt(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 zC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class jC extends ti{constructor(t,e={}){super(t),W(this,"options"),this.options=Object.assign({},zC,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 JC={friction:.98,bounce:.8,minSpeed:.01},Zr=16;class $C extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"x"),W(this,"y"),W(this,"percentChangeX"),W(this,"percentChangeY"),W(this,"saved"),W(this,"timeSinceRelease"),this.options=Object.assign({},JC,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*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.x*=Math.pow(this.percentChangeX,t/Zr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.y*=Math.pow(this.percentChangeY,t/Zr)}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 QC={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 qC extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"moved"),W(this,"reverse"),W(this,"xDirection"),W(this,"yDirection"),W(this,"keyIsPressed"),W(this,"mouse"),W(this,"underflowX"),W(this,"underflowY"),W(this,"last"),W(this,"current"),W(this,"windowEventHandlers",[]),this.options=Object.assign({},QC,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 dt(this.last.x,this.last.y),world:this.parent.toWorld(new dt(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 dt(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 tI={speed:0,acceleration:null,radius:null};class eI extends ti{constructor(t,e,i={}){super(t),W(this,"options"),W(this,"target"),W(this,"velocity"),this.target=e,this.options=Object.assign({},tI,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 c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),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,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),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 iI={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class rI extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"reverse"),W(this,"radiusSquared"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"horizontal"),W(this,"vertical"),this.options=Object.assign({},iI,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 sI={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class nI extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"active",!1),W(this,"pinching",!1),W(this,"moved",!1),W(this,"lastCenter"),this.options=Object.assign({},sI,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 dt(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 c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),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 f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.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 oI={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class aI extends ti{constructor(t,e,i,s={}){super(t),W(this,"options"),W(this,"ease"),W(this,"x"),W(this,"y"),W(this,"percent"),W(this,"snapping"),W(this,"deltaX"),W(this,"deltaY"),W(this,"startX"),W(this,"startY"),this.options=Object.assign({},oI,s),this.ease=Ih(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 c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}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 hI={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class lI extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"ease"),W(this,"xScale"),W(this,"yScale"),W(this,"xIndependent"),W(this,"yIndependent"),W(this,"snapping"),this.options=Object.assign({},hI,e),this.ease=Ih(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 cI={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class uI extends ti{constructor(t,e={}){super(t),W(this,"options"),W(this,"smoothing"),W(this,"smoothingCenter"),W(this,"smoothingCount"),W(this,"keyIsPressed"),this.options=Object.assign({},cI,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 dI{constructor(t){W(this,"viewport"),W(this,"clickedAvailable"),W(this,"isMouseDown"),W(this,"last"),W(this,"wheelFunction"),W(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new gt(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 dt;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 Eo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class fI{constructor(t){W(this,"plugins"),W(this,"list"),W(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Eo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Eo.indexOf(t);n!==-1&&Eo.splice(n,1),Eo.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 Eo)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 pI={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:Te.shared,allowPreserveDragOutside:!1};class mI extends Ct{constructor(t){super(),W(this,"moving"),W(this,"screenWidth"),W(this,"screenHeight"),W(this,"threshold"),W(this,"input"),W(this,"plugins"),W(this,"zooming"),W(this,"lastViewport"),W(this,"options"),W(this,"_dirty"),W(this,"_forceHitArea"),W(this,"_hitAreaDefault"),W(this,"_pause"),W(this,"tickerFunction"),W(this,"_worldWidth"),W(this,"_worldHeight"),W(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...pI,...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 dI(this),this.plugins=new fI(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 gt(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 gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new dt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new dt(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 dt(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 dt(-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 lI(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 dt(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 gt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new qC(this,t)),this}clamp(t){return this.plugins.add("clamp",new YC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new $C(this,t)),this}bounce(t){return this.plugins.add("bounce",new HC(this,t)),this}pinch(t){return this.plugins.add("pinch",new nI(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new aI(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new eI(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new uI(this,t)),this}animate(t){return this.plugins.add("animate",new ZC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new jC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new rI(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 Ah(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function gI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function od(r){let t,e,i;r.length!==2?(t=Ah,e=(a,h)=>Ah(r(a),h),i=(a,h)=>r(a)-h):(t=r===Ah||r===gI?r:yI,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function yI(){return 0}function bI(r){return r===null?NaN:+r}const xI=od(Ah).right;od(bI).center;const _I=xI,vI=Math.sqrt(50),wI=Math.sqrt(10),TI=Math.sqrt(2);function Rh(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>=vI?10:n>=wI?5:n>=TI?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?Rh(r,t,e*2):[a,h,l]}function SI(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?Rh(t,r,e):Rh(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 ad(r,t,e){return t=+t,r=+r,e=+e,Rh(r,t,e)[2]}function hd(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?ad(t,r,e):ad(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ld(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function py(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function Co(){}var Io=.7,Mh=1/Io,_n="\\s*([+-]?\\d+)\\s*",Ao="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",EI=/^#([0-9a-f]{3,8})$/,CI=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),II=new RegExp(`^rgb\\(${Oi},${Oi},${Oi}\\)$`),AI=new RegExp(`^rgba\\(${_n},${_n},${_n},${Ao}\\)$`),RI=new RegExp(`^rgba\\(${Oi},${Oi},${Oi},${Ao}\\)$`),MI=new RegExp(`^hsl\\(${Ao},${Oi},${Oi}\\)$`),LI=new RegExp(`^hsla\\(${Ao},${Oi},${Oi},${Ao}\\)$`),my={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};ld(Co,Ro,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:gy,formatHex:gy,formatHex8:PI,formatHsl:GI,formatRgb:yy,toString:yy});function gy(){return this.rgb().formatHex()}function PI(){return this.rgb().formatHex8()}function GI(){return wy(this).formatHsl()}function yy(){return this.rgb().formatRgb()}function Ro(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=EI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?by(t):e===3?new Ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Lh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Lh(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=CI.exec(r))?new Ge(t[1],t[2],t[3],1):(t=II.exec(r))?new Ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=AI.exec(r))?Lh(t[1],t[2],t[3],t[4]):(t=RI.exec(r))?Lh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MI.exec(r))?vy(t[1],t[2]/100,t[3]/100,1):(t=LI.exec(r))?vy(t[1],t[2]/100,t[3]/100,t[4]):my.hasOwnProperty(r)?by(my[r]):r==="transparent"?new Ge(NaN,NaN,NaN,0):null}function by(r){return new Ge(r>>16&255,r>>8&255,r&255,1)}function Lh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ge(r,t,e,i)}function NI(r){return r instanceof Co||(r=Ro(r)),r?(r=r.rgb(),new Ge(r.r,r.g,r.b,r.opacity)):new Ge}function cd(r,t,e,i){return arguments.length===1?NI(r):new Ge(r,t,e,i??1)}function Ge(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ld(Ge,cd,py(Co,{brighter(r){return r=r==null?Mh:Math.pow(Mh,r),new Ge(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Io:Math.pow(Io,r),new Ge(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ge(Is(this.r),Is(this.g),Is(this.b),Ph(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:xy,formatHex:xy,formatHex8:FI,formatRgb:_y,toString:_y}));function xy(){return`#${As(this.r)}${As(this.g)}${As(this.b)}`}function FI(){return`#${As(this.r)}${As(this.g)}${As(this.b)}${As((isNaN(this.opacity)?1:this.opacity)*255)}`}function _y(){const r=Ph(this.opacity);return`${r===1?"rgb(":"rgba("}${Is(this.r)}, ${Is(this.g)}, ${Is(this.b)}${r===1?")":`, ${r})`}`}function Ph(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Is(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function As(r){return r=Is(r),(r<16?"0":"")+r.toString(16)}function vy(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new pi(r,t,e,i)}function wy(r){if(r instanceof pi)return new pi(r.h,r.s,r.l,r.opacity);if(r instanceof Co||(r=Ro(r)),!r)return new pi;if(r instanceof pi)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 pi(o,a,h,r.opacity)}function DI(r,t,e,i){return arguments.length===1?wy(r):new pi(r,t,e,i??1)}function pi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ld(pi,DI,py(Co,{brighter(r){return r=r==null?Mh:Math.pow(Mh,r),new pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Io:Math.pow(Io,r),new pi(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 Ge(ud(r>=240?r-240:r+120,s,i),ud(r,s,i),ud(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new pi(Ty(this.h),Gh(this.s),Gh(this.l),Ph(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=Ph(this.opacity);return`${r===1?"hsl(":"hsla("}${Ty(this.h)}, ${Gh(this.s)*100}%, ${Gh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function Ty(r){return r=(r||0)%360,r<0?r+360:r}function Gh(r){return Math.max(0,Math.min(1,r||0))}function ud(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 dd=r=>()=>r;function kI(r,t){return function(e){return r+e*t}}function OI(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 BI(r){return(r=+r)==1?Sy:function(t,e){return e-t?OI(t,e,r):dd(isNaN(t)?e:t)}}function Sy(r,t){var e=t-r;return e?kI(r,e):dd(isNaN(r)?t:r)}const Ey=function r(t){var e=BI(t);function i(s,n){var o=e((s=cd(s)).r,(n=cd(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=Sy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function WI(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 UI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function XI(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]=md(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 ZI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Nh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function VI(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]=md(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var fd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pd=new RegExp(fd.source,"g");function HI(r){return function(){return r}}function KI(r){return function(t){return r(t)+""}}function YI(r,t){var e=fd.lastIndex=pd.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=fd.exec(r))&&(s=pd.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:Nh(i,s)})),e=pd.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?KI(h[0].x):HI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function md(r,t){var e=typeof t,i;return t==null||e==="boolean"?dd(t):(e==="number"?Nh:e==="string"?(i=Ro(t))?(t=i,Ey):YI:t instanceof Ro?Ey:t instanceof Date?ZI:UI(t)?WI:Array.isArray(t)?XI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?VI:Nh)(r,t)}function zI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function jI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Fh(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 vn(r){return r=Fh(Math.abs(r)),r?r[1]:NaN}function JI(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 $I(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var QI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dh(r){if(!(t=QI.exec(r)))throw new Error("invalid format: "+r);var t;return new gd({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]})}Dh.prototype=gd.prototype;function gd(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+""}gd.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 qI(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 Cy;function t2(r,t){var e=Fh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(Cy=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")+Fh(r,Math.max(0,t+n-1))[0]}function Iy(r,t){var e=Fh(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 Ay={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:jI,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)=>Iy(r*100,t),r:Iy,s:t2,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ry(r){return r}var My=Array.prototype.map,Ly=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function e2(r){var t=r.grouping===void 0||r.thousands===void 0?Ry:JI(My.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?Ry:$I(My.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(u){u=Dh(u);var d=u.fill,f=u.align,m=u.sign,p=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,v=u.trim,T=u.type;T==="n"?(x=!0,T="g"):Ay[T]||(b===void 0&&(b=12),v=!0,T="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var S=p==="$"?e:p==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",C=p==="$"?i:/[%p]/.test(T)?o:"",I=Ay[T],R=/[defgprs%]/.test(T);b=b===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function P(N){var F=S,A=C,k,Z,K;if(T==="c")A=I(N)+A,N="";else{N=+N;var H=N<0||1/N<0;if(N=isNaN(N)?h:I(Math.abs(N),b),v&&(N=qI(N)),H&&+N==0&&m!=="+"&&(H=!1),F=(H?m==="("?m:a:m==="-"||m==="("?"":m)+F,A=(T==="s"?Ly[8+Cy/3]:"")+A+(H&&m==="("?")":""),R){for(k=-1,Z=N.length;++k<Z;)if(K=N.charCodeAt(k),48>K||K>57){A=(K===46?s+N.slice(k+1):N.slice(k))+A,N=N.slice(0,k);break}}}x&&!g&&(N=t(N,1/0));var J=F.length+N.length+A.length,B=J<y?new Array(y-J+1).join(d):"";switch(x&&g&&(N=t(B+N,B.length?y-A.length:1/0),B=""),f){case"<":N=F+N+A+B;break;case"=":N=F+B+N+A;break;case"^":N=B.slice(0,J=B.length>>1)+F+N+A+B.slice(J);break;default:N=B+F+N+A;break}return n(N)}return P.toString=function(){return u+""},P}function c(u,d){var f=l((u=Dh(u),u.type="f",u)),m=Math.max(-8,Math.min(8,Math.floor(vn(d)/3)))*3,p=Math.pow(10,-m),g=Ly[8+m/3];return function(y){return f(p*y)+g}}return{format:l,formatPrefix:c}}var kh,Py,Gy;i2({thousands:",",grouping:[3],currency:["$",""]});function i2(r){return kh=e2(r),Py=kh.format,Gy=kh.formatPrefix,kh}function r2(r){return Math.max(0,-vn(Math.abs(r)))}function s2(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(vn(t)/3)))*3-vn(Math.abs(r)))}function n2(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,vn(t)-vn(r))+1}function Ny(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function o2(r){return function(){return r}}function a2(r){return+r}var Fy=[0,1];function wn(r){return r}function yd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:o2(isNaN(t)?NaN:.5)}function h2(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function l2(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=yd(s,i),n=e(o,n)):(i=yd(i,s),n=e(n,o)),function(a){return n(i(a))}}function c2(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]=yd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=_I(r,a,1,i)-1;return n[h](s[h](a))}}function Dy(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function u2(){var r=Fy,t=Fy,e=md,i,s,n,o=wn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==wn&&(o=h2(r[0],r[d-1])),a=d>2?c2:l2,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Nh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,a2),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=zI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:wn,c()):o!==wn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function ky(){return u2()(wn,wn)}function d2(r,t,e,i){var s=hd(r,t,e),n;switch(i=Dh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=s2(s,o))&&(i.precision=n),Gy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=n2(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=r2(s))&&(i.precision=n-(i.type==="%")*2);break}}return Py(i)}function f2(r){var t=r.domain;return r.ticks=function(e){var i=t();return SI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return d2(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,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=ad(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 Oy(){var r=ky();return r.copy=function(){return Dy(r,Oy())},Ny.apply(r,arguments),f2(r)}function p2(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 bd=new Date,xd=new Date;function re(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=>re(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)=>(bd.setTime(+n),xd.setTime(+o),r(bd),r(xd),Math.floor(e(bd,xd))),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 Oh=re(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Oh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?re(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Oh),Oh.range;const lr=1e3,ei=lr*60,cr=ei*60,ur=cr*24,_d=ur*7,By=ur*30,vd=ur*365,Tn=re(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*lr)},(r,t)=>(t-r)/lr,r=>r.getUTCSeconds());Tn.range;const wd=re(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*lr)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getMinutes());wd.range,re(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getUTCMinutes()).range;const Td=re(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*lr-r.getMinutes()*ei)},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getHours());Td.range,re(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getUTCHours()).range;const Mo=re(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ei)/ur,r=>r.getDate()-1);Mo.range;const Sd=re(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ur,r=>r.getUTCDate()-1);Sd.range,re(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ur,r=>Math.floor(r/ur)).range;function Rs(r){return re(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())*ei)/_d)}const Bh=Rs(0),Wh=Rs(1),m2=Rs(2),g2=Rs(3),Sn=Rs(4),y2=Rs(5),b2=Rs(6);Bh.range,Wh.range,m2.range,g2.range,Sn.range,y2.range,b2.range;function Ms(r){return re(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)/_d)}const Wy=Ms(0),Uh=Ms(1),x2=Ms(2),_2=Ms(3),En=Ms(4),v2=Ms(5),w2=Ms(6);Wy.range,Uh.range,x2.range,_2.range,En.range,v2.range,w2.range;const Ed=re(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());Ed.range,re(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 dr=re(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());dr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:re(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)}),dr.range;const Ls=re(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());Ls.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:re(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)}),Ls.range;function T2(r,t,e,i,s,n){const o=[[Tn,1,lr],[Tn,5,5*lr],[Tn,15,15*lr],[Tn,30,30*lr],[n,1,ei],[n,5,5*ei],[n,15,15*ei],[n,30,30*ei],[s,1,cr],[s,3,3*cr],[s,6,6*cr],[s,12,12*cr],[i,1,ur],[i,2,2*ur],[e,1,_d],[t,1,By],[t,3,3*By],[r,1,vd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),m=f?f.range(l,+c+1):[];return d?m.reverse():m}function h(l,c,u){const d=Math.abs(c-l)/u,f=od(([,,g])=>g).right(o,d);if(f===o.length)return r.every(hd(l/vd,c/vd,u));if(f===0)return Oh.every(Math.max(hd(l,c,u),1));const[m,p]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return m.every(p)}return[a,h]}const[S2,E2]=T2(dr,Ed,Bh,Mo,Td,wd);function Cd(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 Id(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 Lo(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function C2(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=Po(s),c=Go(s),u=Po(n),d=Go(n),f=Po(o),m=Go(o),p=Po(a),g=Go(a),y=Po(h),x=Go(h),b={a:H,A:J,b:B,B:D,c:null,d:Ky,e:Ky,f:j2,g:nA,G:aA,H:K2,I:Y2,j:z2,L:Yy,m:J2,M:$2,p:G,q:V,Q:qy,s:tb,S:Q2,u:q2,U:tA,V:eA,w:iA,W:rA,x:null,X:null,y:sA,Y:oA,Z:hA,"%":Qy},v={a:tt,A:ft,b:at,B:Tt,c:null,d:jy,e:jy,f:dA,g:wA,G:SA,H:lA,I:cA,j:uA,L:Jy,m:fA,M:pA,p:It,q:et,Q:qy,s:tb,S:mA,u:gA,U:yA,V:bA,w:xA,W:_A,x:null,X:null,y:vA,Y:TA,Z:EA,"%":Qy},T={a:P,A:N,b:F,B:A,c:k,d:Vy,e:Vy,f:X2,g:Zy,G:Xy,H:Hy,I:Hy,j:O2,L:U2,m:k2,M:B2,p:R,q:D2,Q:V2,s:H2,S:W2,u:L2,U:P2,V:G2,w:M2,W:N2,x:Z,X:K,y:Zy,Y:Xy,Z:F2,"%":Z2};b.x=S(e,b),b.X=S(i,b),b.c=S(t,b),v.x=S(e,v),v.X=S(i,v),v.c=S(t,v);function S(X,$){return function(j){var O=[],mt=-1,yt=0,Mt=X.length,Nt,Ee,Ze;for(j instanceof Date||(j=new Date(+j));++mt<Mt;)X.charCodeAt(mt)===37&&(O.push(X.slice(yt,mt)),(Ee=Uy[Nt=X.charAt(++mt)])!=null?Nt=X.charAt(++mt):Ee=Nt==="e"?" ":"0",(Ze=$[Nt])&&(Nt=Ze(j,Ee)),O.push(Nt),yt=mt+1);return O.push(X.slice(yt,mt)),O.join("")}}function C(X,$){return function(j){var O=Lo(1900,void 0,1),mt=I(O,X,j+="",0),yt,Mt;if(mt!=j.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($&&!("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?(yt=Id(Lo(O.y,0,1)),Mt=yt.getUTCDay(),yt=Mt>4||Mt===0?Uh.ceil(yt):Uh(yt),yt=Sd.offset(yt,(O.V-1)*7),O.y=yt.getUTCFullYear(),O.m=yt.getUTCMonth(),O.d=yt.getUTCDate()+(O.w+6)%7):(yt=Cd(Lo(O.y,0,1)),Mt=yt.getDay(),yt=Mt>4||Mt===0?Wh.ceil(yt):Wh(yt),yt=Mo.offset(yt,(O.V-1)*7),O.y=yt.getFullYear(),O.m=yt.getMonth(),O.d=yt.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?Id(Lo(O.y,0,1)).getUTCDay():Cd(Lo(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,Id(O)):Cd(O)}}function I(X,$,j,O){for(var mt=0,yt=$.length,Mt=j.length,Nt,Ee;mt<yt;){if(O>=Mt)return-1;if(Nt=$.charCodeAt(mt++),Nt===37){if(Nt=$.charAt(mt++),Ee=T[Nt in Uy?$.charAt(mt++):Nt],!Ee||(O=Ee(X,j,O))<0)return-1}else if(Nt!=j.charCodeAt(O++))return-1}return O}function R(X,$,j){var O=l.exec($.slice(j));return O?(X.p=c.get(O[0].toLowerCase()),j+O[0].length):-1}function P(X,$,j){var O=f.exec($.slice(j));return O?(X.w=m.get(O[0].toLowerCase()),j+O[0].length):-1}function N(X,$,j){var O=u.exec($.slice(j));return O?(X.w=d.get(O[0].toLowerCase()),j+O[0].length):-1}function F(X,$,j){var O=y.exec($.slice(j));return O?(X.m=x.get(O[0].toLowerCase()),j+O[0].length):-1}function A(X,$,j){var O=p.exec($.slice(j));return O?(X.m=g.get(O[0].toLowerCase()),j+O[0].length):-1}function k(X,$,j){return I(X,t,$,j)}function Z(X,$,j){return I(X,e,$,j)}function K(X,$,j){return I(X,i,$,j)}function H(X){return o[X.getDay()]}function J(X){return n[X.getDay()]}function B(X){return h[X.getMonth()]}function D(X){return a[X.getMonth()]}function G(X){return s[+(X.getHours()>=12)]}function V(X){return 1+~~(X.getMonth()/3)}function tt(X){return o[X.getUTCDay()]}function ft(X){return n[X.getUTCDay()]}function at(X){return h[X.getUTCMonth()]}function Tt(X){return a[X.getUTCMonth()]}function It(X){return s[+(X.getUTCHours()>=12)]}function et(X){return 1+~~(X.getUTCMonth()/3)}return{format:function(X){var $=S(X+="",b);return $.toString=function(){return X},$},parse:function(X){var $=C(X+="",!1);return $.toString=function(){return X},$},utcFormat:function(X){var $=S(X+="",v);return $.toString=function(){return X},$},utcParse:function(X){var $=C(X+="",!0);return $.toString=function(){return X},$}}}var Uy={"-":"",_:" ",0:"0"},ce=/^\s*\d+/,I2=/^%/,A2=/[\\^$*+?|[\]().{}]/g;function Rt(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 R2(r){return r.replace(A2,"\\$&")}function Po(r){return new RegExp("^(?:"+r.map(R2).join("|")+")","i")}function Go(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function M2(r,t,e){var i=ce.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function L2(r,t,e){var i=ce.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function P2(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function G2(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function N2(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Xy(r,t,e){var i=ce.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Zy(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function F2(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 D2(r,t,e){var i=ce.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function k2(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Vy(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function O2(r,t,e){var i=ce.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Hy(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function B2(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function W2(r,t,e){var i=ce.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function U2(r,t,e){var i=ce.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function X2(r,t,e){var i=ce.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function Z2(r,t,e){var i=I2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function V2(r,t,e){var i=ce.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function H2(r,t,e){var i=ce.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Ky(r,t){return Rt(r.getDate(),t,2)}function K2(r,t){return Rt(r.getHours(),t,2)}function Y2(r,t){return Rt(r.getHours()%12||12,t,2)}function z2(r,t){return Rt(1+Mo.count(dr(r),r),t,3)}function Yy(r,t){return Rt(r.getMilliseconds(),t,3)}function j2(r,t){return Yy(r,t)+"000"}function J2(r,t){return Rt(r.getMonth()+1,t,2)}function $2(r,t){return Rt(r.getMinutes(),t,2)}function Q2(r,t){return Rt(r.getSeconds(),t,2)}function q2(r){var t=r.getDay();return t===0?7:t}function tA(r,t){return Rt(Bh.count(dr(r)-1,r),t,2)}function zy(r){var t=r.getDay();return t>=4||t===0?Sn(r):Sn.ceil(r)}function eA(r,t){return r=zy(r),Rt(Sn.count(dr(r),r)+(dr(r).getDay()===4),t,2)}function iA(r){return r.getDay()}function rA(r,t){return Rt(Wh.count(dr(r)-1,r),t,2)}function sA(r,t){return Rt(r.getFullYear()%100,t,2)}function nA(r,t){return r=zy(r),Rt(r.getFullYear()%100,t,2)}function oA(r,t){return Rt(r.getFullYear()%1e4,t,4)}function aA(r,t){var e=r.getDay();return r=e>=4||e===0?Sn(r):Sn.ceil(r),Rt(r.getFullYear()%1e4,t,4)}function hA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Rt(t/60|0,"0",2)+Rt(t%60,"0",2)}function jy(r,t){return Rt(r.getUTCDate(),t,2)}function lA(r,t){return Rt(r.getUTCHours(),t,2)}function cA(r,t){return Rt(r.getUTCHours()%12||12,t,2)}function uA(r,t){return Rt(1+Sd.count(Ls(r),r),t,3)}function Jy(r,t){return Rt(r.getUTCMilliseconds(),t,3)}function dA(r,t){return Jy(r,t)+"000"}function fA(r,t){return Rt(r.getUTCMonth()+1,t,2)}function pA(r,t){return Rt(r.getUTCMinutes(),t,2)}function mA(r,t){return Rt(r.getUTCSeconds(),t,2)}function gA(r){var t=r.getUTCDay();return t===0?7:t}function yA(r,t){return Rt(Wy.count(Ls(r)-1,r),t,2)}function $y(r){var t=r.getUTCDay();return t>=4||t===0?En(r):En.ceil(r)}function bA(r,t){return r=$y(r),Rt(En.count(Ls(r),r)+(Ls(r).getUTCDay()===4),t,2)}function xA(r){return r.getUTCDay()}function _A(r,t){return Rt(Uh.count(Ls(r)-1,r),t,2)}function vA(r,t){return Rt(r.getUTCFullYear()%100,t,2)}function wA(r,t){return r=$y(r),Rt(r.getUTCFullYear()%100,t,2)}function TA(r,t){return Rt(r.getUTCFullYear()%1e4,t,4)}function SA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?En(r):En.ceil(r),Rt(r.getUTCFullYear()%1e4,t,4)}function EA(){return"+0000"}function Qy(){return"%"}function qy(r){return+r}function tb(r){return Math.floor(+r/1e3)}var Cn,eb;CA({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 CA(r){return Cn=C2(r),eb=Cn.format,Cn.parse,Cn.utcFormat,Cn.utcParse,Cn}function IA(r){return new Date(r)}function AA(r){return r instanceof Date?+r:+new Date(+r)}function ib(r,t,e,i,s,n,o,a,h,l){var c=ky(),u=c.invert,d=c.domain,f=l(".%L"),m=l(":%S"),p=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),v=l("%Y");function T(S){return(h(S)<S?f:a(S)<S?m:o(S)<S?p:n(S)<S?g:i(S)<S?s(S)<S?y:x:e(S)<S?b:v)(S)}return c.invert=function(S){return new Date(u(S))},c.domain=function(S){return arguments.length?d(Array.from(S,AA)):d().map(IA)},c.ticks=function(S){var C=d();return r(C[0],C[C.length-1],S??10)},c.tickFormat=function(S,C){return C==null?T:l(C)},c.nice=function(S){var C=d();return(!S||typeof S.range!="function")&&(S=t(C[0],C[C.length-1],S??10)),S?d(p2(C,S)):c},c.copy=function(){return Dy(c,ib(r,t,e,i,s,n,o,a,h,l))},c}function RA(){return Ny.apply(ib(S2,E2,dr,Ed,Bh,Mo,Td,wd,Tn,eb).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function No(r,t,e){this.k=r,this.x=t,this.y=e}No.prototype={constructor:No,scale:function(r){return r===1?this:new No(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new No(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+")"}},No.prototype;function rb(r){return r.mode==="temporal"||r.mode==="left-aligned"?MA(r):LA(r)}function MA({domain:r,range:t}){return RA().domain(r).range(t)}function LA({domain:r,range:t}){return Oy().domain(r).range(t)}function Ad(r){return{mode:st.horizontal,range:TM(),domain:SM(r)}}function PA(){return{mode:st.vertical}}let In=null;async function GA(){const r=await gr();sb(r.start_time),q.on("layoutSettingsUpdated",()=>sb(r.start_time))}function NA(){In=null}async function ii(){return In||await Ie("scaleCreated")}async function sb(r){await ue();const t=In?"scaleUpdated":"scaleCreated",e=Ad(r);In=rb(e),q.emit(t,In)}let Ne=null,Rd=null;async function FA(){const r=await Qt(),t=await bu();Ne=new mI({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ne.zIndex=1,Ne.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Ne.on("moved",()=>{q.emit("viewportMoved",null)}).on("moved-end",()=>{q.emit("viewportMoved",null)}),r.stage.addChild(Ne),q.emit("viewportCreated",Ne),q.on("applicationResized",XA),q.on("scaleUpdated",()=>Fo()),WA()}function DA(){Ne=null,Rd=null}async function Md({animate:r}={}){const e=(await te()).getChildByName(Lf);if(!e)throw new Error("Nodes container not found");HA();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){OA({animate:r});return}kA({x:i,y:s,width:n,height:o,animate:r})}async function kA({x:r,y:t,width:e,height:i,animate:s}){const n=await Pt(),o=await te(),{guideTextSize:a,guideTextTopPadding:h,columnGap:l,rowGap:c,eventTargetSize:u}=n.styles,d=a+h,f=e+l*2,m=i+c*4+d+u,p=o.findFit(f,m);o.animate({position:{x:r+e/2,y:t+i/2+d},scale:Math.min(p,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Zh(),Fo()}})}async function OA({animate:r}){const t=await gr(),e=await Pt(),i=await te(),s=await ii();let n=s(t.start_time)-e.styles.columnGap,o=s(t.end_time??new Date)+e.styles.columnGap;if(n>o){const c=n;n=o,o=c}const a=o-n,h=n+a/2,l=i.findFit(a,0);i.animate({position:{x:h,y:0},scale:l,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Zh(),Fo()}})}async function te(){return Ne||await Ie("viewportCreated")}function nb(r){uy(Rd,r)||(Rd=r,q.emit("viewportDateRangeUpdated",r))}function BA({xOffset:r,yOffset:t}){if(!Ne)return;const{x:e,y:i}=Ne.transform.position;Ne.setTransform(e+r,i+t,Ne.transform.scale.x,Ne.transform.scale.y)}async function WA(){const r=await te();Fo(),r.on("moved",()=>Fo())}async function Fo(){const r=await ob();r&&nb(r)}async function ob(){const r=await te(),t=await ii(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function UA(r){const t=await ob(),e=await ue();if(r===void 0||e.isDependency()||uy(r,t))return;const i=await te(),s=await ii(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;nb(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function XA(){const r=await Qt(),t=await te(),e=await bu(),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),BA({xOffset:a,yOffset:h})}class Xh{constructor(){Tf(this,"status","visible");Tf(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 Bi=null,ri=null,Wi=null,fr=null,mi=null;async function ZA(){const r=await te(),t=await Qt();Bi=new kC({toggle:"renderable"}),ri=new Xh,Wi=new Xh,mi=new Xh,fr=new Xh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;mi==null||mi.toggle(e),ri==null||ri.toggle(i),Wi==null||Wi.toggle(s),fr==null||fr.toggle(n),Bi==null||Bi.cull(t.renderer.screen),r.dirty=!1}}),q.emit("cullCreated",Bi),q.emit("labelCullCreated",ri),q.emit("iconCullCreated",ri),q.emit("edgeCullCreated",mi),q.emit("toggleCullCreated",fr)}function VA(){Bi=null,ri==null||ri.clear(),ri=null,Wi==null||Wi.clear(),Wi=null,mi==null||mi.clear(),mi=null,fr==null||fr.clear(),fr=null}async function Zh(){const r=await te();r.dirty=!0}function HA(){Bi&&Bi.uncull()}async function ab(){return Bi||await Ie("cullCreated")}async function KA(){return mi||await Ie("edgeCullCreated")}async function hb(){return ri||await Ie("labelCullCreated")}async function YA(){return Wi||await Ie("iconCullCreated")}async function lb(){const r=await ue(),t=await Pt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return cy.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{Zh()}})}return{animate:e}}let Vh=new Map;function zA(){Vh=new Map}async function Do(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Vh.has(e))return Vh.get(e);const i=await r(...t);return Vh.set(e,i),i}async function jA({size:r,stroke:t=1,radius:e=0}){const i=await Qt(),s=new hn;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new gt(0,0,r,r),resolution:10})}async function ko(r){return await Do(jA,[r])}var Hh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Hh||{});function cb(){const r=new $t;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await ko(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function JA(){const r=await Qt(),t=new hn;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:vi.REPEAT})}async function Ld(){return await Do(JA,[])}function Pd(r,t){return Array.from({length:r},(e,i)=>t(i))}const $A=8,QA=2;async function qA(){const r=await Pt(),t=await ab(),e=await KA(),{animate:i}=await lb(),s=new Ct,{element:n,render:o}=await cb(),a=await Ld(),h=Pd(20,()=>new dt),l=new LS(a,h);let c=!1;s.name=sx,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Hh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,p){const g=f(p);c||await u();for(const[y,x]of h.entries()){const{x:b,y:v}=g[y];i(x,{x:b,y:v},!c)}i(s,{x:m.x,y:m.y},!c),i(n,{x:p.x-$A,y:p.y},!c),c=!0}function f({x:m,y:p}){const g=[],y={x:0,y:0},x={x:m-QA,y:p},b={x:ub(y.x,{source:y,target:x}),y:y.y},v={x:ub(x.x,{source:y,target:x},!0),y:x.y};for(const[T]of h.entries()){if(T===h.length-1){g[T]=x;continue}const S=tR(T,{source:y,target:x,sourceBezier:b,targetBezier:v});g[T]=S}return g}return{element:s,render:u,setPosition:d}}function ub(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function tR(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,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,m=h+(c-h)*e,p=l+(u-l)*e,g=c+(d-c)*e,y=f+(p-f)*e,x=m+(g-m)*e;return{x:y,y:x}}async function eR({height:r,radius:t}){const e=await Qt(),i=new hn;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new gt(0,0,t,r),resolution:10})}async function iR(r){return await Do(eR,[r])}function rR(){const r=new $t,t=new $t;async function e(i){const s=await iR(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 pr(){const r=await Ld();return new $t(r)}async function Gd(){const r=new Ct,t=await pr(),{left:e,right:i,render:s}=await rR();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,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),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,m=l?h.radius:0;return{width:d,visible:f,x:m}}return{element:r,render:n}}function Nd(){const r=new Ct,t=new $t,e=new $t,i=new $t,s=new $t,n=new $t,o=new $t,a=new $t,h=new $t;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(m){const{radius:p=0,color:g="#fff",stroke:y,width:x,height:b}=m,v=typeof p=="number",T={topLeft:c(v?p:p[0],x,b),topRight:c(v?p:p[1],x,b),bottomLeft:c(v?p:p[2],x,b),bottomRight:c(v?p:p[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:T}),await d({width:x,height:b,stroke:y,cornerSizes:T}),f(g),r}function c(m,p,g){const y=Math.min(p,g);return{size:m*2>y?y/2:m,radius:m}}async function u({width:m,height:p,stroke:g,cornerSizes:y}){const{topLeft:x,topRight:b,bottomLeft:v,bottomRight:T}=y,[S,C,I,R]=await Promise.all([ko({...x,stroke:g}),ko({...b,stroke:g}),ko({...v,stroke:g}),ko({...T,stroke:g})]);t.texture=S,e.texture=C,i.texture=R,s.texture=I,t.position.set(0,0),e.position.set(m-b.size,0),i.position.set(0,p-v.size),s.position.set(m-T.size,p-T.size)}async function d({width:m,height:p,stroke:g,cornerSizes:y}){const x=await Ld(),{topLeft:b,topRight:v,bottomLeft:T,bottomRight:S}=y;a.texture=x,n.texture=x,o.texture=x,h.texture=x,n.position.set(0,b.size),n.height=Math.max(p-b.size-T.size,0),n.width=g,o.position.set(m-g,v.size),o.height=Math.max(p-v.size-S.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(m-b.size-v.size,0),a.height=g,h.position.set(T.size,p-g),h.width=Math.max(m-T.size-S.size,0),h.height=g}function f(m){t.tint=m,e.tint=m,i.tint=m,s.tint=m,a.tint=m,n.tint=m,o.tint=m,h.tint=m}return{element:r,render:l}}async function Kh(){const r=await Pt(),t=new Ct,{element:e,render:i}=await Nd();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function sR(){const r=await Pt(),t=new Ct,{element:e,render:i}=await Gd(),{element:s,render:n}=await Kh();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const nR=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function oR(r){const t={resolution:4};return ot.from(nR[r],t)}async function aR(r){return await Do(oR,[r])}async function hR({cullAtZoomThreshold:r=!0}={}){const t=await YA(),e=new $t;r&&t.add(e);async function i(s){const n=await aR(s);return e.texture=n,e}return{element:e,render:i}}var db={exports:{}};(function(r){(function(){function t(p,g){document.addEventListener?p.addEventListener("scroll",g,!1):p.attachEvent("scroll",g)}function e(p){document.body?p():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),p()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),p())})}function i(p){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(p)),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(p,g){p.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(p){var g=p.g.offsetWidth,y=g+100;return p.j.style.width=y+"px",p.i.scrollLeft=y,p.h.scrollLeft=p.h.scrollWidth+100,p.l!==g?(p.l=g,!0):!1}function o(p,g){function y(){var b=x;n(b)&&b.g.parentNode!==null&&g(b.l)}var x=p;t(p.h,y),t(p.i,y),n(p)}function a(p,g,y){g=g||{},y=y||window,this.family=p,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(p){return l===null&&(f(p)&&/Apple/.test(window.navigator.vendor)?(p=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!p&&603>parseInt(p[1],10)):l=!1),l}function f(p){return u===null&&(u=!!p.document.fonts),u}function m(p,g){var y=p.style,x=p.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,x,c?p.stretch:"","100px",g].join(" ")}a.prototype.load=function(p,g){var y=this,x=p||"BESbswy",b=0,v=g||3e3,T=new Date().getTime();return new Promise(function(S,C){if(f(y.context)&&!d(y.context)){var I=new Promise(function(P,N){function F(){new Date().getTime()-T>=v?N(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),x).then(function(A){1<=A.length?P():setTimeout(F,25)},N)}F()}),R=new Promise(function(P,N){b=setTimeout(function(){N(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([R,I]).then(function(){clearTimeout(b),S(y)},C)}else e(function(){function P(){var V;(V=Z!=-1&&K!=-1||Z!=-1&&H!=-1||K!=-1&&H!=-1)&&((V=Z!=K&&Z!=H&&K!=H)||(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&&(Z==J&&K==J&&H==J||Z==B&&K==B&&H==B||Z==D&&K==D&&H==D)),V=!V),V&&(G.parentNode!==null&&G.parentNode.removeChild(G),clearTimeout(b),S(y))}function N(){if(new Date().getTime()-T>=v)G.parentNode!==null&&G.parentNode.removeChild(G),C(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(Z=F.g.offsetWidth,K=A.g.offsetWidth,H=k.g.offsetWidth,P()),b=setTimeout(N,50)}}var F=new i(x),A=new i(x),k=new i(x),Z=-1,K=-1,H=-1,J=-1,B=-1,D=-1,G=document.createElement("div");G.dir="ltr",s(F,m(y,"sans-serif")),s(A,m(y,"serif")),s(k,m(y,"monospace")),G.appendChild(F.g),G.appendChild(A.g),G.appendChild(k.g),y.context.document.body.appendChild(G),J=F.g.offsetWidth,B=A.g.offsetWidth,D=k.g.offsetWidth,N(),o(F,function(V){Z=V,P()}),s(F,m(y,'"'+y.family+'",sans-serif')),o(A,function(V){K=V,P()}),s(A,m(y,'"'+y.family+'",serif')),o(k,function(V){H=V,P()}),s(k,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(db);var lR=db.exports;const cR=Us(lR),fb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},pb={resolution:4,chars:fi.ASCII},mb="sans-serif",gb={inter:pR(fb.inter)};let Fd=!1;async function uR(){const r=Object.values(fb);await Promise.all(r.map(t=>dR(t))),Fd=!0,q.emit("fontsLoaded",gb)}async function dR(r){const{fontFamily:t,...e}=r,i=new cR(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${mb}`),fi.from(t,{fontFamily:mb,...e},pb);return}fi.from(t,r,pb)}function fR(){Fd=!1}async function yb(){return Fd?gb:await Ie("fontsLoaded")}function pR(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new nE(s,i)}async function Yh({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await yb(),e=await hb(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const mR=["result","markdown","table","unknown"],bb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Dd=["flow-run","task-run"];function gR(r){return Dd.includes(r)}function zh(r){return Dd.includes(r.kind)}function xb(r){return r.kind==="artifact"}function _b(r){return r.kind==="artifacts"}function vb(r){return r.kind==="state"}function wb(r){return r.kind==="event"}function Tb(r){return r.kind==="events"}const yR=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function Sb({cullAtZoomThreshold:r}){const t=await Pt(),e=new Ct,i=new Ct,{element:s,render:n}=await hR({cullAtZoomThreshold:r}),{element:o,render:a}=await Yh({cullAtZoomThreshold:r}),{element:h,render:l}=await sR();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:x,name:b,type:v}=y;c=x??c,u=b??u,d=v??d}return await Promise.all([m(),p()]),await g(),e}async function m(){if(!d)return s;const y=bb[d],{artifactIconSize:x,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:T}=t.styles,S=await n(y);return S.position={x:v,y:T},S.width=x,S.height=x,S.tint=b,S}async function p(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:x,artifactTextColor:b,artifactIconSize:v,artifactContentGap:T}=t.styles,S=y+v+T,C=x;return o.tint=b,o.scale.set(.75),o.position={x:S,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:x,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+x,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let Kt=null,jh=!1;async function bR(){const r=await te();r.on("click",()=>Ui(null)),r.on("drag-start",()=>{jh=!0}),r.on("drag-end",()=>{setTimeout(()=>{jh=!1})})}function xR(){Kt=null,jh=!1}function Ui(r){if(!jh&&!(!r&&!Kt||r&&mr(r))){if(Kt=r,r===null){q.emit("itemSelected",null);return}q.emit("itemSelected",r)}}function mr(r){if(Kt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return zh(Kt)&&Kt.id===r.id;case"flow-run":return zh(Kt)&&Kt.id===r.id;case"artifact":return xb(Kt)&&Kt.id===r.id;case"artifacts":return _b(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));case"state":return vb(Kt)&&Kt.id===r.id;case"event":return wb(Kt)&&Kt.id===r.id;case"events":return Tb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function _R(){return Kt&&zh(Kt)?Kt:null}async function kd(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Sb({cullAtZoomThreshold:t});let n=!1;i.eventMode="static",i.cursor="pointer",e&&i.on("click",c=>{c.stopPropagation(),Ui({kind:"artifact",id:r.id})}),q.on("itemSelected",()=>{const c=mr({kind:"artifact",id:r.id});c!==n&&(n=c,o())});async function o(){await s({selected:n,name:r.key,type:r.type})}function a(){return n}function h(){return r.created}function l(){return r.id}return{element:i,render:o,getSelected:a,getDate:h,getId:l}}async function Eb(r,t,e){const i=await gr(),s=await Pt();let n,o=null;async function a(){try{o=await s.fetchEvents(r,z.toValue(e)),t(o)}catch(l){console.error(l)}i.end_time||(n=setTimeout(()=>a(),zg(i)))}function h(){clearInterval(n)}return{start:a,stop:h}}async function vR(){const r=await Pt(),t=await hb(),e=new Ct,{element:i,render:s}=await cb(),{element:n,render:o}=await Gd(),{element:a,render:h}=await Nd();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:m}){l=f;const p={size:10,stroke:2,rotate:m?Hh.Up:Hh.Down},g=await s(p),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},x=await o(y);x.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:x.height/2,x:x.width/2},T=p.size/4;return g.x=v.x,g.y=m?v.y+T:v.y-T,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function Cb(){const r=await Pt(),t=await ue(),e=new Ct,{element:i,render:s}=await Gd(),{element:n,render:o}=await Kh();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=mr({kind:l.kind,id:l.id}),m=h(l,d),p=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:m,height:u,radius:d,background:c,capRight:p}),o({selected:f,width:m,height:u})]),i}function h(l,c){const u=Bd();if(st.isTemporal()||st.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,p=Pf(f,d)/oa*u;return Math.max(p,c*2)}return u}return{element:e,render:a}}var Ib="Expected a function",Ab=NaN,wR="[object Symbol]",TR=/^\s+|\s+$/g,SR=/^[-+]0x[0-9a-f]+$/i,ER=/^0b[01]+$/i,CR=/^0o[0-7]+$/i,IR=parseInt,AR=typeof ve=="object"&&ve&&ve.Object===Object&&ve,RR=typeof self=="object"&&self&&self.Object===Object&&self,MR=AR||RR||Function("return this")(),LR=Object.prototype,PR=LR.toString,GR=Math.max,NR=Math.min,Od=function(){return MR.Date.now()};function FR(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(Ib);t=Rb(t)||0,Jh(e)&&(c=!!e.leading,u="maxWait"in e,n=u?GR(Rb(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(S){var C=i,I=s;return i=s=void 0,l=S,o=r.apply(I,C),o}function m(S){return l=S,a=setTimeout(y,t),c?f(S):o}function p(S){var C=S-h,I=S-l,R=t-C;return u?NR(R,n-I):R}function g(S){var C=S-h,I=S-l;return h===void 0||C>=t||C<0||u&&I>=n}function y(){var S=Od();if(g(S))return x(S);a=setTimeout(y,p(S))}function x(S){return a=void 0,d&&i?f(S):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:x(Od())}function T(){var S=Od(),C=g(S);if(i=arguments,s=this,h=S,C){if(a===void 0)return m(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return T.cancel=b,T.flush=v,T}function DR(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Ib);return Jh(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),FR(r,t,{leading:i,maxWait:t,trailing:s})}function Jh(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function kR(r){return!!r&&typeof r=="object"}function OR(r){return typeof r=="symbol"||kR(r)&&PR.call(r)==wR}function Rb(r){if(typeof r=="number")return r;if(OR(r))return Ab;if(Jh(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=Jh(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(TR,"");var e=ER.test(r);return e||CR.test(r)?IR(r.slice(2),e?2:8):SR.test(r)?Ab:+r}var BR=DR;const Mb=Us(BR);async function Lb(){const{element:r,render:t}=await Sb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",q.on("itemSelected",()=>{const l=mr({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function WR(){const r=await Qt(),t=await gr(),{element:e,render:i,update:s}=await Hb({isRoot:!0});e.zIndex=4,r.stage.addChild(e);function n(o){i(o==null?void 0:o.artifacts)}t.artifacts&&n(t),q.on("viewportMoved",()=>s()),q.on("runDataCreated",o=>n(o)),q.on("runDataUpdated",o=>n(o)),q.on("configUpdated",()=>n())}function pL(){}async function UR({radius:r}){const t=await Qt(),e=new hn;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:10})}async function XR(r){return await Do(UR,[r])}async function Pb(r){const t=await XR(r);return new $t(t)}async function Gb(r){const t=new Ct,e=await Pt(),i=await pr(),s=await Pb({radius:e.styles.eventRadiusDefault}),{element:n,render:o}=await Kh();let a=!1;t.addChild(i),t.addChild(s),t.addChild(n),t.eventMode="static",t.cursor="pointer",t.on("mouseenter",()=>{a||s.scale.set(1.5)}),t.on("mouseleave",()=>{a||s.scale.set(1)}),q.on("itemSelected",()=>{const u=mr({kind:"event",id:r.id,occurred:r.occurred});u!==a&&(a=u,s.scale.set(u?1.5:1),h())});function h(){const{eventColor:u,eventTargetSize:d,eventSelectedBorderInset:f}=e.styles;i.alpha=0,i.width=d,i.height=d,s.tint=u,s.anchor.set(.5),s.position.set(d/2,d/2),n.position.set(f,f),o({selected:a,width:d-f*2,height:d-f*2})}function l(){return r.id}function c(){return r.occurred}return{element:t,render:h,getId:l,getDate:c}}async function Nb(){const r=new Ct,t=await Pt(),e=await pr(),i=await Pb({radius:t.styles.eventClusterRadiusDefault}),{element:s,render:n}=await Kh(),{element:o,render:a}=await Yh({cullAtZoomThreshold:!1});let h=null,l=[],c=!1;r.addChild(e),r.addChild(i),r.addChild(o),r.addChild(s),r.eventMode="static",r.cursor="pointer",r.on("mouseenter",()=>{c||i.scale.set(1.5)}),r.on("mouseleave",()=>{c||i.scale.set(1)}),q.on("itemSelected",()=>{const x=mr({kind:"events",occurred:h,ids:l});x!==c&&(c=x,i.scale.set(x?1.5:1),h&&u({ids:l,date:h}))});async function u(x){if(!x){h=null,l=[],r.visible=!1;return}const{ids:b,date:v}=x;h=v,l=b,d(),f(),p(),await m(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t.styles;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t.styles;i.tint=x,i.anchor.set(.5),i.position.set(b/2,b/2)}async function m(x){if(l.length<2)return;const{eventTargetSize:b}=t.styles,v=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+v),await a(x)}function p(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t.styles;s.position.set(x,x),n({selected:c,width:b-x*2,height:b-x*2})}function g(){return l}function y(){return h}return{element:r,render:u,getIds:g,getDate:y}}function Vr(r){return"getIds"in r}async function Fb({items:r,createCluster:t}){const e=[...r.values()].sort((o,a)=>o.element.x-a.element.x);async function i(o){let a,h=null,l=null;for(let c=o??0;c<e.length;c++){const u=e[c],d=u.element.x;if(u.element.visible=!0,h!==null&&a&&d<a){l=c;break}h=c,a=d+u.element.width}if(l!==null&&h!==null){const c=e[h],u=e[l];c.element.visible=!1,u.element.visible=!1;const d=await s(c,u);d&&(e.splice(h,1,d),e.splice(l,1)),i(h)}}async function s(o,a){const h=o.getDate(),l=a.getDate(),c=Vr(o)?o.getIds():[o.getId()],u=Vr(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Vr(o)?d=o:Vr(a)?d=a:d=await t();const f=[...c,...u],m=n(f);return await d.render({ids:f,date:m}),d}function n(o){const a=o.reduce((c,u)=>{const d=r.get(u),f=d==null?void 0:d.getDate();return f&&c.push(f.getTime()),c},[]),h=Math.min(...a),l=Math.max(...a);return new Date((h+l)/2)}await i()}async function Db(r){const t=await Qt(),e=await te(),i=await Pt(),s=await ue();let n=await ii();const o=await h();o.element.on("click",c=>{c.stopPropagation();const{element:u}=o,d={x:u.position.x,y:u.position.y,width:u.width,height:u.height},f=Vr(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Ui(f)}),q.on("scaleUpdated",c=>{n=c,l()}),q.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Gb(r.event):await Nb()}function l(){const c=o.getDate();if(!c||s.disableEvents||!st.isTemporal())return;const{element:u}=o,f=n(c)*e.scale._x+e.worldTransform.tx-u.width/2,m=t.screen.height-u.height-i.styles.eventBottomMargin;u.position.set(f,m)}return{...o,render:a}}async function kb(r){const t=await te(),e=await ue();let i=await ii();const s=await o();s.element.on("click",h=>{h.stopPropagation();const{element:l}=s,c=l.getGlobalPosition(),u={x:c.x,y:c.y,width:l.width*t.scale.x,height:l.height*t.scale.y},d=Vr(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Ui(d)}),q.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Gb(r.event):await Nb()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!st.isTemporal()||!l)return;const{element:c}=s,d=i(h)-i(l)-c.width/2,f=-c.height;c.position.set(d,f)}return{...s,render:n}}async function Ob({isRoot:r,parentStartDate:t}={}){const e=await ue(),i=new Map,s=[];let n=[];const o=new Ct;let a=null;q.on("layoutSettingsUpdated",()=>h()),q.on("scaleUpdated",()=>c());async function h(f){if(st.isTemporal()?o.visible=!e.disableEvents:o.visible=!1,e.disableEvents||!st.isTemporal()||(f&&(a=f),!a))return;const m=[];for(const p of a)m.push(l(p));await Promise.all(m),c()}async function l(f){if(i.has(f.id))return i.get(f.id).render();const m=r?await Db({type:"event",event:f}):await kb({type:"event",event:f,parentStartDate:t});return i.set(f.id,m),o.addChild(m.element),m.render()}function c(){e.disableEvents||!st.isTemporal()||u()}const u=Mb(async()=>{n=[...s],await Fb({items:i,createCluster:d});for(const f of n)f.render()},250);async function d(){if(n.length>0)return n.pop();const f=r?await Db({type:"cluster"}):await kb({type:"cluster",parentStartDate:t});return o.addChild(f.element),s.push(f),f}return{element:o,render:h,update:c}}let Oo=null,An=null;async function ZR(){const r=await Qt(),t=await Pt(),{element:e,render:i,update:s}=await Ob({isRoot:!0});e.zIndex=2,r.stage.addChild(e);const n=await Eb(t.runId,async o=>{const a=An?"eventDataUpdated":"eventDataCreated";An=o,q.emit(a,An),await ue(),i(o)});q.on("configUpdated",()=>i()),q.on("viewportMoved",()=>s()),Oo=n.stop,n.start()}function VR(){Oo==null||Oo(),Oo=null,An=null}async function HR(){return An||await Ie("eventDataCreated")}async function KR(r){const t=await Qt(),e=await te(),i=await Pt(),s=await gr();let n=await ii();const o=new Ct,a=await pr(),h=await pr();let l=null,c=!1,u=!1;t.stage.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{c=!0,d()}),a.on("mouseleave",()=>{c=!1,d()}),a.on("click",()=>{const b={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Ui({...r,kind:"state",position:b})}),q.on("viewportMoved",()=>d()),q.on("scaleUpdated",b=>{n=b,d()}),q.on("itemSelected",()=>{const b=mr({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:v}=b??{};if(v&&(l=v),s.end_time&&y(),!st.isTemporal()){h.visible=!1,o.visible=!1;return}const T=f();m(T),p(T),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.styles.state(r),v=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let T=0;return r.type==="RUNNING"&&!s.end_time?T=n(new Date)*e.scale._x+e.worldTransform.tx-v:l?T=n(l)*e.scale._x+e.worldTransform.tx-v:T=t.screen.width-v,{x:v,width:Math.max(T,0),background:b}}function m({x:b,width:v,background:T}){const{flowStateBarHeight:S,flowStateSelectedBarHeight:C}=i.styles,I=c||u?C:S;a.x=b,a.y=t.screen.height-I,a.width=v,a.height=I,a.tint=T}function p({x:b,width:v,background:T}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:S,flowStateAreaAlpha:C}=i.styles;h.x=b,h.y=0,h.width=v,h.height=t.screen.height-S,h.tint=T,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function YR(r){return"isNodesFlowRunStateFactory"in r}async function zR(r){const t=await Qt(),e=await te(),i=await Pt(),s=await gr();let n=await ii();const o=new Ct,a=await pr(),h=await pr();let l=null,c=null,u=0,d=0,f=!1,m=!1;o.visible=!1,o.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{f=!0,p()}),a.on("mouseleave",()=>{f=!1,p()}),a.on("click",S=>{S.stopPropagation();const C=a.getGlobalPosition(),I={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Ui({...r,kind:"state",position:I})}),h.eventMode="none",h.cursor="default",q.on("scaleUpdated",S=>{n=S,p()}),q.on("itemSelected",()=>{const S=mr({kind:"state",...r});S!==m&&(m=S,f=!1,p())}),r.type==="RUNNING"&&!s.end_time&&b();function p(S){const{end:C,parentStartDate:I,width:R,height:P}=S??{};if(C&&(l=C),I&&(c=I),R&&(u=R),P&&(d=P),s.end_time&&v(),!st.isTemporal()){o.visible=!1;return}if(!l&&r.type!=="RUNNING")return;if(!c||u<=0){o.visible=!1;return}const N=g();y(N),x(N),o.visible=!0}function g(){const{background:S="#fff"}=i.styles.state(r);let C=n(r.timestamp)-n(c);C<0&&(C=0);const R=(l?n(l)-n(c):u-C)-C;return{x:C,width:Math.max(R,0),background:S}}function y({x:S,width:C,background:I}){const{flowStateBarHeight:R,flowStateSelectedBarHeight:P}=i.styles,N=f||m?P:R;a.x=S,a.y=d-N,a.width=C,a.height=N,a.tint=I}function x({x:S,width:C,background:I}){const{flowStateBarHeight:R,flowStateAreaAlpha:P,nodeHeight:N}=i.styles,F=N/2;h.x=S,h.y=F,h.width=C,h.height=d-R-F,h.tint=I,h.alpha=P}function b(){t.ticker.add(T)}function v(){t.ticker.remove(T)}function T(){p()}return{element:o,render:p,isNodesFlowRunStateFactory:!0}}function Bb({isRoot:r}={}){const t=new Ct,e=new Map,i=new Map;let s=null;async function n(a,h){if(a&&(s=a),!s)return;const l=[];for(let c=0;c<s.length;c++)l.push(o(s[c],c,h));await Promise.all(l)}async function o(a,h,l){const c=s&&s.length>=h+1&&s[h+1],u=c?c.timestamp:void 0;let d;if(i.has(a.id)&&await i.get(a.id),e.has(a.id))d=e.get(a.id);else{const f=(async()=>{const m=r?await KR(a):await zR(a);e.set(a.id,m),t.addChild(m.element)})();i.set(a.id,f),await f,i.delete(a.id),d=e.get(a.id)}YR(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}async function jR(){const r=await Qt(),t=await gr(),{element:e,render:i}=await Bb({isRoot:!0});e.zIndex=3,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),q.on("runDataUpdated",n=>s(n)),q.on("configUpdated",()=>s()),q.on("layoutSettingsUpdated",()=>s())}function mL(){}async function JR(){const r=await Qt(),t=await te(),e=await ue(),i=await Pt(),{inter:s}=await yb(),n=new Ct,o=await pr();n.addChild(o);const a=s("");n.addChild(a);let h=await ii(),l,c;q.on("scaleUpdated",p=>{h=p,m()}),q.on("viewportMoved",()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function u(p,g){l=p,c=g,d(),f(p)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(p){a.text=c(p),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:u}}class Wb extends Error{constructor(){super("Layout is not temporal")}}function $R(r){return r.toLocaleTimeString()}function Ub(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function QR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function qR(r){return r.getHours()===0&&r.getMinutes()===0?`${$h.date(r)}
1176
- ${Ub(r)}`:Ub(r)}const $h={timeBySeconds:$R,timeByMinutesWithDates:qR,date:QR},se={seconds:"seconds",minutes:"minutes",date:"date"},Bo={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()}},At={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Xb=[{ceiling:At.second*4,increment:At.second,labelFormat:se.seconds},{ceiling:At.second*8,increment:At.second*5,labelFormat:se.seconds},{ceiling:At.second*13,increment:At.second*10,labelFormat:se.seconds},{ceiling:At.second*20,increment:At.second*15,labelFormat:se.seconds},{ceiling:At.second*45,increment:At.second*30,labelFormat:se.seconds},{ceiling:At.minute*4,increment:At.minute,labelFormat:se.minutes},{ceiling:At.minute*8,increment:At.minute*5,labelFormat:se.minutes},{ceiling:At.minute*13,increment:At.minute*10,labelFormat:se.minutes},{ceiling:At.minute*28,increment:At.minute*15,labelFormat:se.minutes},{ceiling:At.hour*1.24,increment:At.minute*30,labelFormat:se.minutes},{ceiling:At.hour*3,increment:At.hour,labelFormat:se.minutes},{ceiling:At.hour*8,increment:At.hour*2,getAnchor:Bo.day,labelFormat:se.minutes},{ceiling:At.hour*13,increment:At.hour*6,getAnchor:Bo.day,labelFormat:se.minutes},{ceiling:At.hour*22,increment:At.hour*12,getAnchor:Bo.day,labelFormat:se.minutes},{ceiling:At.day*4,increment:At.day,getAnchor:Bo.day,labelFormat:se.date},{ceiling:At.week*2,increment:At.week,getAnchor:Bo.week,labelFormat:se.date},{ceiling:1/0,increment:At.week*4,labelFormat:se.date}],tM=300;async function eM(){const r=await te(),t=await ue(),e=new Ct,i=new Map;let s=await ii();q.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:m}=a(),p=u(d,f);c(p,m)}catch(d){if(d instanceof Wb)return;console.error(d)}}async function o(){const d=[];Pd(30,async f=>{const m=JR();d.push(m);const p=await m;e.addChild(p.element),i.set(f,p)}),await Promise.all(d)}function a(){const d=r.left-tM,f=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(m instanceof Date))throw new Wb;const p=m.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:x}=h(p);return{anchor:y(f),increment:g,labelFormat:l(x)}}function h(d){const f=Xb.find(m=>m.ceiling>d)??Xb[0];return f.getAnchor||(f.getAnchor=m=>Math.floor(m.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case se.minutes:return $h.timeByMinutesWithDates;case se.date:return $h.date;default:return $h.timeBySeconds}}function c(d,f){const m=new Map(i.entries()),p=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const x=m.get(g);i.set(g,x),x.render(new Date(g),f);continue}const y=m.get(p.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Pd(30,m=>d+f*m)}return{element:e,render:n}}async function iM(){const r=await Qt(),{element:t,render:e}=await eM();r.stage.addChild(t),e(),q.on("viewportDateRangeUpdated",()=>e()),q.on("layoutSettingsUpdated",()=>e()),q.on("configUpdated",()=>e())}function gL(){}const rM=80;async function sM(){const r=await Qt(),t=await te(),e=await ue(),i=await Pt(),s=await pr();let n=await ii();q.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-rM))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function nM(){const r=await Qt(),t=await gr(),{element:e,render:i}=await sM();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),q.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function yL(){}function oM({stage:r,props:t}){uE(),FA(),GA(),iM(),mM(),WR(),ZR(),jR(),nM(),yE(),uR(),lE(r),vE(t),ZA(),vM(),bR()}function aM(){q.clear();try{dE(),DA(),NA(),cE(),gM(),VR(),wE(),bE(),fR(),VA(),wM(),xR(),zA()}catch(r){console.error(r)}}async function Zb(r){const t=await Qt(),e=await te(),i=await Pt(),s=await ue(),n=await HR();let o=await ii(),a=n&&n.length>0;const h=await c();h.element.on("click",d=>{d.stopPropagation();const{element:f}=h,m=f.getGlobalPosition(),p={x:m.x,y:m.y,width:f.width,height:f.height},g=Vr(h)?{kind:"artifacts",ids:h.getIds(),position:p}:{kind:"artifact",id:h.getId()};Ui(g)}),q.on("scaleUpdated",d=>{o=d,u()}),q.on("viewportMoved",()=>u()),q.on("eventDataCreated",d=>{a=d.length>0,u()}),q.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){await h.render(d),u()}async function c(){return r.type==="artifact"?await kd(r.artifact,{cullAtZoomThreshold:!1}):await Lb()}function u(){const d=h.getDate();if(!d||!st.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:m}=h,{eventTargetSize:p,flowStateSelectedBarHeight:g}=i.styles;let y=0;if(f){const{selectedBorderOffset:T,selectedBorderWidth:S}=i.styles;y=T+S*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(m.width-y)/2,v=t.screen.height-(m.height-y)-(a?p:g);m.position.set(b,v)}return{...h,render:l}}async function Vb(r){const t=await te(),e=await Pt(),i=await ue();let s=await ii();const n=await a();n.element.on("click",l=>{console.log("artifact click"),l.stopPropagation();const{element:c}=n,u=c.getGlobalPosition(),d={x:u.x,y:u.y,width:c.width*t.scale.x,height:c.height*t.scale.y},f=Vr(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Ui(f)}),q.on("scaleUpdated",l=>{s=l,h()});async function o(l){await n.render(l),h()}async function a(){return r.type==="artifact"?await kd(r.artifact):await Lb()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!st.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e.styles;f=y+x*2}const p=s(l)-s(c)-(d.width-f)/2,g=-(d.height-f);d.position.set(p,g)}return{...n,render:o}}async function Hb({isRoot:r,parentStartDate:t}={}){const e=await ue(),i=new Map,s=[];let n=[];const o=new Ct;let a=null;q.on("layoutSettingsUpdated",()=>h());async function h(f){if(st.isTemporal()?o.visible=!e.disableEvents:o.visible=!1,e.disableArtifacts||!st.isTemporal()||(f&&(a=f),!a))return;const m=[];for(const p of a)m.push(l(p));await Promise.all(m),c()}async function l(f){if(i.has(f.id))return i.get(f.id).render();const m=r?await Zb({type:"artifact",artifact:f}):await Vb({type:"artifact",artifact:f,parentStartDate:t});return i.set(f.id,m),o.addChild(m.element),m.render()}function c(){if(!(e.disableArtifacts||!st.isTemporal())){if(!st.isTemporal()){o.visible=!1;return}o.visible=!0,o.position.x=0,u()}}const u=Mb(async()=>{n=[...s],await Fb({items:i,createCluster:d});for(const f of n)f.render()},250);async function d(){if(n.length>0)return n.pop();const f=r?await Zb({type:"cluster"}):await Vb({type:"cluster",parentStartDate:t});return o.addChild(f.element),s.push(f),f}return{element:o,render:h,update:c}}class Kb extends Ct{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 hM(r){const t=new Kb,e=await Pt(),{element:i,render:s}=await Cb(),{element:n,render:o}=await Yh(),{element:a,render:h}=await vR(),{element:l,render:c}=await Nd(),{element:u,render:d,getSize:f,stopWorker:m}=await Jb(),{element:p,render:g}=await Bb(),{element:y,render:x,update:b}=await Ob({parentStartDate:r.start_time}),{element:v,render:T,update:S}=await Hb({parentStartDate:r.start_time});let C=!1,I=!1;t.sortableChildren=!0,i.zIndex=2,n.zIndex=3,a.zIndex=3,l.zIndex=0,u.zIndex=1,y.zIndex=2,p.zIndex=3,v.zIndex=4,l.eventMode="none",l.cursor="default";const{start:R,stop:P}=await Yg(r.id,et=>{I=!!et.artifacts&&et.artifacts.length>0,d(et),B(et.states),G(et.artifacts),J()});function N(){return{since:r.start_time,until:r.end_time??new Date}}const{start:F,stop:A}=await Eb(r.id,et=>{C=et.length>0,D(et)},N);let k=r,Z=!1;t.addChild(i),t.addChild(n),t.addChild(a),a.on("click",et=>{et.stopPropagation(),H()}),u.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},u.on("rendered",()=>{Zh(),Tt()});async function K(et){return k=et,await s(et),await ft(),await at(et),t}async function H(){Z?await tt():await V()}async function J(){const{background:et="#fff"}=e.styles.node(r),{width:X,height:$}=f(),{height:j}=It(),{nodeBorderRadius:O}=e.styles,mt=2;l.position={x:-mt,y:-mt};const yt=st.isTemporal()?j+mt*2:$+mt*2;await c({width:X+mt*2,height:yt,stroke:mt,radius:[O,O,0,0],color:et})}async function B(et){const{width:X,height:$}=It(),j=Math.max(i.width,X);await g(et??void 0,{parentStartDate:k.start_time,width:j,height:$})}async function D(et){const{height:X}=It();if(y.position={x:0,y:X-e.styles.eventBottomMargin},et){await x(et);return}await b()}async function G(et){const{eventTargetSize:X,flowStateSelectedBarHeight:$}=e.styles,{height:j}=It(),O=j-(C?X:$);if(v.position={x:0,y:O},et){await T(et);return}await S()}async function V(){Z=!0,t.addChild(p),t.addChild(y),t.addChild(v),t.addChild(u),t.addChild(l),await Promise.all([R(),F(),K(k)]),Tt()}async function tt(){Z=!1,t.removeChild(p),t.removeChild(y),t.removeChild(v),t.removeChild(u),t.removeChild(l),m(),await Promise.all([P(),A(),K(k)]),Tt()}async function ft(){const et=e.styles.nodeToggleSize,X=e.styles.nodeHeight-et,$=i.width>et,j=await h({inside:$,isOpen:Z});return j.x=$?X/2:i.width+e.styles.nodePadding,j.y=X/2,j}async function at(et){const X=await o(et.label),$=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,j=e.styles.nodePadding,O=a.x+a.width+j,mt=i.width+j,yt=i.width>O+X.width+j,Mt=e.styles.nodeHeight/2-X.height/2,Nt=yt?O:Math.max(mt,O);return X.position={x:Nt,y:Mt},X.tint=yt?$:e.styles.textDefault,X}function Tt(){Z&&(B(),D(),G(),J());const et=It();t.emit("resized",et)}function It(){const et=f(),{nodeHeight:X,nodesPadding:$,eventTargetSize:j,eventBottomMargin:O,artifactPaddingY:mt,artifactIconSize:yt}=e.styles,Mt=I?yt+mt*2:0,Nt=C?j+O:0,Ee=Z?et.height+Mt+Nt+$*2:0,Ze=Z?et.width:0;return{height:X+Ee,width:Math.max(Ze,t.width)}}return{kind:"flow-run",element:t,bar:i,render:K}}async function lM(){const r=await Pt(),t=new Kb,{element:e,render:i}=await Yh(),{element:s,render:n}=await Cb();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,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function cM(r){const t=await Pt(),e=await Qt(),i=await ab(),s=await ue();let n=null;const o=new Map,{animate:a}=await lb(),{element:h,render:l,bar:c}=await C(r);let u=r,d=null,f=!1,m=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=rx,h.on("click",P=>{P.stopPropagation(),Ui({kind:u.kind,id:u.id})}),r.end_time||v(),q.on("itemSelected",()=>{const P=mr({kind:u.kind,id:u.id});P!==f&&(f=P,l(u))});async function p(P){u=P;const N=I(P);return N===d||(d=N,await Promise.all([l(P),g(P.artifacts)]),n&&(n.visible=st.isTemporal()?!s.disableArtifacts:!1),P.end_time&&T()),h}async function g(P){if(!P||s.disableArtifacts||!st.isTemporal())return;n||x();const N=[];for(const F of P)N.push(y(F));await Promise.all(N),b()}async function y(P){if(o.has(P.id))return o.get(P.id).render();const N=await kd(P,{enableLocalClickHandling:!0});return o.set(P.id,N),n.addChild(N.element),N.render()}function x(){n=new Ct,h.addChild(n)}function b(){if(!n)return;const{artifactsGap:P,artifactsNodeOverlap:N}=t.styles;let F=0;for(const A of o.values())A.element.position.x=F,F+=A.element.width+P;n.position.y=-n.height+N,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(S)}function T(){e.ticker.remove(S)}function S(){p(r)}async function C(P){const{kind:N}=P;switch(N){case"task-run":return await lM();case"flow-run":return await hM(P);default:const F=N;throw new Error(`switch does not have case for value: ${F}`)}}function I(P){var k;const N=P.end_time??new Date,F=((k=P.artifacts)==null?void 0:k.length)??0;return[P.state_type,N.getTime(),F,st.horizontal,st.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function R({x:P,y:N}){a(h,{x:P,y:N},!m),m=!0}return{element:h,render:p,bar:c,setPosition:R}}function Yb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[m,p]of e.entries())if(p.has(u)){d=m,f=p.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function uM(r){throw new Error(`switch does not have case for value: ${r}`)}const zb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCk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6IFNraXBwaW5nICR7bC5sYWJlbH1gKTtjb250aW51ZX1pPU1hdGgubWF4KGksZyksYT1NYXRoLm1heChhLGYuY29sdW1uKSxvLnNldCh1LHsuLi5mLHk6Zyxyb3c6Z30pfWtvKHt0eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",dM=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),jb=typeof window<"u"&&window.Blob&&new Blob([dM(zb)],{type:"text/javascript;charset=utf-8"});function fM(r){let t;try{if(t=jb&&(window.URL||window.webkitURL).createObjectURL(jb),!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:text/javascript;base64,"+zb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function pM(r){const t=new fM;return t.onmessage=r,t}async function Jb(){const r=new Map,t=new Map,e=new Ct,i=new Ct,s=await Pt();let n=null;const o=Yb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Yb({gap:()=>s.styles.columnGap,minimum:()=>Bd()});let h=null,l=null;e.name=Lf,q.on("layoutUpdated",()=>{o.clear(),a.clear()}),q.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),A()}),q.on("itemSelected",()=>{A()});async function c(B){u(),l=B,h=null,await Promise.all([f(B),p(B)]),y(B)}function u(){n||(n=pM(N))}function d(){n&&(n.terminate(),n=null)}async function f(B){const D=[];for(const G of B.nodes.values())D.push(m(G));await Promise.all(D)}async function m(B){const{render:D}=await v(B);return await D(B)}async function p(B){if((await ue()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const G=[];for(const[V,{children:tt}]of B.nodes)for(const{id:ft}of tt)G.push(g(V,ft));await Promise.all(G)}async function g(B,D){const G=`${B}_${D}`;if(t.has(G))return;const V=await qA();t.has(G)||(t.set(G,V),i.addChild(V.element))}function y(B){if(!n)throw new Error("Layout worker not initialized");const D=new Map;for(const[G,{element:V}]of r)D.set(G,V.width);n.postMessage({type:"layout",data:B,widths:D,horizontalSettings:Ad(B.start_time),verticalSettings:PA()})}function x(){if(h)for(const[B,D]of t){const[G,V]=B.split("_"),tt=h.positions.get(G),ft=h.positions.get(V),at=r.get(G);if(!tt||!ft){console.warn(`Could not find edge in layout: Skipping ${B}`);continue}if(!at){console.warn(`Could not find parent node in nodes: Skipping ${G}`);continue}const Tt=at.bar.width,It=S(tt),et={x:It.x+Tt,y:It.y+s.styles.nodeHeight/2},X=S(ft),$={x:X.x-et.x,y:X.y-et.y+s.styles.nodeHeight/2};D.setPosition(et,$)}}function b(){if(h){for(const[B,D]of r){const G=h.positions.get(B);if(!G){console.warn(`Could not find node in layout: Skipping ${B}`);continue}const V=S(G);D.setPosition(V),o.updateNodeAxis({nodeId:B,axis:G.y}),a.updateNodeAxis({nodeId:B,axis:G.column})}x(),e.emit("rendered"),e.emit("resized",P())}}async function v(B){const D=r.get(B.id);if(D)return D;const G=await cM(B);return G.element.on("resized",V=>T(B.id,V)),r.set(B.id,G),e.addChild(G.element),G}function T(B,D){if(!h)return;const G=r.get(B),V=h.positions.get(B);!G||!V||(o.setOffset({nodeId:B,axis:V.y,offset:D.height}),a.setOffset({nodeId:B,axis:V.column,offset:D.width}),b())}function S(B){const D=o.getTotalOffset(B.y);return{x:C(B),y:D}}function C(B){return st.isDependency()?a.getTotalOffset(B.column):B.x}function I(){return h?o.getTotalValue(h.maxRow):0}function R(){if(!h||!l)return 0;if(st.isDependency())return a.getTotalValue(h.maxColumn);const B=Ad(l.start_time),D=rb(B),G=D(l.end_time??new Date),V=D(l.start_time);return G-V}function P(){return{width:R(),height:I()}}function N({data:B}){const{type:D}=B;switch(D){case"layout":F(B);return;default:uM(D)}}function F(B){h=B.layout,b()}async function A(){const B=await ue(),D=_R();if(B.disableEdges||!D||!(l!=null&&l.nodes.has(D.id))){k([]);return}const G=H(D.id);k(G)}function k(B){Z(B),K(B)}function Z(B){for(const[D,{element:G}]of r){if(B.length===0||B.includes(D)){G.alpha=1;continue}G.alpha=s.styles.nodeUnselectedAlpha}}function K(B){for(const[D,{element:G}]of t){const[V,tt]=D.split("_");if(B.length===0||B.includes(V)&&B.includes(tt)){G.alpha=1;continue}G.alpha=s.styles.nodeUnselectedAlpha}}function H(B){const D=J(B,"parents"),G=J(B,"children");return[B,...D,...G]}function J(B,D){const G=l==null?void 0:l.nodes.get(B);if(!G)return[];const V=[];for(const{id:tt}of G[D])V.push(tt),V.push(...J(tt,D));return V}return{element:e,stopWorker:d,getSize:P,render:c}}let Wo=null,Hr=null,Ps=null;async function mM(){const r=await te(),t=await Pt(),{element:e,render:i}=await Jb();r.addChild(e),e.alpha=0;const s=await Yg(t.runId,async n=>{const o=Hr?"runDataUpdated":"runDataCreated";Hr=n,q.emit(o,Hr),await ue(),i(n)});q.on("configUpdated",()=>{Hr&&i(Hr)}),Ps=e,Wo=s.stop,Ps.once("rendered",()=>yM()),q.on("layoutUpdated",()=>bM()),s.start()}function gM(){Wo==null||Wo(),Wo=null,Ps=null,Hr=null}async function gr(){return Hr||await Ie("runDataCreated")}function yM(){Md(),Te.shared.addOnce(()=>{Ps&&(Ps.alpha=1)})}async function bM(){if(!Ps)return;const r=await Pt();Ps.once("rendered",()=>{setTimeout(()=>{Md({animate:!0})},r.animationDuration)})}function xM(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function _M({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(lx(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap,a=.5,h=4;return(e.size>0?e.size*o*a:o*h)*s/(n*20)}async function vM(){const r=await gr(),t=await Pt(),e=await Qt(),i=e.view.width/e.view.height,s=_M(r,t,i);Qh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(st.disableAnimations=!0),xM(r.nodes)>t.disableEdgesThreshold&&(st.disableEdges=!0)}function wM(){st.horizontal="temporal",st.vertical="nearest-parent",st.horizontalScaleMultiplierDefault=0,st.horizontalScaleMultiplier=0,st.disableAnimations=!1,st.disableGuides=!1,st.disableEdges=!1,st.disableArtifacts=!1,st.disableEvents=!1}const st=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,disableEvents:!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 ue(){return Wd()?st:await Ie("layoutSettingsCreated")}function Bd(){return st.isDependency()?200:20*st.horizontalScaleMultiplier}function TM(){return[0,Bd()]}function SM(r){if(st.isDependency())return[0,1];const t=r,e=ax(t,1);return[t,e]}function Qh(r,t=!1){if(st.horizontalScaleMultiplier===r)return;const e=Rn();st.horizontalScaleMultiplier=r,t&&(st.horizontalScaleMultiplierDefault=r),e()}function EM(){Qh(st.horizontalScaleMultiplierDefault)}function CM(r){if(st.horizontal===r)return;const t=Rn();st.horizontal=r,st.disableGuides=st.isDependency()||st.isLeftAligned(),t()}function IM(r){if(st.vertical===r)return;const t=Rn();st.vertical=r,t()}function AM(r){if(st.disableEdges===r)return;const t=Rn();st.disableEdges=r,t()}function RM(r){if(st.disableArtifacts===r)return;const t=Rn();st.disableArtifacts=r,t()}function MM(r){if(st.disableEvents===r)return;const t=Rn();st.disableEvents=r,t()}function Rn(){const r=Wd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=st;return()=>{Wd()&&q.emit(r,st),(t!==st.horizontal||e!==st.vertical)&&q.emit("layoutUpdated")}}function Wd(){return st.horizontalScaleMultiplier!==0}function $b(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const LM={class:"flex items-center gap-2"},PM=z.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=z.computed({get(){return`${st.horizontal}_${st.vertical}`},set(u){const[d,f]=u.split("_");CM(d),IM(f)}}),s=z.computed({get(){return st.disableEdges},set(u){AM(u)}}),n=z.computed({get(){return st.disableArtifacts},set(u){RM(u)}}),o=z.computed({get(){return st.disableEvents},set(u){MM(u)}});function a(){const d=st.horizontalScaleMultiplier*1.25;Qh(d)}function h(){const u=Math.abs(-.75),d=st.horizontalScaleMultiplier*u;Qh(d)}_r.useKeyDown(["-","="],l);function l(u){if(!($b(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"-":h();break;case"=":a();break}}function c(){EM()}return(u,d)=>{const f=z.resolveComponent("p-radio-group"),m=z.resolveComponent("p-label"),p=z.resolveComponent("p-divider"),g=z.resolveComponent("p-checkbox"),y=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(zi.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:x})=>[z.createVNode(z.unref(zi.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:x},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(y,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(m,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(f,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=x=>i.value=x),options:e},{label:z.withCtx(({option:x})=>[z.createTextVNode(z.toDisplayString(x.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(st).isTemporal()||z.unref(st).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(p),z.createVNode(m,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",LM,[z.createVNode(z.unref(zi.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:h}),z.createVNode(z.unref(zi.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),z.createVNode(z.unref(zi.PButton),{small:"",onClick:c},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(p),z.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=x=>s.value=x),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(g,{modelValue:n.value,"onUpdate:modelValue":d[2]||(d[2]=x=>n.value=x),label:"Hide artifacts"},null,8,["modelValue"]),z.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[3]||(d[3]=x=>o.value=x),label:"Hide Events"},null,8,["modelValue"])]),_:1})]),_:1})}}}),GM={class:"run-graph__actions"},NM=z.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=z.ref(),s=z.ref(!1),n=z.computed({get(){return e.fullscreen??s.value},set(c){s.value=c,t("update:fullscreen",c)}});z.watch(()=>e.selected,c=>Ui(c)),q.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>UA(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));q.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Md({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");oM({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{aM()}),_r.useKeyDown(["c","f","Escape"],l);function l(c){if(!($b(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(c,u)=>{const d=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",o.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),z.createElementVNode("div",GM,[z.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),z.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),z.createVNode(PM)])],2)}}});Ft.RunGraph=NM,Ft.artifactTypeIconMap=bb,Ft.artifactTypes=mR,Ft.isArtifactSelection=xb,Ft.isArtifactsSelection=_b,Ft.isEventSelection=wb,Ft.isEventsSelection=Tb,Ft.isNodeSelection=zh,Ft.isRunGraphNodeType=gR,Ft.isStateSelection=vb,Ft.runGraphNodeKinds=Dd,Ft.stateType=yR,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
1175
+ */var V0,Ur,xn,Ju,ws,H0,$u,mC=function(){return typeof window<"u"},ar={},Ts=180/Math.PI,_n=Math.PI/180,vn=Math.atan2,K0=1e8,Qu=/([A-Z])/g,gC=/(left|right|width|margin|padding|x)/i,yC=/[\s,\(]\S/,Di={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bC=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)},xC=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)},_C=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Y0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},z0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},vC=function(t,e,i){return t.style[e]=i},wC=function(t,e,i){return t.style.setProperty(e,i)},TC=function(t,e,i){return t._gsap[e]=i},SC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},EC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},CC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ht="transform",Pe=Ht+"Origin",IC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in ar&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Di[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=hr(s,a)}):this.tfm[t]=o.x?o[t]:hr(s,t),t===Pe&&(this.tfm.zOrigin=o.zOrigin);else return Di.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ht)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Pe,e,"")),t=Ht}(n||e)&&this.props.push(t,e,n[t])},j0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},AC=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(Qu,"-$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=$u(),(!n||!n.isStart)&&!i[Ht]&&(j0(i),s.zOrigin&&i[Pe]&&(i[Pe]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},J0=function(t,e){var i={target:t,props:[],revert:AC,save:IC};return t._gsap||Le.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},$0,td=function(t,e){var i=Ur.createElementNS?Ur.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ur.createElement(t);return i&&i.style?i:Ur.createElement(t)},ki=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Qu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,wn(e)||e,1)||""},Q0="O,Moz,ms,Ms,Webkit".split(","),wn=function(t,e,i){var s=e||ws,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Q0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Q0[o]:"")+t},ed=function(){mC()&&window.document&&(V0=window,Ur=V0.document,xn=Ur.documentElement,ws=td("div")||{style:{}},td("div"),Ht=wn(Ht),Pe=Ht+"Origin",ws.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",$0=!!wn("perspective"),$u=Le.core.reverting,Ju=1)},id=function r(t){var e=td("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(xn.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)),xn.removeChild(e),this.style.cssText=n,o},q0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},ty=function(t){var e;try{e=t.getBBox()}catch{e=id.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===id||(e=id.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+q0(t,["x","cx","x1"])||0,y:+q0(t,["y","cy","y1"])||0,width:0,height:0}:e},ey=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&ty(t))},Ss=function(t,e){if(e){var i=t.style,s;e in ar&&e!==Pe&&(e=Ht),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Qu,"-$1").toLowerCase())):i.removeAttribute(e)}},Wr=function(t,e,i,s,n,o){var a=new Me(t._pt,e,i,0,1,o?z0:Y0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},iy={deg:1,rad:1,turn:1},RC={grid:1,flex:1},Xr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ws.style,h=gC.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",p,m,g,y;if(s===o||!n||iy[s]||iy[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&ey(t),(f||o==="%")&&(ar[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],jt(f?n/p*u:n/100*p);if(a[h?"width":"height"]=u+(d?o:s),m=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ur||!m.appendChild)&&(m=Ur.body),g=m._gsap,g&&f&&g.width&&h&&g.time===Xe.time&&!g.uncache)return jt(n/g.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+s,p=t[c],x?t.style[e]=x:Ss(t,e)}else(f||o==="%")&&!RC[ki(m,"display")]&&(a.position=ki(t,"position")),m===t&&(a.position="static"),m.appendChild(ws),p=ws[c],m.removeChild(ws),a.position="absolute";return h&&f&&(g=gs(m),g.time=Xe.time,g.width=m[c]),jt(d?p*n/u:p&&n?u/p*n:0)},hr=function(t,e,i,s){var n;return Ju||ed(),e in Di&&e!=="transform"&&(e=Di[e],~e.indexOf(",")&&(e=e.split(",")[0])),ar[e]&&e!=="transform"?(n=So(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:Ch(ki(t,Pe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=Eh[e]&&Eh[e](t,e,i)||ki(t,e)||o0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Xr(t,e,n,i)+i:n},MC=function(t,e,i,s){if(!i||i==="none"){var n=wn(e,t,1),o=n&&ki(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=ki(t,"borderTopColor"))}var a=new Me(this._pt,t.style,e,0,1,U0),h=0,l=0,c,u,d,f,p,m,g,y,x,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=ki(t,e)||s,m?t.style[e]=m:Ss(t,e)),c=[i,s],M0(c),i=c[0],s=c[1],d=i.match(fn)||[],w=s.match(fn)||[],w.length){for(;u=fn.exec(s);)g=u[0],x=s.substring(h,u.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=pn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=fn.lastIndex-b.length,b||(b=b||Oe.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=Xr(t,e,m,b)||0),a._pt={_next:a._pt,p:x||l===1?x:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?z0:Y0;return qg.test(s)&&(a.e=0),this._pt=a,a},ry={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},LC=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]=ry[i]||i,e[1]=ry[s]||s,e.join(" ")},PC=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],ar[a]&&(h=1,a=a==="transformOrigin"?Pe:Ht),Ss(i,a);h&&(Ss(i,Ht),o&&(o.svg&&i.removeAttribute("transform"),So(i,1),o.uncache=1,j0(s)))}},Eh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Me(t._pt,e,i,0,0,PC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},To=[1,0,0,1,0,0],sy={},ny=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},oy=function(t){var e=ki(t,Ht);return ny(e)?To:e.substr(7).match(Qg).map(jt)},rd=function(t,e){var i=t._gsap||gs(t),s=t.style,n=oy(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"?To:n):(n===To&&!t.offsetParent&&t!==xn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,xn.appendChild(t)),n=oy(t),h?s.display=h:Ss(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):xn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},sd=function(t,e,i,s,n,o){var a=t._gsap,h=n||rd(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],p=h[1],m=h[2],g=h[3],y=h[4],x=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,S,C,I,R;i?h!==To&&(C=f*g-p*m)&&(I=v*(g/C)+w*(-m/C)+(m*x-g*y)/C,R=v*(-p/C)+w*(f/C)-(f*x-p*y)/C,v=I,w=R):(S=ty(t),v=S.x+(~b[0].indexOf("%")?v/100*S.width:v),w=S.y+(~(b[1]||b[0]).indexOf("%")?w/100*S.height:w)),s||s!==!1&&a.smooth?(y=v-l,x=w-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Pe]="0px 0px",o&&(Wr(o,a,"xOrigin",l,v),Wr(o,a,"yOrigin",c,w),Wr(o,a,"xOffset",u,a.xOffset),Wr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},So=function(t,e){var i=t._gsap||new F0(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=ki(t,Pe)||"0",c,u,d,f,p,m,g,y,x,b,v,w,S,C,I,R,P,G,N,A,k,V,K,H,$,U,D,F,Z,tt,ft,ot;return c=u=d=m=g=y=x=b=v=0,f=p=1,i.svg=!!(t.getCTM&&ey(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ht]=(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[Ht]!=="none"?h[Ht]:"")),s.scale=s.rotate=s.translate="none"),C=rd(t,i.svg),i.svg&&(i.uncache?($=t.getBBox(),l=i.xOrigin-$.x+"px "+(i.yOrigin-$.y)+"px",H=""):H=!e&&t.getAttribute("data-svg-origin"),sd(t,H||l,!!H||i.originIsAbsolute,i.smooth!==!1,C)),w=i.xOrigin||0,S=i.yOrigin||0,C!==To&&(G=C[0],N=C[1],A=C[2],k=C[3],c=V=C[4],u=K=C[5],C.length===6?(f=Math.sqrt(G*G+N*N),p=Math.sqrt(k*k+A*A),m=G||N?vn(N,G)*Ts:0,x=A||k?vn(A,k)*Ts+m:0,x&&(p*=Math.abs(Math.cos(x*_n))),i.svg&&(c-=w-(w*G+S*A),u-=S-(w*N+S*k))):(ot=C[6],tt=C[7],D=C[8],F=C[9],Z=C[10],ft=C[11],c=C[12],u=C[13],d=C[14],I=vn(ot,Z),g=I*Ts,I&&(R=Math.cos(-I),P=Math.sin(-I),H=V*R+D*P,$=K*R+F*P,U=ot*R+Z*P,D=V*-P+D*R,F=K*-P+F*R,Z=ot*-P+Z*R,ft=tt*-P+ft*R,V=H,K=$,ot=U),I=vn(-A,Z),y=I*Ts,I&&(R=Math.cos(-I),P=Math.sin(-I),H=G*R-D*P,$=N*R-F*P,U=A*R-Z*P,ft=k*P+ft*R,G=H,N=$,A=U),I=vn(N,G),m=I*Ts,I&&(R=Math.cos(I),P=Math.sin(I),H=G*R+N*P,$=V*R+K*P,N=N*R-G*P,K=K*R-V*P,G=H,V=$),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=jt(Math.sqrt(G*G+N*N+A*A)),p=jt(Math.sqrt(K*K+ot*ot)),I=vn(V,K),x=Math.abs(I)>2e-4?I*Ts:0,v=ft?1/(ft<0?-ft:ft):0),i.svg&&(H=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!ny(ki(t,Ht)),H&&t.setAttribute("transform",H))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=jt(f),i.scaleY=jt(p),i.rotation=jt(m)+a,i.rotationX=jt(g)+a,i.rotationY=jt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Pe]=Ch(l)),i.xOffset=i.yOffset=0,i.force3D=Oe.force3D,i.renderTransform=i.svg?FC:$0?ay:GC,i.uncache=0,i},Ch=function(t){return(t=t.split(" "))[0]+" "+t[1]},nd=function(t,e,i){var s=be(e);return jt(parseFloat(e)+parseFloat(Xr(t,"x",i+"px",s)))+s},GC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ay(t,e)},Es="0deg",Eo="0px",Cs=") ",ay=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,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,p=i.scaleX,m=i.scaleY,g=i.transformPerspective,y=i.force3D,x=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==Es||c!==Es)){var S=parseFloat(c)*_n,C=Math.sin(S),I=Math.cos(S),R;S=parseFloat(u)*_n,R=Math.cos(S),o=nd(x,o,C*R*-b),a=nd(x,a,-Math.sin(S)*-b),h=nd(x,h,I*R*-b+b)}g!==Eo&&(v+="perspective("+g+Cs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==Eo||a!==Eo||h!==Eo)&&(v+=h!==Eo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Cs),l!==Es&&(v+="rotate("+l+Cs),c!==Es&&(v+="rotateY("+c+Cs),u!==Es&&(v+="rotateX("+u+Cs),(d!==Es||f!==Es)&&(v+="skew("+d+", "+f+Cs),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Cs),x.style[Ht]=v||"translate(0, 0)"},FC=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,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,p=i.xOrigin,m=i.yOrigin,g=i.xOffset,y=i.yOffset,x=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,S,C,I,R;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=_n,l*=_n,w=Math.cos(h)*u,S=Math.sin(h)*u,C=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(c*=_n,R=Math.tan(l-c),R=Math.sqrt(1+R*R),C*=R,I*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),w*=R,S*=R)),w=jt(w),S=jt(S),C=jt(C),I=jt(I)):(w=u,I=d,S=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Xr(f,"x",o,"px"),v=Xr(f,"y",a,"px")),(p||m||g||y)&&(b=jt(b+p-(p*w+m*C)+g),v=jt(v+m-(p*S+m*I)+y)),(s||n)&&(R=f.getBBox(),b=jt(b+s/100*R.width),v=jt(v+n/100*R.height)),R="matrix("+w+","+S+","+C+","+I+","+b+","+v+")",f.setAttribute("transform",R),x&&(f.style[Ht]=R)},NC=function(t,e,i,s,n){var o=360,a=le(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?Ts:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*K0)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*K0)%o-~~(l/o)*o)),t._pt=d=new Me(t._pt,e,i,s,l,bC),d.e=c,d.u="deg",t._props.push(i),d},hy=function(t,e){for(var i in e)t[i]=e[i];return t},DC=function(t,e,i){var s=hy({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,p;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Ht]=e,a=So(i,1),Ss(i,Ht),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ht],o[Ht]=e,a=So(i,1),o[Ht]=l);for(h in ar)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=be(l),p=be(c),u=f!==p?Xr(i,h,l,p):parseFloat(l),d=parseFloat(c),t._pt=new Me(t._pt,a,h,u,d-u,qu),t._pt.u=p||0,t._props.push(h));hy(a,s)};Re("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});Eh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(p){return hr(a,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),a.init(h,f,u)}});var ly={name:"css",register:ed,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,c,u,d,f,p,m,g,y,x,b,v,w,S,C,I;Ju||ed(),this.styles=this.styles||J0(t),I=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Ue[m]&&N0(m,e,i,s,t,n)))){if(f=typeof c,p=Eh[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=yo(c)),p)p(this,t,m,c,i)&&(C=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Or.lastIndex=0,Or.test(l)||(g=be(l),y=be(c)),y?g!==y&&(l=Xr(t,m,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,m),o.push(m),I.push(m,0,a[m]);else if(f!=="undefined"){if(h&&m in h?(l=typeof h[m]=="function"?h[m].call(i,s,t,n):h[m],le(l)&&~l.indexOf("random(")&&(l=yo(l)),be(l+"")||l==="auto"||(l+=Oe.units[m]||be(hr(t,m))||""),(l+"").charAt(1)==="="&&(l=hr(t,m))):l=hr(t,m),d=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),m in Di&&(m==="autoAlpha"&&(d===1&&hr(t,"visibility")==="hidden"&&u&&(d=0),I.push("visibility",0,a.visibility),Wr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Di[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in ar,b){if(this.styles.save(m),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||So(t,e.parseTransform),S=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Me(this._pt,a,Ht,0,1,w.renderTransform,w,0,-1),v.dep=1),m==="scale")this._pt=new Me(this._pt,w,"scaleY",w.scaleY,(x?pn(w.scaleY,x+u):u)-w.scaleY||0,qu),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){I.push(Pe,0,a[Pe]),c=LC(c),w.svg?sd(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Wr(this,w,"zOrigin",w.zOrigin,y),Wr(this,a,m,Ch(l),Ch(c)));continue}else if(m==="svgOrigin"){sd(t,c,1,S,0,this);continue}else if(m in sy){NC(this,w,m,d,x?pn(d,x+c):c);continue}else if(m==="smoothOrigin"){Wr(this,w,"smooth",w.smooth,c);continue}else if(m==="force3D"){w[m]=c;continue}else if(m==="transform"){DC(this,c,t);continue}}else m in a||(m=wn(m)||m);if(b||(u||u===0)&&(d||d===0)&&!yC.test(c)&&m in a)g=(l+"").substr((d+"").length),u||(u=0),y=be(c)||(m in Oe.units?Oe.units[m]:g),g!==y&&(d=Xr(t,m,l,y)),this._pt=new Me(this._pt,b?w:a,m,d,(x?pn(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?_C:qu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=xC);else if(m in a)MC.call(this,t,m,l,x?x+c:c);else if(m in t)this.add(t,m,l||t[m],x?x+c:c,s,n);else if(m!=="parseTransform"){Iu(m,c);continue}b||(m in a?I.push(m,0,a[m]):I.push(m,1,l||t[m])),o.push(m)}}C&&W0(this)},render:function(t,e){if(e.tween._time||!$u())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:hr,aliases:Di,getSetter:function(t,e,i){var s=Di[e];return s&&s.indexOf(",")<0&&(e=s),e in ar&&e!==Pe&&(t._gsap.x||hr(t,"x"))?i&&H0===i?e==="scale"?SC:TC:(H0=i||{})&&(e==="scale"?EC:CC):t.style&&!vu(t.style[e])?vC:~e.indexOf("-")?wC:Hu(t,e)},core:{_removeProperty:Ss,_getMatrix:rd}};Le.utils.checkPrefix=wn,Le.core.getStyleSaver=J0,function(r,t,e,i){var s=Re(r+","+t+","+e,function(n){ar[n]=1});Re(t,function(n){Oe.units[n]="deg",sy[n]=1}),Di[s[13]]=r+","+t,Re(i,function(n){var o=n.split(":");Di[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"),Re("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Oe.units[r]="px"}),Le.registerPlugin(ly);var cy=Le.registerPlugin(ly)||Le;cy.core.Tween;const Is=new mt;class kC{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,Is),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=Is.right>t.left&&Is.left<t.right&&Is.bottom>t.top&&Is.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(Is):e.getBounds(!0,Is);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 Ih={exports:{}};Ih.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]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",S="[object Set]",C="[object String]",I="[object Symbol]",R="[object Undefined]",P="[object WeakMap]",G="[object ArrayBuffer]",N="[object DataView]",A="[object Float32Array]",k="[object Float64Array]",V="[object Int8Array]",K="[object Int16Array]",H="[object Int32Array]",$="[object Uint8Array]",U="[object Uint8ClampedArray]",D="[object Uint16Array]",F="[object Uint32Array]",Z=/[\\^$.*+?()[\]{}|]/g,tt=/^\[object .+?Constructor\]$/,ft=/^(?:0|[1-9]\d*)$/,ot={};ot[A]=ot[k]=ot[V]=ot[K]=ot[H]=ot[$]=ot[U]=ot[D]=ot[F]=!0,ot[a]=ot[h]=ot[G]=ot[c]=ot[N]=ot[u]=ot[d]=ot[f]=ot[m]=ot[g]=ot[x]=ot[w]=ot[S]=ot[C]=ot[P]=!1;var Et=typeof ve=="object"&&ve&&ve.Object===Object&&ve,Mt=typeof self=="object"&&self&&self.Object===Object&&self,bt=Et||Mt||Function("return this")(),B=t&&!t.nodeType&&t,j=B&&!0&&r&&!r.nodeType&&r,J=j&&j.exports===B,O=J&&Et.process,gt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),ut=gt&&gt.isTypedArray;function It(T,M){for(var _=-1,E=T==null?0:T.length,L=0,X=[];++_<E;){var ct=T[_];M(ct,_,T)&&(X[L++]=ct)}return X}function Dt(T,M){for(var _=-1,E=M.length,L=T.length;++_<E;)T[L+_]=M[_];return T}function Ee(T,M){for(var _=-1,E=T==null?0:T.length;++_<E;)if(M(T[_],_,T))return!0;return!1}function ri(T,M){for(var _=-1,E=Array(T);++_<T;)E[_]=M(_);return E}function Xo(T){return function(M){return T(M)}}function Kr(T,M){return T.has(M)}function Fs(T,M){return T==null?void 0:T[M]}function Ns(T){var M=-1,_=Array(T.size);return T.forEach(function(E,L){_[++M]=[L,E]}),_}function gi(T,M){return function(_){return T(M(_))}}function tl(T){var M=-1,_=Array(T.size);return T.forEach(function(E){_[++M]=E}),_}var el=Array.prototype,Wd=Function.prototype,Gn=Object.prototype,Yr=bt["__core-js_shared__"],Zo=Wd.toString,Ze=Gn.hasOwnProperty,Vo=function(){var T=/[^.]+$/.exec(Yr&&Yr.keys&&Yr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Ho=Gn.toString,il=RegExp("^"+Zo.call(Ze).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rl=J?bt.Buffer:void 0,Fn=bt.Symbol,Xi=bt.Uint8Array,Ds=Gn.propertyIsEnumerable,Xd=el.splice,Zi=Fn?Fn.toStringTag:void 0,sl=Object.getOwnPropertySymbols,nl=rl?rl.isBuffer:void 0,ks=gi(Object.keys,Object),Ko=xr(bt,"DataView"),Ve=xr(bt,"Map"),Yo=xr(bt,"Promise"),zo=xr(bt,"Set"),jo=xr(bt,"WeakMap"),Os=xr(Object,"create"),Zd=bi(Ko),yi=bi(Ve),Vd=bi(Yo),Hd=bi(zo),Kd=bi(jo),ol=Fn?Fn.prototype:void 0,Jo=ol?ol.valueOf:void 0;function Ne(T){var M=-1,_=T==null?0:T.length;for(this.clear();++M<_;){var E=T[M];this.set(E[0],E[1])}}function Yd(){this.__data__=Os?Os(null):{},this.size=0}function zd(T){var M=this.has(T)&&delete this.__data__[T];return this.size-=M?1:0,M}function jd(T){var M=this.__data__;if(Os){var _=M[T];return _===i?void 0:_}return Ze.call(M,T)?M[T]:void 0}function Jd(T){var M=this.__data__;return Os?M[T]!==void 0:Ze.call(M,T)}function $d(T,M){var _=this.__data__;return this.size+=this.has(T)?0:1,_[T]=Os&&M===void 0?i:M,this}Ne.prototype.clear=Yd,Ne.prototype.delete=zd,Ne.prototype.get=jd,Ne.prototype.has=Jd,Ne.prototype.set=$d;function xe(T){var M=-1,_=T==null?0:T.length;for(this.clear();++M<_;){var E=T[M];this.set(E[0],E[1])}}function Qd(){this.__data__=[],this.size=0}function qd(T){var M=this.__data__,_=Dn(M,T);if(_<0)return!1;var E=M.length-1;return _==E?M.pop():Xd.call(M,_,1),--this.size,!0}function tf(T){var M=this.__data__,_=Dn(M,T);return _<0?void 0:M[_][1]}function ef(T){return Dn(this.__data__,T)>-1}function rf(T,M){var _=this.__data__,E=Dn(_,T);return E<0?(++this.size,_.push([T,M])):_[E][1]=M,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(T){var M=-1,_=T==null?0:T.length;for(this.clear();++M<_;){var E=T[M];this.set(E[0],E[1])}}function $o(){this.size=0,this.__data__={hash:new Ne,map:new(Ve||xe),string:new Ne}}function sf(T){var M=On(this,T).delete(T);return this.size-=M?1:0,M}function Nn(T){return On(this,T).get(T)}function Qo(T){return On(this,T).has(T)}function nf(T,M){var _=On(this,T),E=_.size;return _.set(T,M),this.size+=_.size==E?0:1,this}yr.prototype.clear=$o,yr.prototype.delete=sf,yr.prototype.get=Nn,yr.prototype.has=Qo,yr.prototype.set=nf;function br(T){var M=-1,_=T==null?0:T.length;for(this.__data__=new yr;++M<_;)this.add(T[M])}function al(T){return this.__data__.set(T,i),this}function of(T){return this.__data__.has(T)}br.prototype.add=br.prototype.push=al,br.prototype.has=of;function Vi(T){var M=this.__data__=new xe(T);this.size=M.size}function af(){this.__data__=new xe,this.size=0}function hl(T){var M=this.__data__,_=M.delete(T);return this.size=M.size,_}function hf(T){return this.__data__.get(T)}function lf(T){return this.__data__.has(T)}function cf(T,M){var _=this.__data__;if(_ instanceof xe){var E=_.__data__;if(!Ve||E.length<e-1)return E.push([T,M]),this.size=++_.size,this;_=this.__data__=new yr(E)}return _.set(T,M),this.size=_.size,this}Vi.prototype.clear=af,Vi.prototype.delete=hl,Vi.prototype.get=hf,Vi.prototype.has=lf,Vi.prototype.set=cf;function uf(T,M){var _=Wn(T),E=!_&&ea(T),L=!_&&!E&&Us(T),X=!_&&!E&&!L&&yl(T),ct=_||E||L||X,yt=ct?ri(T.length,String):[],_t=yt.length;for(var ht in T)(M||Ze.call(T,ht))&&!(ct&&(ht=="length"||L&&(ht=="offset"||ht=="parent")||X&&(ht=="buffer"||ht=="byteLength"||ht=="byteOffset")||ta(ht,_t)))&&yt.push(ht);return yt}function Dn(T,M){for(var _=T.length;_--;)if(Un(T[_][0],M))return _;return-1}function df(T,M,_){var E=M(T);return Wn(T)?E:Dt(E,_(T))}function Bs(T){return T==null?T===void 0?R:y:Zi&&Zi in Object(T)?gf(T):Bn(T)}function ll(T){return jr(T)&&Bs(T)==a}function cl(T,M,_,E,L){return T===M?!0:T==null||M==null||!jr(T)&&!jr(M)?T!==T&&M!==M:ff(T,M,_,E,cl,L)}function ff(T,M,_,E,L,X){var ct=Wn(T),yt=Wn(M),_t=ct?h:Hi(T),ht=yt?h:Hi(M);_t=_t==a?x:_t,ht=ht==a?x:ht;var vt=_t==x,Ut=ht==x,Lt=_t==ht;if(Lt&&Us(T)){if(!Us(M))return!1;ct=!0,vt=!1}if(Lt&&!vt)return X||(X=new Vi),ct||yl(T)?ul(T,M,_,E,L,X):dl(T,M,_t,_,E,L,X);if(!(_&s)){var de=vt&&Ze.call(T,"__wrapped__"),_e=Ut&&Ze.call(M,"__wrapped__");if(de||_e){var si=de?T.value():T,ni=_e?M.value():M;return X||(X=new Vi),L(si,ni,_,E,X)}}return Lt?(X||(X=new Vi),mf(T,M,_,E,L,X)):!1}function kn(T){if(!gl(T)||xf(T))return!1;var M=Ki(T)?il:tt;return M.test(bi(T))}function qo(T){return jr(T)&&zr(T.length)&&!!ot[Bs(T)]}function pf(T){if(!_f(T))return ks(T);var M=[];for(var _ in Object(T))Ze.call(T,_)&&_!="constructor"&&M.push(_);return M}function ul(T,M,_,E,L,X){var ct=_&s,yt=T.length,_t=M.length;if(yt!=_t&&!(ct&&_t>yt))return!1;var ht=X.get(T);if(ht&&X.get(M))return ht==M;var vt=-1,Ut=!0,Lt=_&n?new br:void 0;for(X.set(T,M),X.set(M,T);++vt<yt;){var de=T[vt],_e=M[vt];if(E)var si=ct?E(_e,de,vt,M,T,X):E(de,_e,vt,T,M,X);if(si!==void 0){if(si)continue;Ut=!1;break}if(Lt){if(!Ee(M,function(ni,Ws){if(!Kr(Lt,Ws)&&(de===ni||L(de,ni,_,E,X)))return Lt.push(Ws)})){Ut=!1;break}}else if(!(de===_e||L(de,_e,_,E,X))){Ut=!1;break}}return X.delete(T),X.delete(M),Ut}function dl(T,M,_,E,L,X,ct){switch(_){case N:if(T.byteLength!=M.byteLength||T.byteOffset!=M.byteOffset)return!1;T=T.buffer,M=M.buffer;case G:return!(T.byteLength!=M.byteLength||!X(new Xi(T),new Xi(M)));case c:case u:case g:return Un(+T,+M);case d:return T.name==M.name&&T.message==M.message;case w:case C:return T==M+"";case m:var yt=Ns;case S:var _t=E&s;if(yt||(yt=tl),T.size!=M.size&&!_t)return!1;var ht=ct.get(T);if(ht)return ht==M;E|=n,ct.set(T,M);var vt=ul(yt(T),yt(M),E,L,X,ct);return ct.delete(T),vt;case I:if(Jo)return Jo.call(T)==Jo.call(M)}return!1}function mf(T,M,_,E,L,X){var ct=_&s,yt=fl(T),_t=yt.length,ht=fl(M),vt=ht.length;if(_t!=vt&&!ct)return!1;for(var Ut=_t;Ut--;){var Lt=yt[Ut];if(!(ct?Lt in M:Ze.call(M,Lt)))return!1}var de=X.get(T);if(de&&X.get(M))return de==M;var _e=!0;X.set(T,M),X.set(M,T);for(var si=ct;++Ut<_t;){Lt=yt[Ut];var ni=T[Lt],Ws=M[Lt];if(E)var Qb=ct?E(Ws,ni,Lt,M,T,X):E(ni,Ws,Lt,T,M,X);if(!(Qb===void 0?ni===Ws||L(ni,Ws,_,E,X):Qb)){_e=!1;break}si||(si=Lt=="constructor")}if(_e&&!si){var xl=T.constructor,_l=M.constructor;xl!=_l&&"constructor"in T&&"constructor"in M&&!(typeof xl=="function"&&xl instanceof xl&&typeof _l=="function"&&_l instanceof _l)&&(_e=!1)}return X.delete(T),X.delete(M),_e}function fl(T){return df(T,bl,yf)}function On(T,M){var _=T.__data__;return bf(M)?_[typeof M=="string"?"string":"hash"]:_.map}function xr(T,M){var _=Fs(T,M);return kn(_)?_:void 0}function gf(T){var M=Ze.call(T,Zi),_=T[Zi];try{T[Zi]=void 0;var E=!0}catch{}var L=Ho.call(T);return E&&(M?T[Zi]=_:delete T[Zi]),L}var yf=sl?function(T){return T==null?[]:(T=Object(T),It(sl(T),function(M){return Ds.call(T,M)}))}:vf,Hi=Bs;(Ko&&Hi(new Ko(new ArrayBuffer(1)))!=N||Ve&&Hi(new Ve)!=m||Yo&&Hi(Yo.resolve())!=b||zo&&Hi(new zo)!=S||jo&&Hi(new jo)!=P)&&(Hi=function(T){var M=Bs(T),_=M==x?T.constructor:void 0,E=_?bi(_):"";if(E)switch(E){case Zd:return N;case yi:return m;case Vd:return b;case Hd:return S;case Kd:return P}return M});function ta(T,M){return M=M??o,!!M&&(typeof T=="number"||ft.test(T))&&T>-1&&T%1==0&&T<M}function bf(T){var M=typeof T;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?T!=="__proto__":T===null}function xf(T){return!!Vo&&Vo in T}function _f(T){var M=T&&T.constructor,_=typeof M=="function"&&M.prototype||Gn;return T===_}function Bn(T){return Ho.call(T)}function bi(T){if(T!=null){try{return Zo.call(T)}catch{}try{return T+""}catch{}}return""}function Un(T,M){return T===M||T!==T&&M!==M}var ea=ll(function(){return arguments}())?ll:function(T){return jr(T)&&Ze.call(T,"callee")&&!Ds.call(T,"callee")},Wn=Array.isArray;function pl(T){return T!=null&&zr(T.length)&&!Ki(T)}var Us=nl||wf;function ml(T,M){return cl(T,M)}function Ki(T){if(!gl(T))return!1;var M=Bs(T);return M==f||M==p||M==l||M==v}function zr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function gl(T){var M=typeof T;return T!=null&&(M=="object"||M=="function")}function jr(T){return T!=null&&typeof T=="object"}var yl=ut?Xo(ut):qo;function bl(T){return pl(T)?uf(T):pf(T)}function vf(){return[]}function wf(){return!1}r.exports=ml}(Ih,Ih.exports);var OC=Ih.exports;const uy=Vs(OC);var BC=Object.defineProperty,UC=(r,t,e)=>t in r?BC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t,e)=>(UC(r,typeof t!="symbol"?t+"":t,e),e);class qe{constructor(t){W(this,"parent"),W(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 WC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dy={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,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(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(WC)})(dy);const fy=dy.exports;function Ah(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return fy[r]}else return fy[t]}const XC={removeOnInterrupt:!1,ease:"linear",time:1e3};class ZC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"startX"),W(this,"startY"),W(this,"deltaX"),W(this,"deltaY"),W(this,"keepCenter"),W(this,"startWidth",null),W(this,"startHeight",null),W(this,"deltaWidth",null),W(this,"deltaHeight",null),W(this,"width",null),W(this,"height",null),W(this,"time",0),this.options=Object.assign({},XC,e),this.options.ease=Ah(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 dt(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 dt(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 VC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class HC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"underflowX"),W(this,"underflowY"),W(this,"ease"),W(this,"toX"),W(this,"toY"),this.options=Object.assign({},VC,e),this.ease=Ah(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 dt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new dt(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 dt(0,0),bottomRight:new dt(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 KC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class YC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"last"),W(this,"noUnderflow"),W(this,"underflowX"),W(this,"underflowY"),this.options=Object.assign({},KC,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 dt(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 zC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class jC extends qe{constructor(t,e={}){super(t),W(this,"options"),this.options=Object.assign({},zC,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 JC={friction:.98,bounce:.8,minSpeed:.01},Zr=16;class $C extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"x"),W(this,"y"),W(this,"percentChangeX"),W(this,"percentChangeY"),W(this,"saved"),W(this,"timeSinceRelease"),this.options=Object.assign({},JC,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*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.x*=Math.pow(this.percentChangeX,t/Zr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.y*=Math.pow(this.percentChangeY,t/Zr)}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 QC={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 qC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"moved"),W(this,"reverse"),W(this,"xDirection"),W(this,"yDirection"),W(this,"keyIsPressed"),W(this,"mouse"),W(this,"underflowX"),W(this,"underflowY"),W(this,"last"),W(this,"current"),W(this,"windowEventHandlers",[]),this.options=Object.assign({},QC,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 dt(this.last.x,this.last.y),world:this.parent.toWorld(new dt(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 dt(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 tI={speed:0,acceleration:null,radius:null};class eI extends qe{constructor(t,e,i={}){super(t),W(this,"options"),W(this,"target"),W(this,"velocity"),this.target=e,this.options=Object.assign({},tI,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 c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),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,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),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 iI={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class rI extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"reverse"),W(this,"radiusSquared"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"horizontal"),W(this,"vertical"),this.options=Object.assign({},iI,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 sI={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class nI extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"active",!1),W(this,"pinching",!1),W(this,"moved",!1),W(this,"lastCenter"),this.options=Object.assign({},sI,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 dt(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 c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),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 f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.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 oI={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class aI extends qe{constructor(t,e,i,s={}){super(t),W(this,"options"),W(this,"ease"),W(this,"x"),W(this,"y"),W(this,"percent"),W(this,"snapping"),W(this,"deltaX"),W(this,"deltaY"),W(this,"startX"),W(this,"startY"),this.options=Object.assign({},oI,s),this.ease=Ah(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 c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}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 hI={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class lI extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"ease"),W(this,"xScale"),W(this,"yScale"),W(this,"xIndependent"),W(this,"yIndependent"),W(this,"snapping"),this.options=Object.assign({},hI,e),this.ease=Ah(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 cI={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class uI extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"smoothing"),W(this,"smoothingCenter"),W(this,"smoothingCount"),W(this,"keyIsPressed"),this.options=Object.assign({},cI,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 dI{constructor(t){W(this,"viewport"),W(this,"clickedAvailable"),W(this,"isMouseDown"),W(this,"last"),W(this,"wheelFunction"),W(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new mt(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 dt;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 Co=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class fI{constructor(t){W(this,"plugins"),W(this,"list"),W(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Co.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Co.indexOf(t);n!==-1&&Co.splice(n,1),Co.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 Co)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 pI={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:Te.shared,allowPreserveDragOutside:!1};class mI extends Ct{constructor(t){super(),W(this,"moving"),W(this,"screenWidth"),W(this,"screenHeight"),W(this,"threshold"),W(this,"input"),W(this,"plugins"),W(this,"zooming"),W(this,"lastViewport"),W(this,"options"),W(this,"_dirty"),W(this,"_forceHitArea"),W(this,"_hitAreaDefault"),W(this,"_pause"),W(this,"tickerFunction"),W(this,"_worldWidth"),W(this,"_worldHeight"),W(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...pI,...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 dI(this),this.plugins=new fI(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 mt(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 mt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new dt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new dt(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 dt(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 dt(-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 lI(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 dt(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 mt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new qC(this,t)),this}clamp(t){return this.plugins.add("clamp",new YC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new $C(this,t)),this}bounce(t){return this.plugins.add("bounce",new HC(this,t)),this}pinch(t){return this.plugins.add("pinch",new nI(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new aI(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new eI(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new uI(this,t)),this}animate(t){return this.plugins.add("animate",new ZC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new jC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new rI(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 Rh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function gI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function od(r){let t,e,i;r.length!==2?(t=Rh,e=(a,h)=>Rh(r(a),h),i=(a,h)=>r(a)-h):(t=r===Rh||r===gI?r:yI,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function yI(){return 0}function bI(r){return r===null?NaN:+r}const xI=od(Rh).right;od(bI).center;const _I=xI,vI=Math.sqrt(50),wI=Math.sqrt(10),TI=Math.sqrt(2);function Mh(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>=vI?10:n>=wI?5:n>=TI?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?Mh(r,t,e*2):[a,h,l]}function SI(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?Mh(t,r,e):Mh(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 ad(r,t,e){return t=+t,r=+r,e=+e,Mh(r,t,e)[2]}function hd(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?ad(t,r,e):ad(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ld(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function py(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function Io(){}var Ao=.7,Lh=1/Ao,Tn="\\s*([+-]?\\d+)\\s*",Ro="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",EI=/^#([0-9a-f]{3,8})$/,CI=new RegExp(`^rgb\\(${Tn},${Tn},${Tn}\\)$`),II=new RegExp(`^rgb\\(${Oi},${Oi},${Oi}\\)$`),AI=new RegExp(`^rgba\\(${Tn},${Tn},${Tn},${Ro}\\)$`),RI=new RegExp(`^rgba\\(${Oi},${Oi},${Oi},${Ro}\\)$`),MI=new RegExp(`^hsl\\(${Ro},${Oi},${Oi}\\)$`),LI=new RegExp(`^hsla\\(${Ro},${Oi},${Oi},${Ro}\\)$`),my={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};ld(Io,Mo,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:gy,formatHex:gy,formatHex8:PI,formatHsl:GI,formatRgb:yy,toString:yy});function gy(){return this.rgb().formatHex()}function PI(){return this.rgb().formatHex8()}function GI(){return wy(this).formatHsl()}function yy(){return this.rgb().formatRgb()}function Mo(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=EI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?by(t):e===3?new Ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Ph(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Ph(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=CI.exec(r))?new Ge(t[1],t[2],t[3],1):(t=II.exec(r))?new Ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=AI.exec(r))?Ph(t[1],t[2],t[3],t[4]):(t=RI.exec(r))?Ph(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MI.exec(r))?vy(t[1],t[2]/100,t[3]/100,1):(t=LI.exec(r))?vy(t[1],t[2]/100,t[3]/100,t[4]):my.hasOwnProperty(r)?by(my[r]):r==="transparent"?new Ge(NaN,NaN,NaN,0):null}function by(r){return new Ge(r>>16&255,r>>8&255,r&255,1)}function Ph(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ge(r,t,e,i)}function FI(r){return r instanceof Io||(r=Mo(r)),r?(r=r.rgb(),new Ge(r.r,r.g,r.b,r.opacity)):new Ge}function cd(r,t,e,i){return arguments.length===1?FI(r):new Ge(r,t,e,i??1)}function Ge(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ld(Ge,cd,py(Io,{brighter(r){return r=r==null?Lh:Math.pow(Lh,r),new Ge(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new Ge(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ge(As(this.r),As(this.g),As(this.b),Gh(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:xy,formatHex:xy,formatHex8:NI,formatRgb:_y,toString:_y}));function xy(){return`#${Rs(this.r)}${Rs(this.g)}${Rs(this.b)}`}function NI(){return`#${Rs(this.r)}${Rs(this.g)}${Rs(this.b)}${Rs((isNaN(this.opacity)?1:this.opacity)*255)}`}function _y(){const r=Gh(this.opacity);return`${r===1?"rgb(":"rgba("}${As(this.r)}, ${As(this.g)}, ${As(this.b)}${r===1?")":`, ${r})`}`}function Gh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function As(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Rs(r){return r=As(r),(r<16?"0":"")+r.toString(16)}function vy(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new pi(r,t,e,i)}function wy(r){if(r instanceof pi)return new pi(r.h,r.s,r.l,r.opacity);if(r instanceof Io||(r=Mo(r)),!r)return new pi;if(r instanceof pi)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 pi(o,a,h,r.opacity)}function DI(r,t,e,i){return arguments.length===1?wy(r):new pi(r,t,e,i??1)}function pi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ld(pi,DI,py(Io,{brighter(r){return r=r==null?Lh:Math.pow(Lh,r),new pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new pi(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 Ge(ud(r>=240?r-240:r+120,s,i),ud(r,s,i),ud(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new pi(Ty(this.h),Fh(this.s),Fh(this.l),Gh(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=Gh(this.opacity);return`${r===1?"hsl(":"hsla("}${Ty(this.h)}, ${Fh(this.s)*100}%, ${Fh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function Ty(r){return r=(r||0)%360,r<0?r+360:r}function Fh(r){return Math.max(0,Math.min(1,r||0))}function ud(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 dd=r=>()=>r;function kI(r,t){return function(e){return r+e*t}}function OI(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 BI(r){return(r=+r)==1?Sy:function(t,e){return e-t?OI(t,e,r):dd(isNaN(t)?e:t)}}function Sy(r,t){var e=t-r;return e?kI(r,e):dd(isNaN(r)?t:r)}const Ey=function r(t){var e=BI(t);function i(s,n){var o=e((s=cd(s)).r,(n=cd(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=Sy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function UI(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 WI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function XI(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]=md(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 ZI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Nh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function VI(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]=md(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var fd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pd=new RegExp(fd.source,"g");function HI(r){return function(){return r}}function KI(r){return function(t){return r(t)+""}}function YI(r,t){var e=fd.lastIndex=pd.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=fd.exec(r))&&(s=pd.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:Nh(i,s)})),e=pd.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?KI(h[0].x):HI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function md(r,t){var e=typeof t,i;return t==null||e==="boolean"?dd(t):(e==="number"?Nh:e==="string"?(i=Mo(t))?(t=i,Ey):YI:t instanceof Mo?Ey:t instanceof Date?ZI:WI(t)?UI:Array.isArray(t)?XI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?VI:Nh)(r,t)}function zI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function jI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Dh(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 Sn(r){return r=Dh(Math.abs(r)),r?r[1]:NaN}function JI(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 $I(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var QI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kh(r){if(!(t=QI.exec(r)))throw new Error("invalid format: "+r);var t;return new gd({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]})}kh.prototype=gd.prototype;function gd(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+""}gd.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 qI(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 Cy;function tA(r,t){var e=Dh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(Cy=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")+Dh(r,Math.max(0,t+n-1))[0]}function Iy(r,t){var e=Dh(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 Ay={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:jI,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)=>Iy(r*100,t),r:Iy,s:tA,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ry(r){return r}var My=Array.prototype.map,Ly=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function eA(r){var t=r.grouping===void 0||r.thousands===void 0?Ry:JI(My.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?Ry:$I(My.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(u){u=kh(u);var d=u.fill,f=u.align,p=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(x=!0,w="g"):Ay[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var S=m==="$"?e:m==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C=m==="$"?i:/[%p]/.test(w)?o:"",I=Ay[w],R=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function P(G){var N=S,A=C,k,V,K;if(w==="c")A=I(G)+A,G="";else{G=+G;var H=G<0||1/G<0;if(G=isNaN(G)?h:I(Math.abs(G),b),v&&(G=qI(G)),H&&+G==0&&p!=="+"&&(H=!1),N=(H?p==="("?p:a:p==="-"||p==="("?"":p)+N,A=(w==="s"?Ly[8+Cy/3]:"")+A+(H&&p==="("?")":""),R){for(k=-1,V=G.length;++k<V;)if(K=G.charCodeAt(k),48>K||K>57){A=(K===46?s+G.slice(k+1):G.slice(k))+A,G=G.slice(0,k);break}}}x&&!g&&(G=t(G,1/0));var $=N.length+G.length+A.length,U=$<y?new Array(y-$+1).join(d):"";switch(x&&g&&(G=t(U+G,U.length?y-A.length:1/0),U=""),f){case"<":G=N+G+A+U;break;case"=":G=N+U+G+A;break;case"^":G=U.slice(0,$=U.length>>1)+N+G+A+U.slice($);break;default:G=U+N+G+A;break}return n(G)}return P.toString=function(){return u+""},P}function c(u,d){var f=l((u=kh(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(Sn(d)/3)))*3,m=Math.pow(10,-p),g=Ly[8+p/3];return function(y){return f(m*y)+g}}return{format:l,formatPrefix:c}}var Oh,Py,Gy;iA({thousands:",",grouping:[3],currency:["$",""]});function iA(r){return Oh=eA(r),Py=Oh.format,Gy=Oh.formatPrefix,Oh}function rA(r){return Math.max(0,-Sn(Math.abs(r)))}function sA(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Sn(t)/3)))*3-Sn(Math.abs(r)))}function nA(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,Sn(t)-Sn(r))+1}function Fy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function oA(r){return function(){return r}}function aA(r){return+r}var Ny=[0,1];function En(r){return r}function yd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:oA(isNaN(t)?NaN:.5)}function hA(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function lA(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=yd(s,i),n=e(o,n)):(i=yd(i,s),n=e(n,o)),function(a){return n(i(a))}}function cA(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]=yd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=_I(r,a,1,i)-1;return n[h](s[h](a))}}function Dy(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function uA(){var r=Ny,t=Ny,e=md,i,s,n,o=En,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==En&&(o=hA(r[0],r[d-1])),a=d>2?cA:lA,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Nh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,aA),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=zI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:En,c()):o!==En},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function ky(){return uA()(En,En)}function dA(r,t,e,i){var s=hd(r,t,e),n;switch(i=kh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=sA(s,o))&&(i.precision=n),Gy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=nA(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=rA(s))&&(i.precision=n-(i.type==="%")*2);break}}return Py(i)}function fA(r){var t=r.domain;return r.ticks=function(e){var i=t();return SI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return dA(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,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=ad(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 Oy(){var r=ky();return r.copy=function(){return Dy(r,Oy())},Fy.apply(r,arguments),fA(r)}function pA(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 bd=new Date,xd=new Date;function se(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=>se(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)=>(bd.setTime(+n),xd.setTime(+o),r(bd),r(xd),Math.floor(e(bd,xd))),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 Bh=se(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Bh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?se(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Bh),Bh.range;const lr=1e3,ti=lr*60,cr=ti*60,ur=cr*24,_d=ur*7,By=ur*30,vd=ur*365,Cn=se(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*lr)},(r,t)=>(t-r)/lr,r=>r.getUTCSeconds());Cn.range;const wd=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*lr)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getMinutes());wd.range,se(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getUTCMinutes()).range;const Td=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*lr-r.getMinutes()*ti)},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getHours());Td.range,se(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getUTCHours()).range;const Lo=se(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ti)/ur,r=>r.getDate()-1);Lo.range;const Sd=se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ur,r=>r.getUTCDate()-1);Sd.range,se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ur,r=>Math.floor(r/ur)).range;function Ms(r){return se(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())*ti)/_d)}const Uh=Ms(0),Wh=Ms(1),mA=Ms(2),gA=Ms(3),In=Ms(4),yA=Ms(5),bA=Ms(6);Uh.range,Wh.range,mA.range,gA.range,In.range,yA.range,bA.range;function Ls(r){return se(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)/_d)}const Uy=Ls(0),Xh=Ls(1),xA=Ls(2),_A=Ls(3),An=Ls(4),vA=Ls(5),wA=Ls(6);Uy.range,Xh.range,xA.range,_A.range,An.range,vA.range,wA.range;const Ed=se(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());Ed.range,se(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 dr=se(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());dr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(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)}),dr.range;const Ps=se(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());Ps.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(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)}),Ps.range;function TA(r,t,e,i,s,n){const o=[[Cn,1,lr],[Cn,5,5*lr],[Cn,15,15*lr],[Cn,30,30*lr],[n,1,ti],[n,5,5*ti],[n,15,15*ti],[n,30,30*ti],[s,1,cr],[s,3,3*cr],[s,6,6*cr],[s,12,12*cr],[i,1,ur],[i,2,2*ur],[e,1,_d],[t,1,By],[t,3,3*By],[r,1,vd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),p=f?f.range(l,+c+1):[];return d?p.reverse():p}function h(l,c,u){const d=Math.abs(c-l)/u,f=od(([,,g])=>g).right(o,d);if(f===o.length)return r.every(hd(l/vd,c/vd,u));if(f===0)return Bh.every(Math.max(hd(l,c,u),1));const[p,m]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return p.every(m)}return[a,h]}const[SA,EA]=TA(dr,Ed,Uh,Lo,Td,wd);function Cd(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 Id(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 Po(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function CA(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=Go(s),c=Fo(s),u=Go(n),d=Fo(n),f=Go(o),p=Fo(o),m=Go(a),g=Fo(a),y=Go(h),x=Fo(h),b={a:H,A:$,b:U,B:D,c:null,d:Ky,e:Ky,f:jA,g:n2,G:a2,H:KA,I:YA,j:zA,L:Yy,m:JA,M:$A,p:F,q:Z,Q:qy,s:tb,S:QA,u:qA,U:t2,V:e2,w:i2,W:r2,x:null,X:null,y:s2,Y:o2,Z:h2,"%":Qy},v={a:tt,A:ft,b:ot,B:Et,c:null,d:jy,e:jy,f:d2,g:w2,G:S2,H:l2,I:c2,j:u2,L:Jy,m:f2,M:p2,p:Mt,q:bt,Q:qy,s:tb,S:m2,u:g2,U:y2,V:b2,w:x2,W:_2,x:null,X:null,y:v2,Y:T2,Z:E2,"%":Qy},w={a:P,A:G,b:N,B:A,c:k,d:Vy,e:Vy,f:XA,g:Zy,G:Xy,H:Hy,I:Hy,j:OA,L:WA,m:kA,M:BA,p:R,q:DA,Q:VA,s:HA,S:UA,u:LA,U:PA,V:GA,w:MA,W:FA,x:V,X:K,y:Zy,Y:Xy,Z:NA,"%":ZA};b.x=S(e,b),b.X=S(i,b),b.c=S(t,b),v.x=S(e,v),v.X=S(i,v),v.c=S(t,v);function S(B,j){return function(J){var O=[],gt=-1,ut=0,It=B.length,Dt,Ee,ri;for(J instanceof Date||(J=new Date(+J));++gt<It;)B.charCodeAt(gt)===37&&(O.push(B.slice(ut,gt)),(Ee=Wy[Dt=B.charAt(++gt)])!=null?Dt=B.charAt(++gt):Ee=Dt==="e"?" ":"0",(ri=j[Dt])&&(Dt=ri(J,Ee)),O.push(Dt),ut=gt+1);return O.push(B.slice(ut,gt)),O.join("")}}function C(B,j){return function(J){var O=Po(1900,void 0,1),gt=I(O,B,J+="",0),ut,It;if(gt!=J.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(j&&!("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?(ut=Id(Po(O.y,0,1)),It=ut.getUTCDay(),ut=It>4||It===0?Xh.ceil(ut):Xh(ut),ut=Sd.offset(ut,(O.V-1)*7),O.y=ut.getUTCFullYear(),O.m=ut.getUTCMonth(),O.d=ut.getUTCDate()+(O.w+6)%7):(ut=Cd(Po(O.y,0,1)),It=ut.getDay(),ut=It>4||It===0?Wh.ceil(ut):Wh(ut),ut=Lo.offset(ut,(O.V-1)*7),O.y=ut.getFullYear(),O.m=ut.getMonth(),O.d=ut.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),It="Z"in O?Id(Po(O.y,0,1)).getUTCDay():Cd(Po(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(It+5)%7:O.w+O.U*7-(It+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Id(O)):Cd(O)}}function I(B,j,J,O){for(var gt=0,ut=j.length,It=J.length,Dt,Ee;gt<ut;){if(O>=It)return-1;if(Dt=j.charCodeAt(gt++),Dt===37){if(Dt=j.charAt(gt++),Ee=w[Dt in Wy?j.charAt(gt++):Dt],!Ee||(O=Ee(B,J,O))<0)return-1}else if(Dt!=J.charCodeAt(O++))return-1}return O}function R(B,j,J){var O=l.exec(j.slice(J));return O?(B.p=c.get(O[0].toLowerCase()),J+O[0].length):-1}function P(B,j,J){var O=f.exec(j.slice(J));return O?(B.w=p.get(O[0].toLowerCase()),J+O[0].length):-1}function G(B,j,J){var O=u.exec(j.slice(J));return O?(B.w=d.get(O[0].toLowerCase()),J+O[0].length):-1}function N(B,j,J){var O=y.exec(j.slice(J));return O?(B.m=x.get(O[0].toLowerCase()),J+O[0].length):-1}function A(B,j,J){var O=m.exec(j.slice(J));return O?(B.m=g.get(O[0].toLowerCase()),J+O[0].length):-1}function k(B,j,J){return I(B,t,j,J)}function V(B,j,J){return I(B,e,j,J)}function K(B,j,J){return I(B,i,j,J)}function H(B){return o[B.getDay()]}function $(B){return n[B.getDay()]}function U(B){return h[B.getMonth()]}function D(B){return a[B.getMonth()]}function F(B){return s[+(B.getHours()>=12)]}function Z(B){return 1+~~(B.getMonth()/3)}function tt(B){return o[B.getUTCDay()]}function ft(B){return n[B.getUTCDay()]}function ot(B){return h[B.getUTCMonth()]}function Et(B){return a[B.getUTCMonth()]}function Mt(B){return s[+(B.getUTCHours()>=12)]}function bt(B){return 1+~~(B.getUTCMonth()/3)}return{format:function(B){var j=S(B+="",b);return j.toString=function(){return B},j},parse:function(B){var j=C(B+="",!1);return j.toString=function(){return B},j},utcFormat:function(B){var j=S(B+="",v);return j.toString=function(){return B},j},utcParse:function(B){var j=C(B+="",!0);return j.toString=function(){return B},j}}}var Wy={"-":"",_:" ",0:"0"},ue=/^\s*\d+/,IA=/^%/,AA=/[\\^$*+?|[\]().{}]/g;function Rt(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 RA(r){return r.replace(AA,"\\$&")}function Go(r){return new RegExp("^(?:"+r.map(RA).join("|")+")","i")}function Fo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function MA(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function LA(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function PA(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function GA(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function FA(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Xy(r,t,e){var i=ue.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Zy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function NA(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 DA(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function kA(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Vy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function OA(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Hy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function BA(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function UA(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function WA(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function XA(r,t,e){var i=ue.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function ZA(r,t,e){var i=IA.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function VA(r,t,e){var i=ue.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function HA(r,t,e){var i=ue.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Ky(r,t){return Rt(r.getDate(),t,2)}function KA(r,t){return Rt(r.getHours(),t,2)}function YA(r,t){return Rt(r.getHours()%12||12,t,2)}function zA(r,t){return Rt(1+Lo.count(dr(r),r),t,3)}function Yy(r,t){return Rt(r.getMilliseconds(),t,3)}function jA(r,t){return Yy(r,t)+"000"}function JA(r,t){return Rt(r.getMonth()+1,t,2)}function $A(r,t){return Rt(r.getMinutes(),t,2)}function QA(r,t){return Rt(r.getSeconds(),t,2)}function qA(r){var t=r.getDay();return t===0?7:t}function t2(r,t){return Rt(Uh.count(dr(r)-1,r),t,2)}function zy(r){var t=r.getDay();return t>=4||t===0?In(r):In.ceil(r)}function e2(r,t){return r=zy(r),Rt(In.count(dr(r),r)+(dr(r).getDay()===4),t,2)}function i2(r){return r.getDay()}function r2(r,t){return Rt(Wh.count(dr(r)-1,r),t,2)}function s2(r,t){return Rt(r.getFullYear()%100,t,2)}function n2(r,t){return r=zy(r),Rt(r.getFullYear()%100,t,2)}function o2(r,t){return Rt(r.getFullYear()%1e4,t,4)}function a2(r,t){var e=r.getDay();return r=e>=4||e===0?In(r):In.ceil(r),Rt(r.getFullYear()%1e4,t,4)}function h2(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Rt(t/60|0,"0",2)+Rt(t%60,"0",2)}function jy(r,t){return Rt(r.getUTCDate(),t,2)}function l2(r,t){return Rt(r.getUTCHours(),t,2)}function c2(r,t){return Rt(r.getUTCHours()%12||12,t,2)}function u2(r,t){return Rt(1+Sd.count(Ps(r),r),t,3)}function Jy(r,t){return Rt(r.getUTCMilliseconds(),t,3)}function d2(r,t){return Jy(r,t)+"000"}function f2(r,t){return Rt(r.getUTCMonth()+1,t,2)}function p2(r,t){return Rt(r.getUTCMinutes(),t,2)}function m2(r,t){return Rt(r.getUTCSeconds(),t,2)}function g2(r){var t=r.getUTCDay();return t===0?7:t}function y2(r,t){return Rt(Uy.count(Ps(r)-1,r),t,2)}function $y(r){var t=r.getUTCDay();return t>=4||t===0?An(r):An.ceil(r)}function b2(r,t){return r=$y(r),Rt(An.count(Ps(r),r)+(Ps(r).getUTCDay()===4),t,2)}function x2(r){return r.getUTCDay()}function _2(r,t){return Rt(Xh.count(Ps(r)-1,r),t,2)}function v2(r,t){return Rt(r.getUTCFullYear()%100,t,2)}function w2(r,t){return r=$y(r),Rt(r.getUTCFullYear()%100,t,2)}function T2(r,t){return Rt(r.getUTCFullYear()%1e4,t,4)}function S2(r,t){var e=r.getUTCDay();return r=e>=4||e===0?An(r):An.ceil(r),Rt(r.getUTCFullYear()%1e4,t,4)}function E2(){return"+0000"}function Qy(){return"%"}function qy(r){return+r}function tb(r){return Math.floor(+r/1e3)}var Rn,eb;C2({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 C2(r){return Rn=CA(r),eb=Rn.format,Rn.parse,Rn.utcFormat,Rn.utcParse,Rn}function I2(r){return new Date(r)}function A2(r){return r instanceof Date?+r:+new Date(+r)}function ib(r,t,e,i,s,n,o,a,h,l){var c=ky(),u=c.invert,d=c.domain,f=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),v=l("%Y");function w(S){return(h(S)<S?f:a(S)<S?p:o(S)<S?m:n(S)<S?g:i(S)<S?s(S)<S?y:x:e(S)<S?b:v)(S)}return c.invert=function(S){return new Date(u(S))},c.domain=function(S){return arguments.length?d(Array.from(S,A2)):d().map(I2)},c.ticks=function(S){var C=d();return r(C[0],C[C.length-1],S??10)},c.tickFormat=function(S,C){return C==null?w:l(C)},c.nice=function(S){var C=d();return(!S||typeof S.range!="function")&&(S=t(C[0],C[C.length-1],S??10)),S?d(pA(C,S)):c},c.copy=function(){return Dy(c,ib(r,t,e,i,s,n,o,a,h,l))},c}function R2(){return Fy.apply(ib(SA,EA,dr,Ed,Uh,Lo,Td,wd,Cn,eb).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function No(r,t,e){this.k=r,this.x=t,this.y=e}No.prototype={constructor:No,scale:function(r){return r===1?this:new No(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new No(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+")"}},No.prototype;function rb(r){return r.mode==="temporal"||r.mode==="left-aligned"?M2(r):L2(r)}function M2({domain:r,range:t}){return R2().domain(r).range(t)}function L2({domain:r,range:t}){return Oy().domain(r).range(t)}function Ad(r){return{mode:et.horizontal,range:TM(),domain:SM(r)}}function P2(){return{mode:et.vertical}}let Mn=null;async function G2(){const r=await gr();sb(r.start_time),q.on("layoutSettingsUpdated",()=>sb(r.start_time))}function F2(){Mn=null}async function ei(){return Mn||await Ie("scaleCreated")}async function sb(r){await ee();const t=Mn?"scaleUpdated":"scaleCreated",e=Ad(r);Mn=rb(e),q.emit(t,Mn)}let Fe=null,Rd=null;async function N2(){const r=await Qt(),t=await bu();Fe=new mI({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}),Fe.on("moved",()=>{q.emit("viewportMoved",null)}).on("moved-end",()=>{q.emit("viewportMoved",null)}),r.stage.addChild(Fe),q.emit("viewportCreated",Fe),q.on("applicationResized",X2),q.on("scaleUpdated",()=>Do()),U2()}function D2(){Fe=null,Rd=null}async function Md({animate:r}={}){const e=(await te()).getChildByName(Lf);if(!e)throw new Error("Nodes container not found");H2();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){O2({animate:r});return}k2({x:i,y:s,width:n,height:o,animate:r})}async function k2({x:r,y:t,width:e,height:i,animate:s}){const n=await Pt(),o=await te(),{guideTextSize:a,guideTextTopPadding:h,columnGap:l,rowGap:c,eventTargetSize:u}=n.styles,d=a+h,f=e+l*2,p=i+c*4+d+u,m=o.findFit(f,p);o.animate({position:{x:r+e/2,y:t+i/2+d},scale:Math.min(m,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),Do()}})}async function O2({animate:r}){const t=await gr(),e=await Pt(),i=await te(),s=await ei();let n=s(t.start_time)-e.styles.columnGap,o=s(t.end_time??new Date)+e.styles.columnGap;if(n>o){const c=n;n=o,o=c}const a=o-n,h=n+a/2,l=i.findFit(a,0);i.animate({position:{x:h,y:0},scale:l,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),Do()}})}async function te(){return Fe||await Ie("viewportCreated")}function nb(r){uy(Rd,r)||(Rd=r,q.emit("viewportDateRangeUpdated",r))}function B2({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 U2(){const r=await te();Do(),r.on("moved",()=>Do())}async function Do(){const r=await ob();r&&nb(r)}async function ob(){const r=await te(),t=await ei(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function W2(r){const t=await ob(),e=await ee();if(r===void 0||e.isDependency()||uy(r,t))return;const i=await te(),s=await ei(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;nb(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function X2(){const r=await Qt(),t=await te(),e=await bu(),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),B2({xOffset:a,yOffset:h})}class Zh{constructor(){Tf(this,"status","visible");Tf(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 Bi=null,ii=null,Ui=null,fr=null,mi=null;async function Z2(){const r=await te(),t=await Qt();Bi=new kC({toggle:"renderable"}),ii=new Zh,Ui=new Zh,mi=new Zh,fr=new Zh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;mi==null||mi.toggle(e),ii==null||ii.toggle(i),Ui==null||Ui.toggle(s),fr==null||fr.toggle(n),Bi==null||Bi.cull(t.renderer.screen),r.dirty=!1}}),q.emit("cullCreated",Bi),q.emit("labelCullCreated",ii),q.emit("iconCullCreated",ii),q.emit("edgeCullCreated",mi),q.emit("toggleCullCreated",fr)}function V2(){Bi=null,ii==null||ii.clear(),ii=null,Ui==null||Ui.clear(),Ui=null,mi==null||mi.clear(),mi=null,fr==null||fr.clear(),fr=null}async function Vh(){const r=await te();r.dirty=!0}function H2(){Bi&&Bi.uncull()}async function ab(){return Bi||await Ie("cullCreated")}async function K2(){return mi||await Ie("edgeCullCreated")}async function hb(){return ii||await Ie("labelCullCreated")}async function Y2(){return Ui||await Ie("iconCullCreated")}async function lb(){const r=await ee(),t=await Pt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return cy.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{Vh()}})}return{animate:e}}let Hh=new Map;function z2(){Hh=new Map}async function ko(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Hh.has(e))return Hh.get(e);const i=await r(...t);return Hh.set(e,i),i}async function j2({size:r,stroke:t=1,radius:e=0}){const i=await Qt(),s=new un;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new mt(0,0,r,r),resolution:10})}async function Oo(r){return await ko(j2,[r])}var Kh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Kh||{});function cb(){const r=new $t;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await Oo(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function J2(){const r=await Qt(),t=new un;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:vi.REPEAT})}async function Ld(){return await ko(J2,[])}function Pd(r,t){return Array.from({length:r},(e,i)=>t(i))}const $2=8,Q2=2;async function q2(){const r=await Pt(),t=await ab(),e=await K2(),{animate:i}=await lb(),s=new Ct,{element:n,render:o}=await cb(),a=await Ld(),h=Pd(20,()=>new dt),l=new LS(a,h);let c=!1;s.name=sx,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Kh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(p,m){const g=f(m);c||await u();for(const[y,x]of h.entries()){const{x:b,y:v}=g[y];i(x,{x:b,y:v},!c)}i(s,{x:p.x,y:p.y},!c),i(n,{x:m.x-$2,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-Q2,y:m},b={x:ub(y.x,{source:y,target:x}),y:y.y},v={x:ub(x.x,{source:y,target:x},!0),y:x.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=x;continue}const S=tR(w,{source:y,target:x,sourceBezier:b,targetBezier:v});g[w]=S}return g}return{element:s,render:u,setPosition:d}}function ub(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function tR(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,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,p=h+(c-h)*e,m=l+(u-l)*e,g=c+(d-c)*e,y=f+(m-f)*e,x=p+(g-p)*e;return{x:y,y:x}}async function eR({height:r,radius:t}){const e=await Qt(),i=new un;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new mt(0,0,t,r),resolution:10})}async function iR(r){return await ko(eR,[r])}function rR(){const r=new $t,t=new $t;async function e(i){const s=await iR(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 pr(){const r=await Ld();return new $t(r)}async function Gd(){const r=new Ct,t=await pr(),{left:e,right:i,render:s}=await rR();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,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),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,p=l?h.radius:0;return{width:d,visible:f,x:p}}return{element:r,render:n}}function Fd(){const r=new Ct,t=new $t,e=new $t,i=new $t,s=new $t,n=new $t,o=new $t,a=new $t,h=new $t;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:g="#fff",stroke:y,width:x,height:b}=p,v=typeof m=="number",w={topLeft:c(v?m:m[0],x,b),topRight:c(v?m:m[1],x,b),bottomLeft:c(v?m:m[2],x,b),bottomRight:c(v?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:w}),await d({width:x,height:b,stroke:y,cornerSizes:w}),f(g),r}function c(p,m,g){const y=Math.min(m,g);return{size:p*2>y?y/2:p,radius:p}}async function u({width:p,height:m,stroke:g,cornerSizes:y}){const{topLeft:x,topRight:b,bottomLeft:v,bottomRight:w}=y,[S,C,I,R]=await Promise.all([Oo({...x,stroke:g}),Oo({...b,stroke:g}),Oo({...v,stroke:g}),Oo({...w,stroke:g})]);t.texture=S,e.texture=C,i.texture=R,s.texture=I,t.position.set(0,0),e.position.set(p-b.size,0),i.position.set(0,m-v.size),s.position.set(p-w.size,m-w.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Ld(),{topLeft:b,topRight:v,bottomLeft:w,bottomRight:S}=y;a.texture=x,n.texture=x,o.texture=x,h.texture=x,n.position.set(0,b.size),n.height=Math.max(m-b.size-w.size,0),n.width=g,o.position.set(p-g,v.size),o.height=Math.max(m-v.size-S.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-v.size,0),a.height=g,h.position.set(w.size,m-g),h.width=Math.max(p-w.size-S.size,0),h.height=g}function f(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}}async function Yh(){const r=await Pt(),t=new Ct,{element:e,render:i}=await Fd();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function sR(){const r=await Pt(),t=new Ct,{element:e,render:i}=await Gd(),{element:s,render:n}=await Yh();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const nR=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function oR(r){const t={resolution:4};return nt.from(nR[r],t)}async function aR(r){return await ko(oR,[r])}async function hR({cullAtZoomThreshold:r=!0}={}){const t=await Y2(),e=new $t;r&&t.add(e);async function i(s){const n=await aR(s);return e.texture=n,e}return{element:e,render:i}}var db={exports:{}};(function(r){(function(){function t(m,g){document.addEventListener?m.addEventListener("scroll",g,!1):m.attachEvent("scroll",g)}function e(m){document.body?m():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),m()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),m())})}function i(m){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(m)),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(m,g){m.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(m){var g=m.g.offsetWidth,y=g+100;return m.j.style.width=y+"px",m.i.scrollLeft=y,m.h.scrollLeft=m.h.scrollWidth+100,m.l!==g?(m.l=g,!0):!1}function o(m,g){function y(){var b=x;n(b)&&b.g.parentNode!==null&&g(b.l)}var x=m;t(m.h,y),t(m.i,y),n(m)}function a(m,g,y){g=g||{},y=y||window,this.family=m,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(m){return l===null&&(f(m)&&/Apple/.test(window.navigator.vendor)?(m=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!m&&603>parseInt(m[1],10)):l=!1),l}function f(m){return u===null&&(u=!!m.document.fonts),u}function p(m,g){var y=m.style,x=m.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,x,c?m.stretch:"","100px",g].join(" ")}a.prototype.load=function(m,g){var y=this,x=m||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(S,C){if(f(y.context)&&!d(y.context)){var I=new Promise(function(P,G){function N(){new Date().getTime()-w>=v?G(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(A){1<=A.length?P():setTimeout(N,25)},G)}N()}),R=new Promise(function(P,G){b=setTimeout(function(){G(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([R,I]).then(function(){clearTimeout(b),S(y)},C)}else e(function(){function P(){var Z;(Z=V!=-1&&K!=-1||V!=-1&&H!=-1||K!=-1&&H!=-1)&&((Z=V!=K&&V!=H&&K!=H)||(h===null&&(Z=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!Z&&(536>parseInt(Z[1],10)||parseInt(Z[1],10)===536&&11>=parseInt(Z[2],10))),Z=h&&(V==$&&K==$&&H==$||V==U&&K==U&&H==U||V==D&&K==D&&H==D)),Z=!Z),Z&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),S(y))}function G(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),C(Error(""+v+"ms timeout exceeded"));else{var Z=y.context.document.hidden;(Z===!0||Z===void 0)&&(V=N.g.offsetWidth,K=A.g.offsetWidth,H=k.g.offsetWidth,P()),b=setTimeout(G,50)}}var N=new i(x),A=new i(x),k=new i(x),V=-1,K=-1,H=-1,$=-1,U=-1,D=-1,F=document.createElement("div");F.dir="ltr",s(N,p(y,"sans-serif")),s(A,p(y,"serif")),s(k,p(y,"monospace")),F.appendChild(N.g),F.appendChild(A.g),F.appendChild(k.g),y.context.document.body.appendChild(F),$=N.g.offsetWidth,U=A.g.offsetWidth,D=k.g.offsetWidth,G(),o(N,function(Z){V=Z,P()}),s(N,p(y,'"'+y.family+'",sans-serif')),o(A,function(Z){K=Z,P()}),s(A,p(y,'"'+y.family+'",serif')),o(k,function(Z){H=Z,P()}),s(k,p(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(db);var lR=db.exports;const cR=Vs(lR),fb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},pb={resolution:4,chars:fi.ASCII},mb="sans-serif",gb={inter:pR(fb.inter)};let Nd=!1;async function uR(){const r=Object.values(fb);await Promise.all(r.map(t=>dR(t))),Nd=!0,q.emit("fontsLoaded",gb)}async function dR(r){const{fontFamily:t,...e}=r,i=new cR(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${mb}`),fi.from(t,{fontFamily:mb,...e},pb);return}fi.from(t,r,pb)}function fR(){Nd=!1}async function yb(){return Nd?gb:await Ie("fontsLoaded")}function pR(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new nE(s,i)}async function zh({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await yb(),e=await hb(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const mR=["result","markdown","table","unknown"],bb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Dd=["flow-run","task-run"];function gR(r){return Dd.includes(r)}function jh(r){return Dd.includes(r.kind)}function xb(r){return r.kind==="artifact"}function _b(r){return r.kind==="artifacts"}function vb(r){return r.kind==="state"}function wb(r){return r.kind==="event"}function Tb(r){return r.kind==="events"}const yR=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function Sb({cullAtZoomThreshold:r}){const t=await Pt(),e=new Ct,i=new Ct,{element:s,render:n}=await hR({cullAtZoomThreshold:r}),{element:o,render:a}=await zh({cullAtZoomThreshold:r}),{element:h,render:l}=await sR();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:x,name:b,type:v}=y;c=x??c,u=b??u,d=v??d}return await Promise.all([p(),m()]),await g(),e}async function p(){if(!d)return s;const y=bb[d],{artifactIconSize:x,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,S=await n(y);return S.position={x:v,y:w},S.width=x,S.height=x,S.tint=b,S}async function m(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:x,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,S=y+v+w,C=x;return o.tint=b,o.scale.set(.75),o.position={x:S,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:x,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+x,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let Kt=null,Jh=!1;async function bR(){const r=await te();r.on("click",()=>Wi(null)),r.on("drag-start",()=>{Jh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Jh=!1})})}function xR(){Kt=null,Jh=!1}function Wi(r){if(!Jh&&!(!r&&!Kt||r&&mr(r))){if(Kt=r,r===null){q.emit("itemSelected",null);return}q.emit("itemSelected",r)}}function mr(r){if(Kt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return jh(Kt)&&Kt.id===r.id;case"flow-run":return jh(Kt)&&Kt.id===r.id;case"artifact":return xb(Kt)&&Kt.id===r.id;case"artifacts":return _b(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));case"state":return vb(Kt)&&Kt.id===r.id;case"event":return wb(Kt)&&Kt.id===r.id;case"events":return Tb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function _R(){return Kt&&jh(Kt)?Kt:null}async function kd(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Sb({cullAtZoomThreshold:t});let n=!1;i.eventMode="static",i.cursor="pointer",e&&i.on("click",c=>{c.stopPropagation(),Wi({kind:"artifact",id:r.id})}),q.on("itemSelected",()=>{const c=mr({kind:"artifact",id:r.id});c!==n&&(n=c,o())});async function o(){await s({selected:n,name:r.key,type:r.type})}function a(){return n}function h(){return r.created}function l(){return r.id}return{element:i,render:o,getSelected:a,getDate:h,getId:l}}async function Eb(r,t,e){const i=await gr(),s=await Pt();let n,o=null;async function a(){try{o=await s.fetchEvents(r,z.toValue(e)),t(o)}catch(l){console.error(l)}i.end_time||(n=setTimeout(()=>a(),zg(i)))}function h(){clearInterval(n)}return{start:a,stop:h}}async function vR(){const r=await Pt(),t=await hb(),e=new Ct,{element:i,render:s}=await cb(),{element:n,render:o}=await Gd(),{element:a,render:h}=await Fd();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:p}){l=f;const m={size:10,stroke:2,rotate:p?Kh.Up:Kh.Down},g=await s(m),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},x=await o(y);x.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:x.height/2,x:x.width/2},w=m.size/4;return g.x=v.x,g.y=p?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function Cb(){const r=await Pt(),t=await ee(),e=new Ct,{element:i,render:s}=await Gd(),{element:n,render:o}=await Yh();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=mr({kind:l.kind,id:l.id}),p=h(l,d),m=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:p,height:u,radius:d,background:c,capRight:m}),o({selected:f,width:p,height:u})]),i}function h(l,c){const u=Bd();if(et.isTemporal()||et.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,m=Pf(f,d)/aa*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Ib="Expected a function",Ab=NaN,wR="[object Symbol]",TR=/^\s+|\s+$/g,SR=/^[-+]0x[0-9a-f]+$/i,ER=/^0b[01]+$/i,CR=/^0o[0-7]+$/i,IR=parseInt,AR=typeof ve=="object"&&ve&&ve.Object===Object&&ve,RR=typeof self=="object"&&self&&self.Object===Object&&self,MR=AR||RR||Function("return this")(),LR=Object.prototype,PR=LR.toString,GR=Math.max,FR=Math.min,Od=function(){return MR.Date.now()};function NR(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(Ib);t=Rb(t)||0,$h(e)&&(c=!!e.leading,u="maxWait"in e,n=u?GR(Rb(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(S){var C=i,I=s;return i=s=void 0,l=S,o=r.apply(I,C),o}function p(S){return l=S,a=setTimeout(y,t),c?f(S):o}function m(S){var C=S-h,I=S-l,R=t-C;return u?FR(R,n-I):R}function g(S){var C=S-h,I=S-l;return h===void 0||C>=t||C<0||u&&I>=n}function y(){var S=Od();if(g(S))return x(S);a=setTimeout(y,m(S))}function x(S){return a=void 0,d&&i?f(S):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:x(Od())}function w(){var S=Od(),C=g(S);if(i=arguments,s=this,h=S,C){if(a===void 0)return p(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function DR(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Ib);return $h(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),NR(r,t,{leading:i,maxWait:t,trailing:s})}function $h(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function kR(r){return!!r&&typeof r=="object"}function OR(r){return typeof r=="symbol"||kR(r)&&PR.call(r)==wR}function Rb(r){if(typeof r=="number")return r;if(OR(r))return Ab;if($h(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=$h(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(TR,"");var e=ER.test(r);return e||CR.test(r)?IR(r.slice(2),e?2:8):SR.test(r)?Ab:+r}var BR=DR;const Mb=Vs(BR);async function Lb(){const{element:r,render:t}=await Sb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",q.on("itemSelected",()=>{const l=mr({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function UR(){const r=await Qt(),t=await gr(),e=await ee(),{element:i,render:s,update:n}=await Hb({isRoot:!0});i.zIndex=4;function o(a){if(et.isTemporal()&&!e.disableArtifacts){r.stage.addChild(i),s(a==null?void 0:a.artifacts);return}r.stage.removeChild(i)}t.artifacts&&o(t),q.on("viewportMoved",()=>n()),q.on("runDataCreated",a=>o(a)),q.on("runDataUpdated",a=>o(a)),q.on("configUpdated",()=>o()),q.on("layoutSettingsUpdated",()=>o())}function vL(){}async function WR({radius:r}){const t=await Qt(),e=new un;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:10})}async function XR(r){return await ko(WR,[r])}async function Pb(r){const t=await XR(r);return new $t(t)}async function Gb(r){const t=new Ct,e=await Pt(),i=await pr(),s=await Pb({radius:e.styles.eventRadiusDefault}),{element:n,render:o}=await Yh();let a=!1;t.addChild(i),t.addChild(s),t.addChild(n),t.eventMode="static",t.cursor="pointer",t.on("mouseenter",()=>{a||s.scale.set(1.5)}),t.on("mouseleave",()=>{a||s.scale.set(1)}),q.on("itemSelected",()=>{const u=mr({kind:"event",id:r.id,occurred:r.occurred});u!==a&&(a=u,s.scale.set(u?1.5:1),h())});function h(){const{eventColor:u,eventTargetSize:d,eventSelectedBorderInset:f}=e.styles;i.alpha=0,i.width=d,i.height=d,s.tint=u,s.anchor.set(.5),s.position.set(d/2,d/2),n.position.set(f,f),o({selected:a,width:d-f*2,height:d-f*2})}function l(){return r.id}function c(){return r.occurred}return{element:t,render:h,getId:l,getDate:c}}async function Fb(){const r=new Ct,t=await Pt(),e=await pr(),i=await Pb({radius:t.styles.eventClusterRadiusDefault}),{element:s,render:n}=await Yh(),{element:o,render:a}=await zh({cullAtZoomThreshold:!1});let h=null,l=[],c=!1;r.addChild(e),r.addChild(i),r.addChild(o),r.addChild(s),r.eventMode="static",r.cursor="pointer",r.on("mouseenter",()=>{c||i.scale.set(1.5)}),r.on("mouseleave",()=>{c||i.scale.set(1)}),q.on("itemSelected",()=>{const x=mr({kind:"events",occurred:h,ids:l});x!==c&&(c=x,i.scale.set(x?1.5:1),h&&u({ids:l,date:h}))});async function u(x){if(!x){h=null,l=[],r.visible=!1;return}const{ids:b,date:v}=x;h=v,l=b,d(),f(),m(),await p(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t.styles;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t.styles;i.tint=x,i.anchor.set(.5),i.position.set(b/2,b/2)}async function p(x){if(l.length<2)return;const{eventTargetSize:b}=t.styles,v=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+v),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t.styles;s.position.set(x,x),n({selected:c,width:b-x*2,height:b-x*2})}function g(){return l}function y(){return h}return{element:r,render:u,getIds:g,getDate:y}}function Vr(r){return"getIds"in r}async function Nb({items:r,createCluster:t}){const e=[...r.values()].sort((o,a)=>o.element.x-a.element.x);async function i(o){let a,h=null,l=null;for(let c=o??0;c<e.length;c++){const u=e[c],d=u.element.x;if(u.element.visible=!0,h!==null&&a&&d<a){l=c;break}h=c,a=d+u.element.width}if(l!==null&&h!==null){const c=e[h],u=e[l];c.element.visible=!1,u.element.visible=!1;const d=await s(c,u);d&&(e.splice(h,1,d),e.splice(l,1)),i(h)}}async function s(o,a){const h=o.getDate(),l=a.getDate(),c=Vr(o)?o.getIds():[o.getId()],u=Vr(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Vr(o)?d=o:Vr(a)?d=a:d=await t();const f=[...c,...u],p=n(f);return await d.render({ids:f,date:p}),d}function n(o){const a=o.reduce((c,u)=>{const d=r.get(u),f=d==null?void 0:d.getDate();return f&&c.push(f.getTime()),c},[]),h=Math.min(...a),l=Math.max(...a);return new Date((h+l)/2)}await i()}async function Db(r){const t=await Qt(),e=await te(),i=await Pt(),s=await ee();let n=await ei();const o=await h();o.element.on("click",c=>{c.stopPropagation();const{element:u}=o,d={x:u.position.x,y:u.position.y,width:u.width,height:u.height},f=Vr(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Wi(f)}),q.on("scaleUpdated",c=>{n=c,l()}),q.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Gb(r.event):await Fb()}function l(){const c=o.getDate();if(!c||s.disableEvents||!et.isTemporal())return;const{element:u}=o,f=n(c)*e.scale._x+e.worldTransform.tx-u.width/2,p=t.screen.height-u.height-i.styles.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function kb(r){const t=await te(),e=await ee();let i=await ei();const s=await o();s.element.on("click",h=>{h.stopPropagation();const{element:l}=s,c=l.getGlobalPosition(),u={x:c.x,y:c.y,width:l.width*t.scale.x,height:l.height*t.scale.y},d=Vr(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Wi(d)}),q.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Gb(r.event):await Fb()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!et.isTemporal()||!l)return;const{element:c}=s,d=i(h)-i(l)-c.width/2,f=-c.height;c.position.set(d,f)}return{...s,render:n}}async function Ob({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;q.on("scaleUpdated",()=>u());async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Db({type:"event",event:p}):await kb({type:"event",event:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){e.disableEvents||!et.isTemporal()||d()}const d=Mb(async()=>{o=[...n],await Nb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Db({type:"cluster"}):await kb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}let Bo=null,Ln=null;async function ZR(){const r=await Qt(),t=await Pt(),e=await ee(),{element:i,render:s,update:n}=await Ob({isRoot:!0});i.zIndex=2;async function o(h){if(!et.isTemporal()||e.disableEvents){r.stage.removeChild(i);return}r.stage.addChild(i),await s(h)}const a=await Eb(t.runId,h=>{const l=Ln?"eventDataUpdated":"eventDataCreated";Ln=h,q.emit(l,Ln),o(h)});q.on("configUpdated",()=>o()),q.on("viewportMoved",()=>n()),q.on("layoutSettingsUpdated",()=>o()),Bo=a.stop,a.start()}function VR(){Bo==null||Bo(),Bo=null,Ln=null}async function HR(){return Ln||await Ie("eventDataCreated")}async function KR(r){const t=await Qt(),e=await te(),i=await Pt(),s=await gr();let n=await ei();const o=new Ct,a=await pr(),h=await pr();let l=null,c=!1,u=!1;t.stage.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{c=!0,d()}),a.on("mouseleave",()=>{c=!1,d()}),a.on("click",()=>{const b={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Wi({...r,kind:"state",position:b})}),q.on("viewportMoved",()=>d()),q.on("scaleUpdated",b=>{n=b,d()}),q.on("itemSelected",()=>{const b=mr({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:v}=b??{};if(v&&(l=v),s.end_time&&y(),!et.isTemporal()){h.visible=!1,o.visible=!1;return}const w=f();p(w),m(w),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.styles.state(r),v=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let w=0;return r.type==="RUNNING"&&!s.end_time?w=n(new Date)*e.scale._x+e.worldTransform.tx-v:l?w=n(l)*e.scale._x+e.worldTransform.tx-v:w=t.screen.width-v,{x:v,width:Math.max(w,0),background:b}}function p({x:b,width:v,background:w}){const{flowStateBarHeight:S,flowStateSelectedBarHeight:C}=i.styles,I=c||u?C:S;a.x=b,a.y=t.screen.height-I,a.width=v,a.height=I,a.tint=w}function m({x:b,width:v,background:w}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:S,flowStateAreaAlpha:C}=i.styles;h.x=b,h.y=0,h.width=v,h.height=t.screen.height-S,h.tint=w,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function YR(r){return"isNodesFlowRunStateFactory"in r}async function zR(r){const t=await Qt(),e=await te(),i=await Pt(),s=await gr();let n=await ei();const o=new Ct,a=await pr(),h=await pr();let l=null,c=null,u=0,d=0,f=!1,p=!1;o.visible=!1,o.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{f=!0,m()}),a.on("mouseleave",()=>{f=!1,m()}),a.on("click",S=>{S.stopPropagation();const C=a.getGlobalPosition(),I={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Wi({...r,kind:"state",position:I})}),h.eventMode="none",h.cursor="default",q.on("scaleUpdated",S=>{n=S,m()}),q.on("itemSelected",()=>{const S=mr({kind:"state",...r});S!==p&&(p=S,f=!1,m())}),r.type==="RUNNING"&&!s.end_time&&b();function m(S){const{end:C,parentStartDate:I,width:R,height:P}=S??{};if(C&&(l=C),I&&(c=I),R&&(u=R),P&&(d=P),s.end_time&&v(),!et.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const G=g();if(G.width<=0){o.visible=!1;return}y(G),x(G),o.visible=!0}function g(){const{background:S="#fff"}=i.styles.state(r);if(!c)return{x:0,width:0,background:S};const C=n(c);let I=n(r.timestamp)-C;if(I>=u)return{x:u,width:0,background:S};I<0&&(I=0);let R=n(l??new Date)-C;R>u&&(R=u);const P=Math.max(R-I,0);return{x:I,width:P,background:S}}function y({x:S,width:C,background:I}){const{flowStateBarHeight:R,flowStateSelectedBarHeight:P}=i.styles,G=f||p?P:R;a.x=S,a.y=d-G,a.width=C,a.height=G,a.tint=I}function x({x:S,width:C,background:I}){const{flowStateBarHeight:R,flowStateAreaAlpha:P,nodeHeight:G}=i.styles,N=G/2;h.x=S,h.y=N,h.width=C,h.height=d-R-N,h.tint=I,h.alpha=P}function b(){t.ticker.add(w)}function v(){t.ticker.remove(w)}function w(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function Bb({isRoot:r}={}){const t=new Ct,e=new Map,i=new Map;let s=null;async function n(a,h){if(a&&(s=a),!s)return;const l=[];for(let c=0;c<s.length;c++)l.push(o(s[c],c,h));await Promise.all(l)}async function o(a,h,l){const c=s&&s.length>=h+1&&s[h+1],u=c?c.timestamp:void 0;let d;if(i.has(a.id)&&await i.get(a.id),e.has(a.id))d=e.get(a.id);else{const f=(async()=>{const p=r?await KR(a):await zR(a);e.set(a.id,p),t.addChild(p.element)})();i.set(a.id,f),await f,i.delete(a.id),d=e.get(a.id)}YR(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}async function jR(){const r=await Qt(),t=await gr(),{element:e,render:i}=await Bb({isRoot:!0});e.zIndex=3,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),q.on("runDataUpdated",n=>s(n)),q.on("configUpdated",()=>s()),q.on("layoutSettingsUpdated",()=>s())}function wL(){}async function JR(){const r=await Qt(),t=await te(),e=await ee(),i=await Pt(),{inter:s}=await yb(),n=new Ct,o=await pr();n.addChild(o);const a=s("");n.addChild(a);let h=await ei(),l,c;q.on("scaleUpdated",m=>{h=m,p()}),q.on("viewportMoved",()=>{e.disableGuides||(p(),n.height!==r.screen.height&&d())});function u(m,g){l=m,c=g,d(),f(m)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(m){a.text=c(m),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function p(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Ub extends Error{constructor(){super("Layout is not temporal")}}function $R(r){return r.toLocaleTimeString()}function Wb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function QR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function qR(r){return r.getHours()===0&&r.getMinutes()===0?`${Qh.date(r)}
1176
+ ${Wb(r)}`:Wb(r)}const Qh={timeBySeconds:$R,timeByMinutesWithDates:qR,date:QR},ne={seconds:"seconds",minutes:"minutes",date:"date"},Uo={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()}},At={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Xb=[{ceiling:At.second*4,increment:At.second,labelFormat:ne.seconds},{ceiling:At.second*8,increment:At.second*5,labelFormat:ne.seconds},{ceiling:At.second*13,increment:At.second*10,labelFormat:ne.seconds},{ceiling:At.second*20,increment:At.second*15,labelFormat:ne.seconds},{ceiling:At.second*45,increment:At.second*30,labelFormat:ne.seconds},{ceiling:At.minute*4,increment:At.minute,labelFormat:ne.minutes},{ceiling:At.minute*8,increment:At.minute*5,labelFormat:ne.minutes},{ceiling:At.minute*13,increment:At.minute*10,labelFormat:ne.minutes},{ceiling:At.minute*28,increment:At.minute*15,labelFormat:ne.minutes},{ceiling:At.hour*1.24,increment:At.minute*30,labelFormat:ne.minutes},{ceiling:At.hour*3,increment:At.hour,labelFormat:ne.minutes},{ceiling:At.hour*8,increment:At.hour*2,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*13,increment:At.hour*6,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*22,increment:At.hour*12,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.day*4,increment:At.day,getAnchor:Uo.day,labelFormat:ne.date},{ceiling:At.week*2,increment:At.week,getAnchor:Uo.week,labelFormat:ne.date},{ceiling:1/0,increment:At.week*4,labelFormat:ne.date}],tM=300;async function eM(){const r=await te(),t=await ee(),e=new Ct,i=new Map;let s=await ei();q.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:p}=a(),m=u(d,f);c(m,p)}catch(d){if(d instanceof Ub)return;console.error(d)}}async function o(){const d=[];Pd(30,async f=>{const p=JR();d.push(p);const m=await p;e.addChild(m.element),i.set(f,m)}),await Promise.all(d)}function a(){const d=r.left-tM,f=s.invert(d),p=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new Ub;const m=p.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:x}=h(m);return{anchor:y(f),increment:g,labelFormat:l(x)}}function h(d){const f=Xb.find(p=>p.ceiling>d)??Xb[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ne.minutes:return Qh.timeByMinutesWithDates;case ne.date:return Qh.date;default:return Qh.timeBySeconds}}function c(d,f){const p=new Map(i.entries()),m=Array.from(p.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(p.has(g)){const x=p.get(g);i.set(g,x),x.render(new Date(g),f);continue}const y=p.get(m.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Pd(30,p=>d+f*p)}return{element:e,render:n}}async function iM(){const r=await Qt(),{element:t,render:e}=await eM();r.stage.addChild(t),e(),q.on("viewportDateRangeUpdated",()=>e()),q.on("layoutSettingsUpdated",()=>e()),q.on("configUpdated",()=>e())}function TL(){}const rM=80;async function sM(){const r=await Qt(),t=await te(),e=await ee(),i=await Pt(),s=await pr();let n=await ei();q.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-rM))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function nM(){const r=await Qt(),t=await gr(),{element:e,render:i}=await sM();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),q.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function SL(){}function oM({stage:r,props:t}){uE(),N2(),G2(),iM(),mM(),UR(),ZR(),jR(),nM(),yE(),uR(),lE(r),vE(t),Z2(),vM(),bR()}function aM(){q.clear();try{dE(),D2(),F2(),cE(),gM(),VR(),wE(),bE(),fR(),V2(),wM(),xR(),z2()}catch(r){console.error(r)}}async function Zb(r){const t=await Qt(),e=await te(),i=await Pt(),s=await ee(),n=await HR();let o=await ei(),a=n&&n.length>0;const h=await c();h.element.on("click",d=>{d.stopPropagation();const{element:f}=h,p=f.getGlobalPosition(),m={x:p.x,y:p.y,width:f.width,height:f.height},g=Vr(h)?{kind:"artifacts",ids:h.getIds(),position:m}:{kind:"artifact",id:h.getId()};Wi(g)}),q.on("scaleUpdated",d=>{o=d,u()}),q.on("viewportMoved",()=>u()),q.on("eventDataCreated",d=>{a=d.length>0,u()}),q.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){await h.render(d),u()}async function c(){return r.type==="artifact"?await kd(r.artifact,{cullAtZoomThreshold:!1}):await Lb()}function u(){const d=h.getDate();if(!d||!et.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:p}=h,{eventTargetSize:m,flowStateSelectedBarHeight:g}=i.styles;let y=0;if(f){const{selectedBorderOffset:S,selectedBorderWidth:C}=i.styles;y=S+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,v=a&&!s.disableEvents?m:g,w=t.screen.height-(p.height-y)-v;p.position.set(b,w)}return{...h,render:l}}async function Vb(r){const t=await te(),e=await Pt(),i=await ee();let s=await ei();const n=await a();n.element.on("click",l=>{console.log("artifact click"),l.stopPropagation();const{element:c}=n,u=c.getGlobalPosition(),d={x:u.x,y:u.y,width:c.width*t.scale.x,height:c.height*t.scale.y},f=Vr(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Wi(f)}),q.on("scaleUpdated",l=>{s=l,h()});async function o(l){await n.render(l),h()}async function a(){return r.type==="artifact"?await kd(r.artifact):await Lb()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!et.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e.styles;f=y+x*2}const m=s(l)-s(c)-(d.width-f)/2,g=-(d.height-f);d.position.set(m,g)}return{...n,render:o}}async function Hb({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Zb({type:"artifact",artifact:p}):await Vb({type:"artifact",artifact:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){if(!(e.disableArtifacts||!et.isTemporal())){if(!et.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=Mb(async()=>{o=[...n],await Nb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Zb({type:"cluster"}):await Vb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}class Kb extends Ct{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 hM(r){const t=new Kb,e=await Pt(),i=await ee(),{element:s,render:n}=await Cb(),{element:o,render:a}=await zh(),{element:h,render:l}=await vR(),{element:c,render:u}=await Fd(),{element:d,render:f,getSize:p,stopWorker:m}=await Jb(),{element:g,render:y}=await Bb(),{element:x,render:b,update:v}=await Ob({parentStartDate:r.start_time}),{element:w,render:S,update:C}=await Hb({parentStartDate:r.start_time});let I=!1,R=!1,P=r,G=!1;t.sortableChildren=!0,c.zIndex=0,s.zIndex=4,o.zIndex=5,h.zIndex=5,d.zIndex=2,x.zIndex=1,g.zIndex=2,w.zIndex=3,c.eventMode="none",c.cursor="default";const{start:N,stop:A}=await Yg(P.id,B=>{R=!!B.artifacts&&B.artifacts.length>0,f(B),D(B.states),Z(B.artifacts),U()});function k(){return{since:P.start_time,until:P.end_time??new Date}}const{start:V,stop:K}=await Eb(P.id,B=>{I=B.length>0,F(B)},k);t.addChild(s),t.addChild(o),t.addChild(h),h.on("click",B=>{B.stopPropagation(),$()}),d.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},d.on("rendered",()=>{Vh(),Mt()});async function H(B){return P=B,await n(B),await ot(),await Et(),G&&(await D(),await F(),await Z(),await U()),t}async function $(){G?await ft():await tt()}async function U(){const{background:B="#fff"}=e.styles.node(P),{width:j,height:J}=p(),{height:O}=bt(),{nodeBorderRadius:gt}=e.styles,ut=2;c.position={x:-ut,y:-ut};const It=et.isTemporal()?O+ut*2:J+ut*2;await u({width:j+ut*2,height:It,stroke:ut,radius:[gt,gt,0,0],color:B})}async function D(B){const{height:j}=bt(),{width:J}=s;await y(B??void 0,{parentStartDate:P.start_time,width:J,height:j})}async function F(B){if(!G||!et.isTemporal()||i.disableEvents){t.removeChild(x);return}t.addChild(x);const{height:j}=bt();if(x.position={x:0,y:j-e.styles.eventBottomMargin},B){await b(B);return}await v()}async function Z(B){if(!G||!et.isTemporal()||i.disableArtifacts){t.removeChild(w);return}t.addChild(w);const{eventTargetSize:j,flowStateSelectedBarHeight:J}=e.styles,{height:O}=bt(),gt=O-(I&&!i.disableEvents?j:J);if(w.position={x:0,y:gt},B){await S(B);return}await C()}async function tt(){G=!0,t.addChild(g),t.addChild(d),t.addChild(c),await Promise.all([N(),V(),H(P)]),Mt()}async function ft(){G=!1,t.removeChild(g),t.removeChild(d),t.removeChild(c),t.removeChild(x),t.removeChild(w),m(),await Promise.all([A(),K(),H(P)]),Mt()}async function ot(){const B=e.styles.nodeToggleSize,j=e.styles.nodeHeight-B,J=s.width>B,O=await l({inside:J,isOpen:G});return O.x=J?j/2:s.width+e.styles.nodePadding,O.y=j/2,O}async function Et(){const B=await a(P.label),j=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,J=e.styles.nodePadding,O=h.x+h.width+J,gt=s.width+J,ut=s.width>O+B.width+J,It=e.styles.nodeHeight/2-B.height/2,Dt=ut?O:Math.max(gt,O);return B.position={x:Dt,y:It},B.tint=ut?j:e.styles.textDefault,B}function Mt(){G&&(D(),F(),Z(),U());const B=bt();t.emit("resized",B)}function bt(){const B=p(),{nodeHeight:j,nodesPadding:J,eventTargetSize:O,eventBottomMargin:gt,artifactPaddingY:ut,artifactIconSize:It}=e.styles,Ee=R&&et.isTemporal()&&!i.disableArtifacts?It+ut*2:0,Xo=I&&et.isTemporal()&&!i.disableEvents?O+gt:0,Kr=G?B.height+Ee+Xo+J*2:0,Fs=G?B.width:0;return{height:j+Kr,width:Math.max(Fs,t.width)}}return{kind:"flow-run",element:t,bar:s,render:H}}async function lM(){const r=await Pt(),t=new Kb,{element:e,render:i}=await zh(),{element:s,render:n}=await Cb();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,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function cM(r){const t=await Pt(),e=await Qt(),i=await ab(),s=await ee();let n=null;const o=new Map,{animate:a}=await lb(),{element:h,render:l,bar:c}=await C(r);let u=r,d=null,f=!1,p=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=rx,h.on("click",P=>{P.stopPropagation(),Wi({kind:u.kind,id:u.id})}),u.end_time||v(),q.on("itemSelected",()=>{const P=mr({kind:u.kind,id:u.id});P!==f&&(f=P,l(u))});async function m(P){u=P;const G=I(P);return G===d||(d=G,await Promise.all([l(P),g(P.artifacts)]),P.end_time&&w()),h}async function g(P){if(!P||(x(),s.disableArtifacts||!et.isTemporal()))return;const G=[];for(const N of P)G.push(y(N));await Promise.all(G),b()}async function y(P){if(o.has(P.id))return o.get(P.id).render();const G=await kd(P,{enableLocalClickHandling:!0});return o.set(P.id,G),n.addChild(G.element),G.render()}function x(){if(et.isTemporal()&&!s.disableArtifacts){n||(n=new Ct),h.addChild(n);return}n&&h.removeChild(n)}function b(){if(!n)return;const{artifactsGap:P,artifactsNodeOverlap:G}=t.styles;let N=0;for(const A of o.values())A.element.position.x=N,N+=A.element.width+P;n.position.y=-n.height+G,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(S)}function w(){e.ticker.remove(S)}function S(){m(u)}async function C(P){const{kind:G}=P;switch(G){case"task-run":return await lM();case"flow-run":return await hM(P);default:const N=G;throw new Error(`switch does not have case for value: ${N}`)}}function I(P){var k;const G=P.end_time??new Date,N=((k=P.artifacts)==null?void 0:k.length)??0;return[P.state_type,G.getTime(),N,et.horizontal,et.horizontalScaleMultiplier,t.styles.colorMode,N>0&&s.disableArtifacts].join("-")}function R({x:P,y:G}){a(h,{x:P,y:G},!p),p=!0}return{element:h,render:m,bar:c,setPosition:R}}function Yb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[p,m]of e.entries())if(m.has(u)){d=p,f=m.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function uM(r){throw new Error(`switch does not have case for value: ${r}`)}const zb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTw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OmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",dM=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),jb=typeof window<"u"&&window.Blob&&new Blob([dM(zb)],{type:"text/javascript;charset=utf-8"});function fM(r){let t;try{if(t=jb&&(window.URL||window.webkitURL).createObjectURL(jb),!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:text/javascript;base64,"+zb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function pM(r){const t=new fM;return t.onmessage=r,t}async function Jb(){const r=new Map,t=new Map,e=new Ct,i=new Ct,s=await Pt();let n=null;const o=Yb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Yb({gap:()=>s.styles.columnGap,minimum:()=>Bd()});let h=null,l=null;e.name=Lf,q.on("layoutUpdated",()=>{o.clear(),a.clear()}),q.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),A()}),q.on("itemSelected",()=>{A()});async function c(U){u(),l=U,h=null,await Promise.all([f(U),m(U)]),y(U)}function u(){n||(n=pM(G))}function d(){n&&(n.terminate(),n=null)}async function f(U){const D=[];for(const F of U.nodes.values())D.push(p(F));await Promise.all(D)}async function p(U){const{render:D}=await v(U);return await D(U)}async function m(U){if((await ee()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[Z,{children:tt}]of U.nodes)for(const{id:ft}of tt)F.push(g(Z,ft));await Promise.all(F)}async function g(U,D){const F=`${U}_${D}`;if(t.has(F))return;const Z=await q2();t.has(F)||(t.set(F,Z),i.addChild(Z.element))}function y(U){if(!n)throw new Error("Layout worker not initialized");const D=new Map;for(const[F,{element:Z}]of r)D.set(F,Z.width);n.postMessage({type:"layout",data:U,widths:D,horizontalSettings:Ad(U.start_time),verticalSettings:P2()})}function x(){if(h)for(const[U,D]of t){const[F,Z]=U.split("_"),tt=h.positions.get(F),ft=h.positions.get(Z),ot=r.get(F);if(!tt||!ft){console.warn(`Could not find edge in layout: Skipping ${U}`);continue}if(!ot){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Et=ot.bar.width,Mt=S(tt),bt={x:Mt.x+Et,y:Mt.y+s.styles.nodeHeight/2},B=S(ft),j={x:B.x-bt.x,y:B.y-bt.y+s.styles.nodeHeight/2};D.setPosition(bt,j)}}function b(){if(h){for(const[U,D]of r){const F=h.positions.get(U);if(!F){console.warn(`Could not find node in layout: Skipping ${U}`);continue}const Z=S(F);D.setPosition(Z),o.updateNodeAxis({nodeId:U,axis:F.y}),a.updateNodeAxis({nodeId:U,axis:F.column})}x(),e.emit("rendered"),e.emit("resized",P())}}async function v(U){const D=r.get(U.id);if(D)return D;const F=await cM(U);return F.element.on("resized",Z=>w(U.id,Z)),r.set(U.id,F),e.addChild(F.element),F}function w(U,D){if(!h)return;const F=r.get(U),Z=h.positions.get(U);!F||!Z||(o.setOffset({nodeId:U,axis:Z.y,offset:D.height}),a.setOffset({nodeId:U,axis:Z.column,offset:D.width}),b())}function S(U){const D=o.getTotalOffset(U.y);return{x:C(U),y:D}}function C(U){return et.isDependency()?a.getTotalOffset(U.column):U.x}function I(){return h?o.getTotalValue(h.maxRow):0}function R(){if(!h||!l)return 0;if(et.isDependency())return a.getTotalValue(h.maxColumn);const U=Ad(l.start_time),D=rb(U),F=D(l.end_time??new Date),Z=D(l.start_time);return F-Z}function P(){return{width:R(),height:I()}}function G({data:U}){const{type:D}=U;switch(D){case"layout":N(U);return;default:uM(D)}}function N(U){h=U.layout,b()}async function A(){const U=await ee(),D=_R();if(U.disableEdges||!D||!(l!=null&&l.nodes.has(D.id))){k([]);return}const F=H(D.id);k(F)}function k(U){V(U),K(U)}function V(U){for(const[D,{element:F}]of r){if(U.length===0||U.includes(D)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function K(U){for(const[D,{element:F}]of t){const[Z,tt]=D.split("_");if(U.length===0||U.includes(Z)&&U.includes(tt)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(U){const D=$(U,"parents"),F=$(U,"children");return[U,...D,...F]}function $(U,D){const F=l==null?void 0:l.nodes.get(U);if(!F)return[];const Z=[];for(const{id:tt}of F[D])Z.push(tt),Z.push(...$(tt,D));return Z}return{element:e,stopWorker:d,getSize:P,render:c}}let Wo=null,Hr=null,Gs=null;async function mM(){const r=await te(),t=await Pt(),{element:e,render:i}=await Jb();r.addChild(e),e.alpha=0;const s=await Yg(t.runId,async n=>{const o=Hr?"runDataUpdated":"runDataCreated";Hr=n,q.emit(o,Hr),await ee(),i(n)});q.on("configUpdated",()=>{Hr&&i(Hr)}),Gs=e,Wo=s.stop,Gs.once("rendered",()=>yM()),q.on("layoutUpdated",()=>bM()),s.start()}function gM(){Wo==null||Wo(),Wo=null,Gs=null,Hr=null}async function gr(){return Hr||await Ie("runDataCreated")}function yM(){Md(),Te.shared.addOnce(()=>{Gs&&(Gs.alpha=1)})}async function bM(){if(!Gs)return;const r=await Pt();Gs.once("rendered",()=>{setTimeout(()=>{Md({animate:!0})},r.animationDuration)})}function xM(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function _M({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(lx(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap,a=.5,h=4;return(e.size>0?e.size*o*a:o*h)*s/(n*20)}async function vM(){const r=await gr(),t=await Pt(),e=await Qt(),i=e.view.width/e.view.height,s=_M(r,t,i);qh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(et.disableAnimations=!0),xM(r.nodes)>t.disableEdgesThreshold&&(et.disableEdges=!0)}function wM(){et.horizontal="temporal",et.vertical="nearest-parent",et.horizontalScaleMultiplierDefault=0,et.horizontalScaleMultiplier=0,et.disableAnimations=!1,et.disableGuides=!1,et.disableEdges=!1,et.disableArtifacts=!1,et.disableEvents=!1}const et=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,disableEvents:!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 ee(){return Ud()?et:await Ie("layoutSettingsCreated")}function Bd(){return et.isDependency()?200:20*et.horizontalScaleMultiplier}function TM(){return[0,Bd()]}function SM(r){if(et.isDependency())return[0,1];const t=r,e=ax(t,1);return[t,e]}function qh(r,t=!1){if(et.horizontalScaleMultiplier===r)return;const e=Pn();et.horizontalScaleMultiplier=r,t&&(et.horizontalScaleMultiplierDefault=r),e()}function EM(){qh(et.horizontalScaleMultiplierDefault)}function CM(r){if(et.horizontal===r)return;const t=Pn();et.horizontal=r,et.disableGuides=et.isDependency()||et.isLeftAligned(),t()}function IM(r){if(et.vertical===r)return;const t=Pn();et.vertical=r,t()}function AM(r){if(et.disableEdges===r)return;const t=Pn();et.disableEdges=r,t()}function RM(r){if(et.disableArtifacts===r)return;const t=Pn();et.disableArtifacts=r,t()}function MM(r){if(et.disableEvents===r)return;const t=Pn();et.disableEvents=r,t()}function Pn(){const r=Ud()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=et;return()=>{Ud()&&q.emit(r,et),(t!==et.horizontal||e!==et.vertical)&&q.emit("layoutUpdated")}}function Ud(){return et.horizontalScaleMultiplier!==0}function $b(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const LM={class:"flex items-center gap-2"},PM=z.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=z.computed({get(){return`${et.horizontal}_${et.vertical}`},set(u){const[d,f]=u.split("_");CM(d),IM(f)}}),s=z.computed({get(){return et.disableEdges},set(u){AM(u)}}),n=z.computed({get(){return et.disableArtifacts},set(u){RM(u)}}),o=z.computed({get(){return et.disableEvents},set(u){MM(u)}});function a(){const d=et.horizontalScaleMultiplier*1.25;qh(d)}function h(){const u=Math.abs(-.75),d=et.horizontalScaleMultiplier*u;qh(d)}_r.useKeyDown(["-","="],l);function l(u){if(!($b(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"-":h();break;case"=":a();break}}function c(){EM()}return(u,d)=>{const f=z.resolveComponent("p-radio-group"),p=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),g=z.resolveComponent("p-checkbox"),y=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(zi.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:x})=>[z.createVNode(z.unref(zi.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:x},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(y,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(p,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(f,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=x=>i.value=x),options:e},{label:z.withCtx(({option:x})=>[z.createTextVNode(z.toDisplayString(x.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(et).isTemporal()||z.unref(et).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(p,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",LM,[z.createVNode(z.unref(zi.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:h}),z.createVNode(z.unref(zi.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),z.createVNode(z.unref(zi.PButton),{small:"",onClick:c},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=x=>s.value=x),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(g,{modelValue:n.value,"onUpdate:modelValue":d[2]||(d[2]=x=>n.value=x),label:"Hide artifacts"},null,8,["modelValue"]),z.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[3]||(d[3]=x=>o.value=x),label:"Hide events"},null,8,["modelValue"])]),_:1})]),_:1})}}}),GM={class:"run-graph__actions"},FM=z.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=z.ref(),s=z.ref(!1),n=z.computed({get(){return e.fullscreen??s.value},set(c){s.value=c,t("update:fullscreen",c)}});z.watch(()=>e.selected,c=>Wi(c)),q.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>W2(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));q.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Md({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");oM({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{aM()}),_r.useKeyDown(["c","f","Escape"],l);function l(c){if(!($b(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(c,u)=>{const d=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",o.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),z.createElementVNode("div",GM,[z.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),z.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),z.createVNode(PM)])],2)}}});Ft.RunGraph=FM,Ft.artifactTypeIconMap=bb,Ft.artifactTypes=mR,Ft.isArtifactSelection=xb,Ft.isArtifactsSelection=_b,Ft.isEventSelection=wb,Ft.isEventsSelection=Tb,Ft.isNodeSelection=jh,Ft.isRunGraphNodeType=gR,Ft.isStateSelection=vb,Ft.runGraphNodeKinds=Dd,Ft.stateType=yR,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
1177
1177
  //# sourceMappingURL=graphs.umd.js.map