(function(Y,Vt){typeof exports=="object"&&typeof module<"u"?Vt(exports):typeof define=="function"&&define.amd?define(["exports"],Vt):(Y=typeof globalThis<"u"?globalThis:Y||self,Vt(Y.VNVE={}))})(this,function(Y){"use strict";var TM=Object.defineProperty;var AM=(Y,Vt,Ti)=>Vt in Y?TM(Y,Vt,{enumerable:!0,configurable:!0,writable:!0,value:Ti}):Y[Vt]=Ti;var M=(Y,Vt,Ti)=>(AM(Y,typeof Vt!="symbol"?Vt+"":Vt,Ti),Ti);var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ti(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function jy(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 Nd={exports:{}};(function(r){(function(t,e){r.exports?r.exports=e():t.log=e()})(Vt,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"];function n(p,g){var _=p[g];if(typeof _.bind=="function")return _.bind(p);try{return Function.prototype.bind.call(_,p)}catch{return function(){return Function.prototype.apply.apply(_,[p,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(p){return p==="debug"&&(p="log"),typeof console===e?!1:p==="trace"&&i?o:console[p]!==void 0?n(console,p):console.log!==void 0?n(console,"log"):t}function h(p,g){for(var _=0;_=0&&w<=v.levels.SILENT){if(y=w,P!==!1&&b(w),h.call(v,w,p),typeof console===e&&w(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Vi||{}),Fh=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Fh||{}),Bo=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Bo||{}),q=(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))(q||{}),He=(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))(He||{}),R=(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))(R||{}),pr=(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))(pr||{}),j=(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))(j||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),ii=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(ii||{}),ri=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(ri||{}),$e=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))($e||{}),ie=(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))(ie||{}),ze=(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))(ze||{}),Fo=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Fo||{}),de=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(de||{}),Pt=(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))(Pt||{}),Ud=(r=>(r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA",r))(Ud||{}),Et=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Et||{}),Ve=(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))(Ve||{});const Gd={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")},$={ADAPTER:Gd,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Oh=/iPhone/i,Hd=/iPod/i,$d=/iPad/i,zd=/\biOS-universal(?:.+)Mac\b/i,Lh=/\bAndroid(?:.+)Mobile\b/i,Vd=/Android/i,ts=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Oo=/Silk/i,Ai=/Windows Phone/i,Wd=/\bWindows(?:.+)ARM\b/i,Xd=/BlackBerry/i,jd=/BB10/i,Yd=/Opera Mini/i,qd=/\b(CriOS|Chrome)(?:.+)Mobile/i,Kd=/Mobile(?:.+)Firefox\b/i,Zd=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function qy(r){return function(t){return t.test(r)}}function Jd(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=qy(e),n={apple:{phone:s(Oh)&&!s(Ai),ipod:s(Hd),tablet:!s(Oh)&&(s($d)||Zd(t))&&!s(Ai),universal:s(zd),device:(s(Oh)||s(Hd)||s($d)||s(zd)||Zd(t))&&!s(Ai)},amazon:{phone:s(ts),tablet:!s(ts)&&s(Oo),device:s(ts)||s(Oo)},android:{phone:!s(Ai)&&s(ts)||!s(Ai)&&s(Lh),tablet:!s(Ai)&&!s(ts)&&!s(Lh)&&(s(Oo)||s(Vd)),device:!s(Ai)&&(s(ts)||s(Oo)||s(Lh)||s(Vd))||s(/\bokhttp\b/i)},windows:{phone:s(Ai),tablet:s(Wd),device:s(Ai)||s(Wd)},other:{blackberry:s(Xd),blackberry10:s(jd),opera:s(Yd),firefox:s(Kd),chrome:s(qd),device:s(Xd)||s(jd)||s(Yd)||s(Kd)||s(qd)},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 Ky=Jd.default??Jd,We=Ky(globalThis.navigator);$.RETINA_PREFIX=/@([0-9\.]+)x/,$.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Qd={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,c||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],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=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,m=new Array(f);d80*e){a=l=r[0],h=u=r[1];for(var m=e;ml&&(l=c),d>u&&(u=d);f=Math.max(l-a,u-h),f=f!==0?32767/f:0}return Js(n,o,e,a,h,f,0),o}function tf(r,t,e,i,s){var n,o;if(s===Gh(r,t,e,i)>0)for(n=t;n=t;n-=i)o=sf(n,r[n],r[n+1],o);return o&&ko(o,o.next)&&(tn(o),o=o.next),o}function mr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(ko(e,e.next)||xt(e.prev,e,e.next)===0)){if(tn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Js(r,t,e,i,s,n,o){if(r){!o&&n&&av(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Qy(r,i,s,n):Jy(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),tn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=tv(mr(r),t,e),Js(r,t,e,i,s,n,2)):o===2&&ev(r,t,e,i,s,n):Js(mr(r),t,e,i,s,n,1);break}}}}function Jy(r){var t=r.prev,e=r,i=r.next;if(xt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,u=sn?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>=u&&m.x<=d&&m.y>=c&&m.y<=f&&is(s,a,n,h,o,l,m.x,m.y)&&xt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Qy(r,t,e,i){var s=r.prev,n=r,o=r.next;if(xt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,u=s.y,c=n.y,d=o.y,f=ah?a>l?a:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,_=Nh(f,m,t,e,i),v=Nh(p,g,t,e,i),y=r.prevZ,x=r.nextZ;y&&y.z>=_&&x&&x.z<=v;){if(y.x>=f&&y.x<=p&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&is(a,u,h,c,l,d,y.x,y.y)&&xt(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=f&&x.x<=p&&x.y>=m&&x.y<=g&&x!==s&&x!==o&&is(a,u,h,c,l,d,x.x,x.y)&&xt(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=p&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&is(a,u,h,c,l,d,y.x,y.y)&&xt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=v;){if(x.x>=f&&x.x<=p&&x.y>=m&&x.y<=g&&x!==s&&x!==o&&is(a,u,h,c,l,d,x.x,x.y)&&xt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function tv(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!ko(s,n)&&ef(s,i,i.next,n)&&Qs(s,n)&&Qs(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),tn(i),tn(i.next),i=r=n),i=i.next}while(i!==r);return mr(i)}function ev(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&uv(o,a)){var h=rf(o,a);o=mr(o,o.next),h=mr(h,h.next),Js(o,t,e,i,s,n,0),Js(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function iv(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n=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.x&&e.x>=l&&i!==e.x&&is(so.x||e.x===o.x&&ov(o,e)))&&(o=e,c=d)),e=e.next;while(e!==h);return o}function ov(r,t){return xt(r.prev,r,t.prev)<0&&xt(t.next,r,r.next)<0}function av(r,t,e,i){var s=r;do s.z===0&&(s.z=Nh(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,hv(s)}function hv(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;t0||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 Nh(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 lv(r){var t=r,e=r;do(t.x=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function uv(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!cv(r,t)&&(Qs(r,t)&&Qs(t,r)&&dv(r,t)&&(xt(r.prev,r,t.prev)||xt(r,t.prev,t))||ko(r,t)&&xt(r.prev,r,r.next)>0&&xt(t.prev,t,t.next)>0)}function xt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ko(r,t){return r.x===t.x&&r.y===t.y}function ef(r,t,e,i){var s=Uo(xt(r,t,e)),n=Uo(xt(r,t,i)),o=Uo(xt(e,i,r)),a=Uo(xt(e,i,t));return!!(s!==n&&o!==a||s===0&&No(r,e,t)||n===0&&No(r,i,t)||o===0&&No(e,r,i)||a===0&&No(e,t,i))}function No(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 Uo(r){return r>0?1:r<0?-1:0}function cv(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&&ef(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qs(r,t){return xt(r.prev,r,r.next)<0?xt(r,t,r.next)>=0&&xt(r,r.prev,t)>=0:xt(r,t,r.prev)<0||xt(r,r.next,t)<0}function dv(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 rf(r,t){var e=new Uh(r.i,r.x,r.y),i=new Uh(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 sf(r,t,e,i){var s=new Uh(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 tn(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 Uh(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}Lo.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(Gh(r,0,n,e));if(s)for(var a=0,h=t.length;a0&&(i+=r[s-1].length,e.holes.push(i))}return e};var fv=kh.exports;const nf=Ti(fv);var Go={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Go.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof Vt=="object"&&Vt;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,u=26,c=38,d=700,f=72,m=128,p="-",g=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=h-l,b=Math.floor,S=String.fromCharCode,A;function T(F){throw new RangeError(y[F])}function w(F,O){for(var tt=F.length,at=[];tt--;)at[tt]=O(F[tt]);return at}function P(F,O){var tt=F.split("@"),at="";tt.length>1&&(at=tt[0]+"@",F=tt[1]),F=F.replace(v,".");var et=F.split("."),pt=w(et,O).join(".");return at+pt}function N(F){for(var O=[],tt=0,at=F.length,et,pt;tt=55296&&et<=56319&&tt65535&&(O-=65536,tt+=S(O>>>10&1023|55296),O=56320|O&1023),tt+=S(O),tt}).join("")}function E(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:h}function C(F,O){return F+22+75*(F<26)-((O!=0)<<5)}function L(F,O,tt){var at=0;for(F=tt?b(F/d):F>>1,F+=b(F/O);F>x*u>>1;at+=h)F=b(F/x);return b(at+(x+1)*F/(F+c))}function z(F){var O=[],tt=F.length,at,et=0,pt=m,Bt=f,zt,ee,Ee,Xt,vt,Ft,Ot,xi,bi;for(zt=F.lastIndexOf(p),zt<0&&(zt=0),ee=0;ee=128&&T("not-basic"),O.push(F.charCodeAt(ee));for(Ee=zt>0?zt+1:0;Ee=tt&&T("invalid-input"),Ot=E(F.charCodeAt(Ee++)),(Ot>=h||Ot>b((a-et)/vt))&&T("overflow"),et+=Ot*vt,xi=Ft<=Bt?l:Ft>=Bt+u?u:Ft-Bt,!(Otb(a/bi)&&T("overflow"),vt*=bi;at=O.length+1,Bt=L(et-Xt,at,Xt==0),b(et/at)>a-pt&&T("overflow"),pt+=b(et/at),et%=at,O.splice(et++,0,pt)}return I(O)}function G(F){var O,tt,at,et,pt,Bt,zt,ee,Ee,Xt,vt,Ft=[],Ot,xi,bi,Co;for(F=N(F),Ot=F.length,O=m,tt=0,pt=f,Bt=0;Bt=O&&vtb((a-tt)/xi)&&T("overflow"),tt+=(zt-O)*xi,O=zt,Bt=0;Bta&&T("overflow"),vt==O){for(ee=tt,Ee=h;Xt=Ee<=pt?l:Ee>=pt+u?u:Ee-pt,!(ee"u"||!Lt?it:Lt(Uint8Array),_r={"%AggregateError%":typeof AggregateError>"u"?it:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?it:ArrayBuffer,"%ArrayIteratorPrototype%":ns&&Lt?Lt([][Symbol.iterator]()):it,"%AsyncFromSyncIteratorPrototype%":it,"%AsyncFunction%":os,"%AsyncGenerator%":os,"%AsyncGeneratorFunction%":os,"%AsyncIteratorPrototype%":os,"%Atomics%":typeof Atomics>"u"?it:Atomics,"%BigInt%":typeof BigInt>"u"?it:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?it:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?it:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?it:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?it:Float32Array,"%Float64Array%":typeof Float64Array>"u"?it:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?it:FinalizationRegistry,"%Function%":lf,"%GeneratorFunction%":os,"%Int8Array%":typeof Int8Array>"u"?it:Int8Array,"%Int16Array%":typeof Int16Array>"u"?it:Int16Array,"%Int32Array%":typeof Int32Array>"u"?it:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ns&&Lt?Lt(Lt([][Symbol.iterator]())):it,"%JSON%":typeof JSON=="object"?JSON:it,"%Map%":typeof Map>"u"?it:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ns||!Lt?it:Lt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?it:Promise,"%Proxy%":typeof Proxy>"u"?it:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?it:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?it:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ns||!Lt?it:Lt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?it:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ns&&Lt?Lt(""[Symbol.iterator]()):it,"%Symbol%":ns?Symbol:it,"%SyntaxError%":rs,"%ThrowTypeError%":Dv,"%TypedArray%":Fv,"%TypeError%":ss,"%Uint8Array%":typeof Uint8Array>"u"?it:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?it:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?it:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?it:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?it:WeakMap,"%WeakRef%":typeof WeakRef>"u"?it:WeakRef,"%WeakSet%":typeof WeakSet>"u"?it:WeakSet};if(Lt)try{null.error}catch(r){var Ov=Lt(Lt(r));_r["%Error.prototype%"]=Ov}var Lv=function r(t){var e;if(t==="%AsyncFunction%")e=$h("async function () {}");else if(t==="%GeneratorFunction%")e=$h("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=$h("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&Lt&&(e=Lt(s.prototype))}return _r[t]=e,e},uf={"%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"]},en=Hh,Ho=Mv,kv=en.call(Function.call,Array.prototype.concat),Nv=en.call(Function.apply,Array.prototype.splice),cf=en.call(Function.call,String.prototype.replace),$o=en.call(Function.call,String.prototype.slice),Uv=en.call(Function.call,RegExp.prototype.exec),Gv=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Hv=/\\(\\)?/g,$v=function(t){var e=$o(t,0,1),i=$o(t,-1);if(e==="%"&&i!=="%")throw new rs("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new rs("invalid intrinsic syntax, expected opening `%`");var s=[];return cf(t,Gv,function(n,o,a,h){s[s.length]=a?cf(h,Hv,"$1"):o||n}),s},zv=function(t,e){var i=t,s;if(Ho(uf,i)&&(s=uf[i],i="%"+s[0]+"%"),Ho(_r,i)){var n=_r[i];if(n===os&&(n=Lv(i)),typeof n>"u"&&!e)throw new ss("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new rs("intrinsic "+t+" does not exist!")},yr=function(t,e){if(typeof t!="string"||t.length===0)throw new ss("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ss('"allowMissing" argument must be a boolean');if(Uv(/^%?[^%]*%?$/,t)===null)throw new rs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=$v(t),s=i.length>0?i[0]:"",n=zv("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Nv(i,kv([0,1],l)));for(var u=1,c=!0;u=i.length){var p=gr(a,d);c=!!p,c&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[d]}else c=Ho(a,d),a=a[d];c&&!h&&(_r[o]=a)}}return a},df={exports:{}},Vv=yr,Vh=Vv("%Object.defineProperty%",!0),Wh=function(){if(Vh)try{return Vh({},"a",{value:1}),!0}catch{return!1}return!1};Wh.hasArrayLengthDefineBug=function(){if(!Wh())return null;try{return Vh([],"length",{value:1}).length!==1}catch{return!0}};var ff=Wh,Wv=yr,zo=Wv("%Object.getOwnPropertyDescriptor%",!0);if(zo)try{zo([],"length")}catch{zo=null}var pf=zo,Xv=ff(),Xh=yr,rn=Xv&&Xh("%Object.defineProperty%",!0);if(rn)try{rn({},"a",{value:1})}catch{rn=!1}var jv=Xh("%SyntaxError%"),as=Xh("%TypeError%"),mf=pf,Yv=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new as("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new as("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new as("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new as("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new as("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new as("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,h=!!mf&&mf(t,e);if(rn)rn(t,e,{configurable:o===null&&h?h.configurable:!o,enumerable:s===null&&h?h.enumerable:!s,value:i,writable:n===null&&h?h.writable:!n});else if(a||!s&&!n&&!o)t[e]=i;else throw new jv("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},gf=yr,_f=Yv,qv=ff(),yf=pf,vf=gf("%TypeError%"),Kv=gf("%Math.floor%"),Zv=function(t,e){if(typeof t!="function")throw new vf("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||Kv(e)!==e)throw new vf("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,n=!0;if("length"in t&&yf){var o=yf(t,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(n=!1)}return(s||n||!i)&&(qv?_f(t,"length",e,!0,!0):_f(t,"length",e)),t};(function(r){var t=Hh,e=yr,i=Zv,s=e("%TypeError%"),n=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,n),h=e("%Object.defineProperty%",!0),l=e("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}r.exports=function(d){if(typeof d!="function")throw new s("a function is required");var f=a(t,o,arguments);return i(f,1+l(0,d.length-(arguments.length-1)),!0)};var u=function(){return a(t,n,arguments)};h?h(r.exports,"apply",{value:u}):r.exports.apply=u})(df);var Jv=df.exports,xf=yr,bf=Jv,Qv=bf(xf("String.prototype.indexOf")),tx=function(t,e){var i=xf(t,!!e);return typeof i=="function"&&Qv(t,".prototype.")>-1?bf(i):i};const ex=jy(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var jh=typeof Map=="function"&&Map.prototype,Yh=Object.getOwnPropertyDescriptor&&jh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vo=jh&&Yh&&typeof Yh.get=="function"?Yh.get:null,wf=jh&&Map.prototype.forEach,qh=typeof Set=="function"&&Set.prototype,Kh=Object.getOwnPropertyDescriptor&&qh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wo=qh&&Kh&&typeof Kh.get=="function"?Kh.get:null,Tf=qh&&Set.prototype.forEach,ix=typeof WeakMap=="function"&&WeakMap.prototype,sn=ix?WeakMap.prototype.has:null,rx=typeof WeakSet=="function"&&WeakSet.prototype,nn=rx?WeakSet.prototype.has:null,sx=typeof WeakRef=="function"&&WeakRef.prototype,Af=sx?WeakRef.prototype.deref:null,nx=Boolean.prototype.valueOf,ox=Object.prototype.toString,ax=Function.prototype.toString,hx=String.prototype.match,Zh=String.prototype.slice,Wi=String.prototype.replace,lx=String.prototype.toUpperCase,Ef=String.prototype.toLowerCase,Sf=RegExp.prototype.test,Cf=Array.prototype.concat,si=Array.prototype.join,ux=Array.prototype.slice,Pf=Math.floor,Jh=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Qh=Object.getOwnPropertySymbols,tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,hs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",jt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===hs||"symbol")?Symbol.toStringTag:null,If=Object.prototype.propertyIsEnumerable,Rf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Mf(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Sf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Pf(-r):Pf(r);if(i!==r){var s=String(i),n=Zh.call(t,s.length+1);return Wi.call(s,e,"$&_")+"."+Wi.call(Wi.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Wi.call(t,e,"$&_")}var el=ex,Df=el.custom,Bf=Lf(Df)?Df:null,cx=function r(t,e,i,s){var n=e||{};if(Xi(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Xi(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=Xi(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(Xi(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(Xi(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 Nf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?Mf(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?Mf(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof t=="object")return il(t)?"[Array]":"[Object]";var c=Ix(n,i);if(typeof s>"u")s=[];else if(kf(s,t)>=0)return"[Circular]";function d(E,C,L){if(C&&(s=ux.call(s),s.push(C)),L){var z={depth:n.depth};return Xi(n,"quoteStyle")&&(z.quoteStyle=n.quoteStyle),r(E,z,i+1,s)}return r(E,n,i+1,s)}if(typeof t=="function"&&!Of(t)){var f=xx(t),m=Xo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+si.call(m,", ")+" }":"")}if(Lf(t)){var p=hs?Wi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):tl.call(t);return typeof t=="object"&&!hs?on(p):p}if(Sx(t)){for(var g="<"+Ef.call(String(t.nodeName)),_=t.attributes||[],v=0;v<_.length;v++)g+=" "+_[v].name+"="+Ff(dx(_[v].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="",g}if(il(t)){if(t.length===0)return"[]";var y=Xo(t,d);return c&&!Px(y)?"["+sl(y,c)+"]":"[ "+si.call(y,", ")+" ]"}if(px(t)){var x=Xo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!If.call(t,"cause")?"{ ["+String(t)+"] "+si.call(Cf.call("[cause]: "+d(t.cause),x),", ")+" }":x.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+si.call(x,", ")+" }"}if(typeof t=="object"&&o){if(Bf&&typeof t[Bf]=="function"&&el)return el(t,{depth:u-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(bx(t)){var b=[];return wf&&wf.call(t,function(E,C){b.push(d(C,t,!0)+" => "+d(E,t))}),Uf("Map",Vo.call(t),b,c)}if(Ax(t)){var S=[];return Tf&&Tf.call(t,function(E){S.push(d(E,t))}),Uf("Set",Wo.call(t),S,c)}if(wx(t))return rl("WeakMap");if(Ex(t))return rl("WeakSet");if(Tx(t))return rl("WeakRef");if(gx(t))return on(d(Number(t)));if(yx(t))return on(d(Jh.call(t)));if(_x(t))return on(nx.call(t));if(mx(t))return on(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Vt)return"{ [object globalThis] }";if(!fx(t)&&!Of(t)){var A=Xo(t,d),T=Rf?Rf(t)===Object.prototype:t instanceof Object||t.constructor===Object,w=t instanceof Object?"":"null prototype",P=!T&&jt&&Object(t)===t&&jt in t?Zh.call(ji(t),8,-1):w?"Object":"",N=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=N+(P||w?"["+si.call(Cf.call([],P||[],w||[]),": ")+"] ":"");return A.length===0?I+"{}":c?I+"{"+sl(A,c)+"}":I+"{ "+si.call(A,", ")+" }"}return String(t)};function Ff(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function dx(r){return Wi.call(String(r),/"/g,""")}function il(r){return ji(r)==="[object Array]"&&(!jt||!(typeof r=="object"&&jt in r))}function fx(r){return ji(r)==="[object Date]"&&(!jt||!(typeof r=="object"&&jt in r))}function Of(r){return ji(r)==="[object RegExp]"&&(!jt||!(typeof r=="object"&&jt in r))}function px(r){return ji(r)==="[object Error]"&&(!jt||!(typeof r=="object"&&jt in r))}function mx(r){return ji(r)==="[object String]"&&(!jt||!(typeof r=="object"&&jt in r))}function gx(r){return ji(r)==="[object Number]"&&(!jt||!(typeof r=="object"&&jt in r))}function _x(r){return ji(r)==="[object Boolean]"&&(!jt||!(typeof r=="object"&&jt in r))}function Lf(r){if(hs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!tl)return!1;try{return tl.call(r),!0}catch{}return!1}function yx(r){if(!r||typeof r!="object"||!Jh)return!1;try{return Jh.call(r),!0}catch{}return!1}var vx=Object.prototype.hasOwnProperty||function(r){return r in this};function Xi(r,t){return vx.call(r,t)}function ji(r){return ox.call(r)}function xx(r){if(r.name)return r.name;var t=hx.call(ax.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function kf(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;et.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return Nf(Zh.call(r,0,t.maxStringLength),t)+i}var s=Wi.call(Wi.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Cx);return Ff(s,"single",t)}function Cx(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":"")+lx.call(t.toString(16))}function on(r){return"Object("+r+")"}function rl(r){return r+" { ? }"}function Uf(r,t,e,i){var s=i?sl(e,i):si.call(e,", ");return r+" ("+t+") {"+s+"}"}function Px(r){for(var t=0;t=0)return!1;return!0}function Ix(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=si.call(Array(r.indent+1)," ");else return null;return{base:e,prev:si.call(Array(t+1),e)}}function sl(r,t){if(r.length===0)return"";var e=` `+t.prev+t.base;return e+si.call(r,","+e)+` `+t.prev}function Xo(r,t){var e=il(r),i=[];if(e){i.length=r.length;for(var s=0;s1;){var e=t.pop(),i=e.obj[e.prop];if(vr(i)){for(var s=[],n=0;n=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===Vx.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+ni[l];continue}if(l<2048){a=a+(ni[192|l>>6]+ni[128|l&63]);continue}if(l<55296||l>=57344){a=a+(ni[224|l>>12]+ni[128|l>>6&63]+ni[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=ni[240|l>>18]+ni[128|l>>12&63]+ni[128|l>>6&63]+ni[128|l&63]}return a},Kx=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s"u"&&(y=0)}if(typeof h=="function"?_=h(e,_):_ instanceof Date?_=c(_):i==="comma"&&Ei(_)&&(_=qo.maybeMap(_,function(z){return z instanceof Date?c(z):z})),_===null){if(n)return a&&!m?a(e,Yt.encoder,p,"key",d):e;_=""}if(s1(_)||qo.isBuffer(_)){if(a){var S=m?e:a(e,Yt.encoder,p,"key",d);return[f(S)+"="+f(a(_,Yt.encoder,p,"value",d))]}return[f(e)+"="+f(String(_))]}var A=[];if(typeof _>"u")return A;var T;if(i==="comma"&&Ei(_))m&&a&&(_=qo.maybeMap(_,a)),T=[{value:_.length>0?_.join(",")||null:void 0}];else if(Ei(h))T=h;else{var w=Object.keys(_);T=l?w.sort(l):w}for(var P=s&&Ei(_)&&_.length===1?e+"[]":e,N=0;N"u"?Yt.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Yt.charsetSentinel,delimiter:typeof t.delimiter>"u"?Yt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Yt.encode,encoder:typeof t.encoder=="function"?t.encoder:Yt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Yt.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Yt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Yt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Yt.strictNullHandling}},a1=function(r,t){var e=r,i=o1(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Ei(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in zf?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=zf[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var u=$f(),c=0;c0?m+f:""},us=Hf,cl=Object.prototype.hasOwnProperty,h1=Array.isArray,kt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:us.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},l1=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Xf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},u1="utf8=%26%2310003%3B",c1="utf8=%E2%9C%93",d1=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-1&&(m=h1(m)?[m]:m),cl.call(i,f)?i[f]=us.combine(i[f],m):i[f]=m}return i},f1=function(r,t,e,i){for(var s=i?t:Xf(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},p1=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,u=[];if(l){if(!i.plainObjects&&cl.call(Object.prototype,l)&&!i.allowPrototypes)return;u.push(l)}for(var c=0;i.depth>0&&(h=a.exec(n))!==null&&c"u"?kt.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?kt.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:kt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:kt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:kt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:kt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:kt.comma,decoder:typeof t.decoder=="function"?t.decoder:kt.decoder,delimiter:typeof t.delimiter=="string"||us.isRegExp(t.delimiter)?t.delimiter:kt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:kt.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:kt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:kt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:kt.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:kt.strictNullHandling}},g1=function(r,t){var e=m1(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?d1(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o",'"',"`"," ","\r",` `," "],S1=["{","}","|","\\","^","`"].concat(E1),dl=["'"].concat(S1),jf=["%","/","?",";","#"].concat(dl),Yf=["/","?","#"],C1=255,qf=/^[+a-z0-9A-Z_-]{0,63}$/,P1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,I1={javascript:!0,"javascript:":!0},fl={javascript:!0,"javascript:":!0},cs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},pl=x1;function Ko(r,t,e){if(r&&typeof r=="object"&&r instanceof Xe)return r;var i=new Xe;return i.parse(r,t,e),i}Xe.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&&i127?b+="x":b+=x[S];if(!b.match(qf)){var T=v.slice(0,f),w=v.slice(f+1),P=x.match(P1);P&&(T.push(P[1]),w.unshift(P[2])),w.length&&(a="/"+w.join(".")+a),this.hostname=T.join(".");break}}}this.hostname.length>C1?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=b1.toASCII(this.hostname));var N=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+N,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!I1[u])for(var f=0,y=dl.length;f0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.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(!v.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=v.slice(-1)[0],A=(e.host||r.host||v.length>1)&&(S==="."||S==="..")||S==="",T=0,w=v.length;w>=0;w--)S=v[w],S==="."?v.splice(w,1):S===".."?(v.splice(w,1),T++):T&&(v.splice(w,1),T--);if(!g&&!_)for(;T--;T)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),A&&v.join("/").substr(-1)!=="/"&&v.push("");var P=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(x){e.hostname=P?"":v.length?v.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return g=g||e.host&&v.length,g&&!P&&v.unshift(""),v.length>0?e.pathname=v.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},Xe.prototype.parseHost=function(){var r=this.host,t=T1.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};var D1=Ko,B1=M1,F1=R1;const Kf={};function K(r,t,e=3){if(Kf[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${r}`):(i=i.split(` `).splice(e).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${r}`),console.warn(i))),Kf[t]=!0}const O1={get parse(){return K("7.3.0","utils.url.parse is deprecated, use native URL API instead."),D1},get format(){return K("7.3.0","utils.url.format is deprecated, use native URL API instead."),F1},get resolve(){return K("7.3.0","utils.url.resolve is deprecated, use native URL API instead."),B1}};function je(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function hn(r){return r.split("?")[0].split("#")[0]}function L1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k1(r,t,e){return r.replace(new RegExp(L1(t),"g"),e)}function N1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a2){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 It={toPosix(r){return k1(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){je(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(je(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=hn(this.toPosix(t??$.ADAPTER.getBaseUrl())),s=hn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?It.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(je(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=N1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return je(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e0)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(je(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){je(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){je(r),t&&je(t),r=hn(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){je(r),r=hn(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){je(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=hn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,l=r.length-1,u=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let ml;async function Zf(){return ml??(ml=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return ie.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 ie.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]?ie.PMA:ie.UNPACK})()),ml}function U1(){K("7.0.0","skipHello is deprecated, please use settings.RENDER_OPTIONS.hello")}function G1(){K("7.0.0",`sayHello is deprecated, please use Renderer's "hello" option`)}let gl;function Jf(){return typeof gl>"u"&&(gl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:$.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!$.ADAPTER.getWebGLRenderingContext())return!1;const e=$.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}}()),gl}var H1={grad:.9,turn:360,rad:360/(2*Math.PI)},Si=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},Nt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ce=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Qf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},tp=function(r){return{r:Ce(r.r,0,255),g:Ce(r.g,0,255),b:Ce(r.b,0,255),a:Ce(r.a)}},_l=function(r){return{r:Nt(r.r),g:Nt(r.g),b:Nt(r.b),a:Nt(r.a,3)}},$1=/^#([0-9a-f]{3,8})$/i,Zo=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},ep=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}},ip=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}},rp=function(r){return{h:Qf(r.h),s:Ce(r.s,0,100),l:Ce(r.l,0,100),a:Ce(r.a)}},sp=function(r){return{h:Nt(r.h),s:Nt(r.s),l:Nt(r.l),a:Nt(r.a,3)}},np=function(r){return ip((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},ln=function(r){return{h:(t=ep(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},z1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,V1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,W1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,X1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yl={string:[[function(r){var t=$1.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?Nt(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?Nt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=W1.exec(r)||X1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:tp({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=z1.exec(r)||V1.exec(r);if(!t)return null;var e,i,s=rp({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(H1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return np(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 Si(t)&&Si(e)&&Si(i)?tp({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(!Si(t)||!Si(e)||!Si(i))return null;var o=rp({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return np(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Si(t)||!Si(e)||!Si(i))return null;var o=function(a){return{h:Qf(a.h),s:Ce(a.s,0,100),v:Ce(a.v,0,100),a:Ce(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return ip(o)},"hsv"]]},op=function(r,t){for(var e=0;e=.5},r.prototype.toHex=function(){return t=_l(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?Zo(Nt(255*n)):"","#"+Zo(e)+Zo(i)+Zo(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return _l(this.rgba)},r.prototype.toRgbString=function(){return t=_l(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 sp(ln(this.rgba))},r.prototype.toHslString=function(){return t=sp(ln(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=ep(this.rgba),{h:Nt(t.h),s:Nt(t.s),v:Nt(t.v),a:Nt(t.a,3)};var t},r.prototype.invert=function(){return oi({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),oi(vl(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),oi(vl(this.rgba,-t))},r.prototype.grayscale=function(){return oi(vl(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),oi(ap(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),oi(ap(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"?oi({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Nt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=ln(this.rgba);return typeof t=="number"?oi({h:t,s:e.s,l:e.l,a:e.a}):Nt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===oi(t).toHex()},r}(),oi=function(r){return r instanceof bl?r:new bl(r)},hp=[],Y1=function(r){r.forEach(function(t){hp.indexOf(t)<0&&(t(bl,yl),hp.push(t))})};function q1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var m in e){var p=(a=u,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));ps===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]=Ih.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=Ih.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=oi(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)}};ds.shared=new ds,ds.temp=new ds,ds.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let nt=ds;function K1(r,t=[]){return K("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),nt.shared.setValue(r).toRgbArray(t)}function lp(r){return K("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),nt.shared.setValue(r).toHex()}function Z1(r){return K("7.2.0","utils.string2hex is deprecated, use Color#toNumber instead"),nt.shared.setValue(r).toNumber()}function up(r){return K("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),nt.shared.setValue(r).toNumber()}function J1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[q.NORMAL_NPM]=q.NORMAL,r[q.ADD_NPM]=q.ADD,r[q.SCREEN_NPM]=q.SCREEN,t[q.NORMAL]=q.NORMAL_NPM,t[q.ADD]=q.ADD_NPM,t[q.SCREEN]=q.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const wl=J1();function Tl(r,t){return wl[t?1:0][r]}function Q1(r,t,e,i=!0){return K("7.2.0","utils.premultiplyRgba has moved to Color.premultiply"),nt.shared.setValue(r).premultiply(t,i).toArray(e??new Float32Array(4))}function tb(r,t){return K("7.2.0","utils.premultiplyTint has moved to Color.toPremultiplied"),nt.shared.setValue(r).toPremultiplied(t)}function eb(r,t,e,i=!0){return K("7.2.0","utils.premultiplyTintToRgba has moved to Color.premultiply"),nt.shared.setValue(r).premultiply(t,i).toArray(e??new Float32Array(4))}const cp=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function dp(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>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Al(r){return!(r&r-1)&&!!r}function El(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 xr(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(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))(k||{});const Il=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},vp=(r,t)=>Il(r).priority??t,V={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Il).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(Il).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)=>vp(n,e)-vp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class Qo{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 lb=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function ub(r){let t="";for(let e=0;e0&&(t+=` else `),e=0;--i){const s=ta[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class pe{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return 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(pe.prototype,{dispatch:{value:pe.prototype.emit},run:{value:pe.prototype.emit}});class fs{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new pe("setRealSize"),this.onUpdate=new pe("update"),this.onError=new pe("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 cn extends fs{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===ie.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 cb={scaleMode:ii.NEAREST,alphaMode:ie.NPM},kl=class Ys extends es{constructor(t=null,e=null){super(),e=Object.assign({},Ys.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:m}=e;t&&!(t instanceof fs)&&(t=Ll(t,m),t.internal=!0),this.resolution=f||$.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=Yi(),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=Al(this.realWidth)&&Al(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 fe[this.cacheId],delete re[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ys.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=$.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}_${Yi()}`}n=t._pixiId}let o=fe[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Ys(t,e),o.cacheId=n,Ys.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new cn(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=R.RGBA,a=j.FLOAT):t instanceof Int32Array?(o=R.RGBA_INTEGER,a=j.INT):t instanceof Uint32Array?(o=R.RGBA_INTEGER,a=j.UNSIGNED_INT):t instanceof Int16Array?(o=R.RGBA_INTEGER,a=j.SHORT):t instanceof Uint16Array?(o=R.RGBA_INTEGER,a=j.UNSIGNED_SHORT):t instanceof Int8Array?(o=R.RGBA,a=j.BYTE):(o=R.RGBA,a=j.UNSIGNED_BYTE),n.internal=!0,new Ys(n,Object.assign({},cb,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),fe[e]&&fe[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),fe[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=fe[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete fe[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e1){for(let c=0;c(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))(Ut||{});class B{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new B(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}}B.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ia=[new B,new B,new B,new B];class J{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=Ut.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 J(0,0,0,0)}clone(){return new J(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.y&&et.right?t.right:this.right)<=T)return!1;const w=this.yt.bottom?t.bottom:this.bottom)>w}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),u=ia[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=i||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=n||Math.min(a.y,h.y,l.y,u.y)>=o))return!1;const d=c*(h.y-a.y),f=c*(a.x-h.x),m=d*i+f*n,p=d*s+f*n,g=d*i+f*o,_=d*s+f*o;if(Math.max(m,p,g,_)<=d*a.x+f*a.y||Math.min(m,p,g,_)>=d*u.x+f*u.y)return!1;const v=c*(a.y-l.y),y=c*(l.x-a.x),x=v*i+y*n,b=v*s+y*n,S=v*i+y*o,A=v*s+y*o;return!(Math.max(x,b,S,A)<=v*a.x+y*a.y||Math.min(x,b,S,A)>=v*u.x+y*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}J.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class pn{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=Ut.CIRC}clone(){return new pn(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 J(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}pn.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class mn{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=Ut.ELIP}clone(){return new mn(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 J(this.x-this.width,this.y-this.height,this.width,this.height)}}mn.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class qi{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;se!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(i=!i)}return i}}qi.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class gn{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=Ut.RREC}clone(){return new gn(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}}gn.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class rt{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 B;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 B;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(fn-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 rt;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 rt}static get TEMP_MATRIX(){return new rt}}rt.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 br=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],wr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Tr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ar=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ul=[],Ap=[],ra=Math.sign;function _b(){for(let r=0;r<16;r++){const t=[];Ul.push(t);for(let e=0;e<16;e++){const i=ra(br[r]*br[e]+Tr[r]*wr[e]),s=ra(wr[r]*br[e]+Ar[r]*wr[e]),n=ra(br[r]*Tr[e]+Tr[r]*Ar[e]),o=ra(wr[r]*Tr[e]+Ar[r]*Ar[e]);for(let a=0;a<16;a++)if(br[a]===i&&wr[a]===s&&Tr[a]===n&&Ar[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new rt;t.set(br[r],wr[r],Tr[r],Ar[r],0,0),Ap.push(t)}}_b();const gt={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=>br[r],uY:r=>wr[r],vX:r=>Tr[r],vY:r=>Ar[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ul[r][t],sub:(r,t)=>Ul[r][gt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?gt.S:gt.N:Math.abs(t)*2<=Math.abs(r)?r>0?gt.E:gt.W:t>0?r>0?gt.SE:gt.SW:r>0?gt.NE:gt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Ap[gt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class qe{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 qe(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))}}qe.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Gl=class{constructor(){this.worldTransform=new rt,this.localTransform=new rt,this.position=new qe(this.onChange,this,0,0),this.scale=new qe(this.onChange,this,1,1),this.pivot=new qe(this.onChange,this,0,0),this.skew=new qe(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())}};Gl.IDENTITY=new Gl;let ps=Gl;ps.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 yb=`varying vec2 vTextureCoord; uniform sampler2D uSampler; void main(void){ gl_FragColor *= texture2D(uSampler, vTextureCoord); }`,vb=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void){ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; } `;function Ep(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Hl(r){const t=new Array(r);for(let e=0;er.type==="float"&&r.size===1&&!r.isArray,code:r=>` if(uv["${r}"] !== ud["${r}"].value) { ud["${r}"].value = uv["${r}"] gl.uniform1f(ud["${r}"].location, uv["${r}"]) } `},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++; renderer.texture.bind(uv["${r}"], t); if(ud["${r}"].value !== t) { ud["${r}"].value = t; gl.uniform1i(ud["${r}"].location, t); ; // eslint-disable-line max-len }`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>` gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true)); `,codeUbo:r=>` var ${r}_matrix = uv.${r}.toArray(true); data[offset] = ${r}_matrix[0]; data[offset+1] = ${r}_matrix[1]; data[offset+2] = ${r}_matrix[2]; data[offset + 4] = ${r}_matrix[3]; data[offset + 5] = ${r}_matrix[4]; data[offset + 6] = ${r}_matrix[5]; data[offset + 8] = ${r}_matrix[6]; data[offset + 9] = ${r}_matrix[7]; data[offset + 10] = ${r}_matrix[8]; `},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; if(cv[0] !== v.x || cv[1] !== v.y) { cv[0] = v.x; cv[1] = v.y; gl.uniform2f(ud["${r}"].location, v.x, v.y); }`,codeUbo:r=>` v = uv.${r}; data[offset] = v.x; data[offset+1] = v.y; `},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; if(cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(ud["${r}"].location, v[0], v[1]); } `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { cv[0] = v.x; cv[1] = v.y; cv[2] = v.width; cv[3] = v.height; gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height) }`,codeUbo:r=>` v = uv.${r}; data[offset] = v.x; data[offset+1] = v.y; data[offset+2] = v.width; data[offset+3] = v.height; `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; cv[3] = v.alpha; gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha) }`,codeUbo:r=>` v = uv.${r}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; data[offset+3] = v.alpha; `},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue) }`,codeUbo:r=>` v = uv.${r}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; `},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3]) }`}],xb={float:` if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,vec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(location, v[0], v[1]) }`,vec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3f(location, v[0], v[1], v[2]) }`,vec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(location, v[0], v[1], v[2], v[3]); }`,int:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,ivec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,ivec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,ivec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,uint:` if (cv !== v) { cu.value = v; gl.uniform1ui(location, v); }`,uvec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2ui(location, v[0], v[1]); }`,uvec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3ui(location, v[0], v[1], v[2]); }`,uvec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4ui(location, v[0], v[1], v[2], v[3]); }`,bool:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,bvec2:` if (cv[0] != v[0] || cv[1] != v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,bvec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,bvec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,samplerCube:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,sampler2DArray:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`},bb={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function wb(r,t){var i;const e=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; `];for(const s in r.uniforms){const n=t[s];if(!n){((i=r.uniforms[s])==null?void 0:i.group)===!0&&(r.uniforms[s].ubo?e.push(` renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}'); `):e.push(` renderer.shader.syncUniformGroup(uv.${s}, syncData); `));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h=Vi.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),ms=t}return ms}let sa;function Tb(){if(!sa){sa=de.MEDIUM;const r=Pp();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(sa=t.precision?de.HIGH:de.MEDIUM)}}return sa}function Ip(r,t){const e=r.getShaderSource(t).split(` `).map((l,u)=>`${u}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(` `),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(` `);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Ab(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Ip(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||Ip(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Eb={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 Rp(r){return Eb[r]}let na=null;const Mp={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 Dp(r,t){if(!na){const e=Object.keys(Mp);na={};for(let i=0;i0&&(e+=` else `),ithis.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=ti._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++Q._globalBatch,h=0,l=i[0],u=0;s.copyBoundTextures(n,e);for(let c=0;c=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,c),u=c,l=i[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++a);for(let c=0;c0);for(let p=0;p=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=0&&c=Vi.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")}}bn.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},bn.extension={type:k.RendererSystem,name:"context"},V.add(bn);class ha{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 pe("disposeFramebuffer"),this.multisample=Et.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new Q(null,{scaleMode:ii.NEAREST,resolution:1,mipmap:$e.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new Q(null,{scaleMode:ii.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:$e.OFF,format:R.DEPTH_COMPONENT,type:j.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{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===ie.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 la{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=gt.add(i,gt.NW),this.x0=h+o*gt.uX(i),this.y0=l+a*gt.uY(i),i=gt.add(i,2),this.x1=h+o*gt.uX(i),this.y1=l+a*gt.uY(i),i=gt.add(i,2),this.x2=h+o*gt.uX(i),this.y2=l+a*gt.uY(i),i=gt.add(i,2),this.x3=h+o*gt.uX(i),this.y3=l+a*gt.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}}la.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 kp=new la;function ua(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class U extends es{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new J(0,0,1,1)),t instanceof U&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=kp,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 B(o.x,o.y):new B(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&&re[e.url]&&U.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,U.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 U(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===kp&&(this._uvs=new la),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=$.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof Q){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Yi()}`,Q.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Yi()}`}n=t._pixiId}let o=re[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof Q)?(e.resolution||(e.resolution=ai(t)),o=new U(new Q(t,e)),o.baseTexture.cacheId=n,Q.addToCache(o.baseTexture,n),U.addToCache(o,n)):!o&&t instanceof Q&&(o=new U(t),U.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=U.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 U(Q.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new Q(t,Object.assign({scaleMode:Q.defaultOptions.scaleMode,resolution:ai(e)},s)),{resource:o}=n;o instanceof Xl&&(o.url=e);const a=new U(n);return i||(i=e),Q.addToCache(a.baseTexture,i),U.addToCache(a,i),i!==e&&(Q.addToCache(a.baseTexture,e),U.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),re[e]&&re[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),re[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=re[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete re[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;ethis.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return U._EMPTY||(U._EMPTY=new U(new Q),ua(U._EMPTY),ua(U._EMPTY.baseTexture)),U._EMPTY}static get WHITE(){if(!U._WHITE){const t=$.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),U._WHITE=new U(Q.from(t)),ua(U._WHITE),ua(U._WHITE.baseTexture)}return U._WHITE}}class Zi extends U{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 Zi(new Wl(t))}}class jl{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Et.NONE){const s=new Wl(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Zi(s)}getOptimalTexture(t,e,i=1,s=Et.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=un(t),e=un(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||Et.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;s0&&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;s1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),i[c].apply(this,l,u,ze.CLEAR,e);const d=l;l=u,u=d}i[c].apply(this,l,h.renderTexture,ze.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=ze.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===ze.CLEAR||e===ze.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(He.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(He.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(rt.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=Et.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||Et.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=ca[0],s=ca[1],n=ca[2],o=ca[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),u=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=u-h}roundFrame(t,e,i,s,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?ql.copyFrom(n):ql.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)}}}Kl.extension={type:k.RendererSystem,name:"filter"},V.add(Kl);class Gp{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Et.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Fb=new J;class Zl{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new ha(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 J,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;$.PREFER_ENV===Vi.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>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=Bo.COLOR|Bo.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new Gp(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;o1&&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;h1&&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=Et.NONE;if(t<=1||e===null)return i;for(let s=0;s=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;ii.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"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;s0?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}}tu.extension={type:k.RendererSystem,name:"mask"},V.add(tu);class Vp{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 Wp=new rt,Xp=[],jp=class Rh extends Vp{constructor(t){super(t),this.glConst=$.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,Xp.pop()??new J);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()||Rh.isMatrixRotated(e.worldTransform)||Rh.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){Rh.isMatrixRotated(n)||(n=n?Wp.copyFrom(n):Wp.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&&Xp.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)}};jp.extension={type:k.RendererSystem,name:"scissor"};let Yp=jp;V.add(Yp);class eu extends Vp{constructor(t){super(t),this.glConst=$.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)}}eu.extension={type:k.RendererSystem,name:"stencil"},V.add(eu);class iu{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return K("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return K("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return K("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}}iu.extension={type:[k.RendererSystem,k.CanvasRendererSystem],name:"_plugin"},V.add(iu);class ru{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new rt,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}}ru.extension={type:k.RendererSystem,name:"projection"},V.add(ru);const kb=new ps,qp=new J;class su{constructor(t){this.renderer=t,this._tempMatrix=new rt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(qp))||t.getLocalBounds(qp,!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=Zi.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=kb,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}su.extension={type:[k.RendererSystem,k.CanvasRendererSystem],name:"textureGenerator"},V.add(su);const Sr=new J,wn=new J;class nu{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new J,this.destinationFrame=new J,this.viewportFrame=new J}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||(Sr.width=t.frame.width,Sr.height=t.frame.height,e=Sr),i||(wn.x=t.frame.x,wn.y=t.frame.y,wn.width=e.width,wn.height=e.height,i=wn),o=n.framebuffer):(a=s.resolution,e||(Sr.width=s._view.screen.width,Sr.height=s._view.screen.height,e=Sr),i||(i=Sr,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=nt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}nu.extension={type:k.RendererSystem,name:"renderTexture"},V.add(nu);class Nb{}class Kp{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 Ub(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;sl>u?1:-1);for(let l=0;l({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,s=0;for(let n=0;n1&&(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 tm(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 em(r,t){if(!r.autoManage)return{size:0,syncFunc:Hb};const e=tm(r.uniforms,t),{uboElements:i,size:s}=Qp(e),n=[` var v = null; var v2 = null; var cv = null; var t = 0; var gl = renderer.gl var index = 0; var data = buffer.data; `];for(let o=0;o1){const c=Rp(a.data.type),d=Math.max(Jp[a.data.type]/16,1),f=c/d,m=(4-f%4)%4;n.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${a.offset/4}; t = 0; for(var i=0; i < ${a.data.size*d}; i++) { for(var j = 0; j < ${f}; j++) { data[offset++] = v[t++]; } offset += ${m}; } `)}else{const c=$b[a.data.type];n.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${a.offset/4}; ${c}; `)}}return n.push(` renderer.buffer.update(buffer); `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` `))}}let zb=0;const fa={textureCount:0,uboCount:0};class ou{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=zb++}systemCheck(){if(!Fp())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||(fa.textureCount=0,fa.uboCount=0,this.syncUniformGroup(t.uniformGroup,fa)),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]=wb(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,fa,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]=em(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=Zp(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}}ou.extension={type:k.RendererSystem,name:"shader"},V.add(ou);class Tn{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(){}}Tn.defaultOptions={hello:!1},Tn.extension={type:[k.RendererSystem,k.CanvasRendererSystem],name:"startup"},V.add(Tn);function Vb(r,t=[]){return t[q.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.ADD]=[r.ONE,r.ONE],t[q.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.NONE]=[0,0],t[q.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[q.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[q.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[q.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[q.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[q.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[q.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[q.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[q.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[q.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[q.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Wb=0,Xb=1,jb=2,Yb=3,qb=4,Kb=5,im=class Md{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=q.NONE,this._blendEq=!1,this.map=[],this.map[Wb]=this.setBlend,this.map[Xb]=this.setOffset,this.map[jb]=this.setCullFace,this.map[Yb]=this.setDepthTest,this.map[qb]=this.setFrontFace,this.map[Kb]=this.setDepthMask,this.checks=[],this.defaultState=new Ye,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Vb(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<>1,i++;this.stateId=t.data}for(let e=0;et.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 pe(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 An=class Mh{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Mh.defaultMaxIdle,this.checkCountMax=Mh.defaultCheckCountMax,this.mode=Mh.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Fo.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;sthis.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};An.defaultMode=Fo.AUTO,An.defaultMaxIdle=60*60,An.defaultCheckCountMax=60*10,An.extension={type:k.RendererSystem,name:"textureGC"};let Ji=An;V.add(Ji);class pa{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=j.UNSIGNED_BYTE,this.internalFormat=R.RGBA,this.samplerType=0}}function Zb(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.R8]:H.FLOAT,[r.R8_SNORM]:H.FLOAT,[r.RG8]:H.FLOAT,[r.RG8_SNORM]:H.FLOAT,[r.RGB8]:H.FLOAT,[r.RGB8_SNORM]:H.FLOAT,[r.RGB565]:H.FLOAT,[r.RGBA4]:H.FLOAT,[r.RGB5_A1]:H.FLOAT,[r.RGBA8]:H.FLOAT,[r.RGBA8_SNORM]:H.FLOAT,[r.RGB10_A2]:H.FLOAT,[r.RGB10_A2UI]:H.FLOAT,[r.SRGB8]:H.FLOAT,[r.SRGB8_ALPHA8]:H.FLOAT,[r.R16F]:H.FLOAT,[r.RG16F]:H.FLOAT,[r.RGB16F]:H.FLOAT,[r.RGBA16F]:H.FLOAT,[r.R32F]:H.FLOAT,[r.RG32F]:H.FLOAT,[r.RGB32F]:H.FLOAT,[r.RGBA32F]:H.FLOAT,[r.R11F_G11F_B10F]:H.FLOAT,[r.RGB9_E5]:H.FLOAT,[r.R8I]:H.INT,[r.R8UI]:H.UINT,[r.R16I]:H.INT,[r.R16UI]:H.UINT,[r.R32I]:H.INT,[r.R32UI]:H.UINT,[r.RG8I]:H.INT,[r.RG8UI]:H.UINT,[r.RG16I]:H.INT,[r.RG16UI]:H.UINT,[r.RG32I]:H.INT,[r.RG32UI]:H.UINT,[r.RGB8I]:H.INT,[r.RGB8UI]:H.UINT,[r.RGB16I]:H.INT,[r.RGB16UI]:H.UINT,[r.RGB32I]:H.INT,[r.RGB32UI]:H.UINT,[r.RGBA8I]:H.INT,[r.RGBA8UI]:H.UINT,[r.RGBA16I]:H.INT,[r.RGBA16UI]:H.UINT,[r.RGBA32I]:H.INT,[r.RGBA32UI]:H.UINT,[r.DEPTH_COMPONENT16]:H.FLOAT,[r.DEPTH_COMPONENT24]:H.FLOAT,[r.DEPTH_COMPONENT32F]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT,[r.DEPTH24_STENCIL8]:H.FLOAT,[r.DEPTH32F_STENCIL8]:H.FLOAT}:t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT},t}function Jb(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[j.UNSIGNED_BYTE]:{[R.RGBA]:r.RGBA8,[R.RGB]:r.RGB8,[R.RG]:r.RG8,[R.RED]:r.R8,[R.RGBA_INTEGER]:r.RGBA8UI,[R.RGB_INTEGER]:r.RGB8UI,[R.RG_INTEGER]:r.RG8UI,[R.RED_INTEGER]:r.R8UI,[R.ALPHA]:r.ALPHA,[R.LUMINANCE]:r.LUMINANCE,[R.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[j.BYTE]:{[R.RGBA]:r.RGBA8_SNORM,[R.RGB]:r.RGB8_SNORM,[R.RG]:r.RG8_SNORM,[R.RED]:r.R8_SNORM,[R.RGBA_INTEGER]:r.RGBA8I,[R.RGB_INTEGER]:r.RGB8I,[R.RG_INTEGER]:r.RG8I,[R.RED_INTEGER]:r.R8I},[j.UNSIGNED_SHORT]:{[R.RGBA_INTEGER]:r.RGBA16UI,[R.RGB_INTEGER]:r.RGB16UI,[R.RG_INTEGER]:r.RG16UI,[R.RED_INTEGER]:r.R16UI,[R.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[j.SHORT]:{[R.RGBA_INTEGER]:r.RGBA16I,[R.RGB_INTEGER]:r.RGB16I,[R.RG_INTEGER]:r.RG16I,[R.RED_INTEGER]:r.R16I},[j.UNSIGNED_INT]:{[R.RGBA_INTEGER]:r.RGBA32UI,[R.RGB_INTEGER]:r.RGB32UI,[R.RG_INTEGER]:r.RG32UI,[R.RED_INTEGER]:r.R32UI,[R.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[j.INT]:{[R.RGBA_INTEGER]:r.RGBA32I,[R.RGB_INTEGER]:r.RGB32I,[R.RG_INTEGER]:r.RG32I,[R.RED_INTEGER]:r.R32I},[j.FLOAT]:{[R.RGBA]:r.RGBA32F,[R.RGB]:r.RGB32F,[R.RG]:r.RG32F,[R.RED]:r.R32F,[R.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[j.HALF_FLOAT]:{[R.RGBA]:r.RGBA16F,[R.RGB]:r.RGB16F,[R.RG]:r.RG16F,[R.RED]:r.R16F},[j.UNSIGNED_SHORT_5_6_5]:{[R.RGB]:r.RGB565},[j.UNSIGNED_SHORT_4_4_4_4]:{[R.RGBA]:r.RGBA4},[j.UNSIGNED_SHORT_5_5_5_1]:{[R.RGBA]:r.RGB5_A1},[j.UNSIGNED_INT_2_10_10_10_REV]:{[R.RGBA]:r.RGB10_A2,[R.RGBA_INTEGER]:r.RGB10_A2UI},[j.UNSIGNED_INT_10F_11F_11F_REV]:{[R.RGB]:r.R11F_G11F_B10F},[j.UNSIGNED_INT_5_9_9_9_REV]:{[R.RGB]:r.RGB9_E5},[j.UNSIGNED_INT_24_8]:{[R.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[j.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[R.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[j.UNSIGNED_BYTE]:{[R.RGBA]:r.RGBA,[R.RGB]:r.RGB,[R.ALPHA]:r.ALPHA,[R.LUMINANCE]:r.LUMINANCE,[R.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[j.UNSIGNED_SHORT_5_6_5]:{[R.RGB]:r.RGB},[j.UNSIGNED_SHORT_4_4_4_4]:{[R.RGBA]:r.RGBA},[j.UNSIGNED_SHORT_5_5_5_1]:{[R.RGBA]:r.RGBA}},t}class au{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Q,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=Jb(t),this.samplerTypes=Zb(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==H.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new pa(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]??H.FLOAT,this.webGLVersion===2&&t.type===j.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!==H.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&&xr(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===$e.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ri.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!==$e.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===ii.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ii.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===ii.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===ii.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}au.extension={type:k.RendererSystem,name:"texture"},V.add(au);class hu{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(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))(li||{});class lu{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 nm=class Se{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 lu(null,null,1/0),this.deltaMS=1/Se.targetFPMS,this.elapsedMS=1/Se.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=li.NORMAL){return this._addListener(new lu(t,e,i))}addOnce(t,e,i=li.NORMAL){return this._addListener(new lu(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._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Mt.shared:new Mt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}uu.extension=k.Application,V.add(uu);const om=[];V.handleByList(k.Renderer,om);function cu(r){for(const t of om)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Qb=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void) { gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; }`,tw=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); } `;const am=Qb,du=tw;class fu{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>=Et.HIGH?this.multisample=Et.HIGH:e>=Et.MEDIUM?this.multisample=Et.MEDIUM:e>=Et.LOW?this.multisample=Et.LOW:this.multisample=Et.NONE}destroy(){}}fu.extension={type:k.RendererSystem,name:"_multisample"},V.add(fu);class ew{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class pu{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;ie.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 hm extends gu{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=pr.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;h0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=pr.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{if(this.url===null){t(this);return}try{const i=await $.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===ie.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 Cr._EMPTY=Cr._EMPTY??$.ADAPTER.createCanvas(0,0),Cr._EMPTY}}const _u=class Dh extends Ii{constructor(t,e){e=e||{},super($.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)},Dh.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;Ii.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_${Yi()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Dh.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"&&Dh.SVG_XML.test(t)}};_u.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let _a=_u;const yu=class Bd extends Ii{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];Ii.crossOrigin(i,s,e.crossorigin);for(let n=0;n{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&&(Mt.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||(Mt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Mt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Bd.TYPES.includes(e)}};yu.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],yu.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let vu=yu;ta.push(Cr,Xl,lm,vu,_a,cn,cm,hm);class iw{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new pe("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}const rw="7.3.2";class Sn{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?J.EMPTY:(t=t||new J(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:s,c:n,d:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,u=s*e.x+o*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=os?o:s,n=a>n?a:n,o=t[2],a=t[3],e=os?o:s,n=a>n?a:n,o=t[4],a=t[5],e=os?o:s,n=a>n?a:n,o=t[6],a=t[7],e=os?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){const o=t.a,a=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,m=this.maxX,p=this.maxY,g=o*e+h*i+u,_=a*e+l*i+c;d=gm?g:m,p=_>p?_:p,g=o*s+h*i+u,_=a*s+l*i+c,d=gm?g:m,p=_>p?_:p,g=o*e+h*n+u,_=a*e+l*n+c,d=gm?g:m,p=_>p?_:p,g=o*s+h*n+u,_=a*s+l*n+c,d=gm?g:m,p=_>p?_: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;ho?l:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,m=this.minY,p=this.maxX,g=this.maxY;for(let _=i;_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.maxXl?n:l,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxXl?n:l,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minXi?this.maxX:i,this.minY=this.minYs?this.maxY:s}}class _t extends es{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ps,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 Sn,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;i1)for(let e=0;ethis.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);xr(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;e0&&n<=s){o=this.children.splice(i,n);for(let a=0;a1&&this.children.sort(nw),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==Fd.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=sw.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=s&&Cn.x=n&&Cn.y=e&&(o=r-a-1),h=h.replace("%value%",t[o].toString()),s+=h,s+=` `}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const dw=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; uniform float strength; varying vec2 vBlurTexCoords[%size%]; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vec2 textureCoord = filterTextureCoord(); %blur% }`;function fw(r,t){const e=Math.ceil(r/2);let i=dw,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o 0.0) { c.rgb /= c.a; } vec4 result; result.r = (m[0] * c.r); result.r += (m[1] * c.g); result.r += (m[2] * c.b); result.r += (m[3] * c.a); result.r += m[4]; result.g = (m[5] * c.r); result.g += (m[6] * c.g); result.g += (m[7] * c.b); result.g += (m[8] * c.a); result.g += m[9]; result.b = (m[10] * c.r); result.b += (m[11] * c.g); result.b += (m[12] * c.b); result.b += (m[13] * c.a); result.b += m[14]; result.a = (m[15] * c.r); result.a += (m[16] * c.g); result.a += (m[17] * c.b); result.a += (m[18] * c.a); result.a += m[19]; vec3 rgb = mix(c.rgb, result.rgb, uAlpha); // Premultiply alpha again. rgb *= result.a; gl_FragColor = vec4(rgb, result.a); } `;class Pn extends Gt{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(du,pw,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]=nt.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,u=o*(1-i)+a*s,c=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),_=[h,l,u,0,0,c,d,f,0,0,m,p,g,0,0,0,0,0,1,0];this._loadMatrix(_,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=nt.shared,[a,h,l]=o.setValue(i).toArray(),[u,c,d]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,h,l,t,0,u,c,d,e,0,a-u,h-c,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}}Pn.prototype.grayscale=Pn.prototype.greyscale;var mw=`varying vec2 vFilterCoord; varying vec2 vTextureCoord; uniform vec2 scale; uniform mat2 rotation; uniform sampler2D uSampler; uniform sampler2D mapSampler; uniform highp vec4 inputSize; uniform vec4 inputClamp; void main(void) { vec4 map = texture2D(mapSampler, vFilterCoord); map -= 0.5; map.xy = scale * inputSize.zw * (rotation * map.xy); gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); } `,gw=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; uniform mat3 filterMatrix; varying vec2 vTextureCoord; varying vec2 vFilterCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; } `;class gm extends Gt{constructor(t,e){const i=new rt;t.renderable=!1,super(gw,mw,{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 B(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 _w=`varying vec2 v_rgbNW; varying vec2 v_rgbNE; varying vec2 v_rgbSW; varying vec2 v_rgbSE; varying vec2 v_rgbM; varying vec2 vFragCoord; uniform sampler2D uSampler; uniform highp vec4 inputSize; /** Basic FXAA implementation based on the code on geeks3d.com with the modification that the texture2DLod stuff was removed since it's unsupported by WebGL. -- From: https://github.com/mitsuhiko/webgl-meincraft Copyright (c) 2011 by Armin Ronacher. Some rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FXAA_REDUCE_MIN #define FXAA_REDUCE_MIN (1.0/ 128.0) #endif #ifndef FXAA_REDUCE_MUL #define FXAA_REDUCE_MUL (1.0 / 8.0) #endif #ifndef FXAA_SPAN_MAX #define FXAA_SPAN_MAX 8.0 #endif //optimized version for mobile, where dependent //texture reads can be a bottleneck vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, vec2 v_rgbNW, vec2 v_rgbNE, vec2 v_rgbSW, vec2 v_rgbSE, vec2 v_rgbM) { vec4 color; vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; vec4 texColor = texture2D(tex, v_rgbM); vec3 rgbM = texColor.xyz; vec3 luma = vec3(0.299, 0.587, 0.114); float lumaNW = dot(rgbNW, luma); float lumaNE = dot(rgbNE, luma); float lumaSW = dot(rgbSW, luma); float lumaSE = dot(rgbSE, luma); float lumaM = dot(rgbM, luma); float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); mediump vec2 dir; dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * inverseVP; vec3 rgbA = 0.5 * ( texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); float lumaB = dot(rgbB, luma); if ((lumaB < lumaMin) || (lumaB > lumaMax)) color = vec4(rgbA, texColor.a); else color = vec4(rgbB, texColor.a); return color; } void main() { vec4 color; color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); gl_FragColor = color; } `,yw=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; varying vec2 v_rgbNW; varying vec2 v_rgbNE; varying vec2 v_rgbSW; varying vec2 v_rgbSE; varying vec2 v_rgbM; varying vec2 vFragCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } void texcoords(vec2 fragCoord, vec2 inverseVP, out vec2 v_rgbNW, out vec2 v_rgbNE, out vec2 v_rgbSW, out vec2 v_rgbSE, out vec2 v_rgbM) { v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; v_rgbM = vec2(fragCoord * inverseVP); } void main(void) { gl_Position = filterVertexPosition(); vFragCoord = aVertexPosition * outputFrame.zw; texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); } `;class _m extends Gt{constructor(){super(yw,_w)}}var vw=`precision highp float; varying vec2 vTextureCoord; varying vec4 vColor; uniform float uNoise; uniform float uSeed; uniform sampler2D uSampler; float rand(vec2 co) { return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); } void main() { vec4 color = texture2D(uSampler, vTextureCoord); float randomValue = rand(gl_FragCoord.xy * uSeed); float diff = (randomValue - 0.5) * uNoise; // Un-premultiply alpha before applying the color matrix. See issue #3539. if (color.a > 0.0) { color.rgb /= color.a; } color.r += diff; color.g += diff; color.b += diff; // Premultiply alpha again. color.rgb *= color.a; gl_FragColor = color; } `;let bu=class extends Gt{constructor(t=.5,e=Math.random()){super(du,vw,{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 wu={AlphaFilter:mm,BlurFilter:xu,BlurFilterPass:ya,ColorMatrixFilter:Pn,DisplacementFilter:gm,FXAAFilter:_m,NoiseFilter:bu};Object.entries(wu).forEach(([r,t])=>{Object.defineProperty(wu,r,{get(){return K("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||(Mt.system.add(this.tickerUpdate,this,li.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Mt.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._deltaTimei.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=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=0;c--){const d=u[c],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")&&(Qi.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Tu),!t.hitArea.contains(Tu.x,Tu.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 Ie)){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 Ie)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const 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(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof Ie)){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 Ie)){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 Ie)){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 Ie)){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 Pr)){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(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,Od._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;i0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n"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=Tw),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=Aw[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}};Au.extension={name:"events",type:[k.RendererSystem,k.CanvasRendererSystem]},Au.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let va=Au;V.add(va);function vm(r){return r==="dynamic"||r==="static"}const xm={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??vm(va.defaultEventMode)},set interactive(r){K("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??va.defaultEventMode},set eventMode(r){this._internalInteractive=vm(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 gs))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}};_t.mixin(xm);const bm={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};_t.mixin(bm);const Ew=9,xa=100,Sw=0,Cw=0,wm=2,Tm=1,Pw=-1e3,Iw=-1e3,Rw=2;class Eu{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,(We.tablet||We.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${xa}px`,e.style.height=`${xa}px`,e.style.position="absolute",e.style.top=`${Sw}px`,e.style.left=`${Cw}px`,e.style.zIndex=wm.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=`${Tm}px`,t.style.height=`${Tm}px`,t.style.position="absolute",t.style.top=`${Pw}px`,t.style.left=`${Iw}px`,t.style.zIndex=Rw.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 title : ${t.title}
tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height: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=`${xa}px`,e.style.height=`${xa}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=wm.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 gs(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===Ew&&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}}Eu.extension={name:"accessibility",type:[k.RendererPlugin,k.CanvasRendererPlugin]},V.add(Eu);const Am=class Ld{constructor(t){this.stage=new se,t=Object.assign({forceCanvas:!1},t),this.renderer=cu(t),Ld._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=Ld._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}};Am._plugins=[];let Su=Am;V.handleByList(k.Application,Su._plugins);class Cu{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}}Cu.extension=k.Application,V.add(Cu);const Em={loader:k.LoadParser,resolver:k.ResolveParser,cache:k.CacheParser,detection:k.DetectionParser};V.handle(k.Asset,r=>{const t=r.ref;Object.entries(Em).filter(([e])=>!!t[e]).forEach(([e,i])=>V.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Em).filter(e=>!!t[e]).forEach(e=>V.remove(t[e]))});class Mw{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(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),ba=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Sm(r,t,e,i,s){const n=t[e];for(let o=0;o{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Sm(r,s,0,e,i)}else i.push(r);return i}const Rn=r=>!Array.isArray(r);class Dw{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=Re(t);let s;for(let a=0;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 U){const a=e;i.forEach(h=>{a.baseTexture!==U.EMPTY.baseTexture&&Q.addToCache(a.baseTexture,h),U.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 tr=new Dw;class Bw{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({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const u=It.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),s[l.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[l.src],new Error(`[Loader.load] Failed to load ${u}. ${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=Re(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=It.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 me=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(me||{});const Fw=".json",Ow="application/json",Pm={extension:{type:k.LoadParser,priority:me.Low},name:"loadJson",test(r){return Ir(r,Ow)||Ri(r,Fw)},async load(r){return await(await $.ADAPTER.fetch(r)).json()}};V.add(Pm);const Lw=".txt",kw="text/plain",Im={name:"loadTxt",extension:{type:k.LoadParser,priority:me.Low},test(r){return Ir(r,kw)||Ri(r,Lw)},async load(r){return await(await $.ADAPTER.fetch(r)).text()}};V.add(Im);const Nw=["normal","bold","100","200","300","400","500","600","700","800","900"],Uw=[".ttf",".otf",".woff",".woff2"],Gw=["font/ttf","font/otf","font/woff","font/woff2"],Hw=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Rm(r){const t=It.extname(r),e=It.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(Hw)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const $w=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function zw(r){return $w.test(r)?r:encodeURI(r)}const Mm={extension:{type:k.LoadParser,priority:me.Low},name:"loadWebFont",test(r){return Ir(r,Gw)||Ri(r,Uw)},async load(r,t){var i,s,n;const e=$.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Rm(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(u=>Nw.includes(u)))??["normal"],l=t.data??{};for(let u=0;u$.ADAPTER.getFontFaceSet().delete(t))}};V.add(Mm);let Dm=0,Pu;const Vw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",Ww={id:"checkImageBitmap",code:` async function checkImageBitmap() { try { if (typeof createImageBitmap !== 'function') return false; const response = await fetch('${Vw}'); const imageBlob = await response.blob(); const imageBitmap = await createImageBitmap(imageBlob); return imageBitmap.width === 1 && imageBitmap.height === 1; } catch (e) { return false; } } checkImageBitmap().then((result) => { self.postMessage(result); }); `},Xw={id:"loadImageBitmap",code:` async function loadImageBitmap(url) { const response = await fetch(url); if (!response.ok) { throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \` + \`\${response.status} \${response.statusText}\`); } const imageBlob = await response.blob(); const imageBitmap = await createImageBitmap(imageBlob); return imageBitmap; } self.onmessage = async (event) => { try { const imageBitmap = await loadImageBitmap(event.data.data[0]); self.postMessage({ data: imageBitmap, uuid: event.data.uuid, id: event.data.id, }, [imageBitmap]); } catch(e) { self.postMessage({ error: e, uuid: event.data.uuid, id: event.data.id, }); } };`};let Iu;class jw{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([Ww.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(){Pu===void 0&&(Pu=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{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[Dm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Dm++,id:i})}}const Bm=new jw;function _s(r,t,e){r.resource.internal=!0;const i=new U(r),s=()=>{delete t.promiseCache[e],tr.has(e)&&tr.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 Yw=[".jpeg",".jpg",".png",".webp",".avif"],qw=["image/jpeg","image/png","image/webp","image/avif"];async function Fm(r){const t=await $.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 Mn={name:"loadTextures",extension:{type:k.LoadParser,priority:me.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Ir(r,qw)||Ri(r,Yw)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await Bm.isImageBitmapSupported()?s=await Bm.loadImageBitmap(r):s=await Fm(r):s=await new Promise((h,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?h(u):(u.onload=()=>h(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=ai(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new Q(s,n);return o.resource.src=r,_s(o,e,r)},unload(r){r.destroy(!0)}};V.add(Mn);const Kw=".svg",Zw="image/svg+xml",Om={extension:{type:k.LoadParser,priority:me.High},name:"loadSVG",test(r){return Ir(r,Zw)||Ri(r,Kw)},async testParse(r){return _a.test(r)},async parse(r,t,e){var n;const i=new _a(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new Q(i,{resolution:ai(r),...t==null?void 0:t.data});return s.resource.src=t.src,_s(s,e,t.src)},async load(r,t){return(await $.ADAPTER.fetch(r)).text()},unload:Mn.unload};V.add(Om);const Jw=[".mp4",".m4v",".webm",".ogv"],Qw=["video/mp4","video/webm","video/ogg"],Lm={name:"loadVideo",extension:{type:k.LoadParser,priority:me.High},config:{defaultAutoPlay:!0},test(r){return Ir(r,Qw)||Ri(r,Jw)},async load(r,t,e){var o;let i;const s=await(await $.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 vu(n,a);await h.load();const l=new Q(h,{alphaMode:await Zf(),resolution:ai(r),...t==null?void 0:t.data});l.resource.src=r,i=_s(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};V.add(Lm);class tT{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 Re(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"?(K("7.2.0",`Assets.add now uses an object instead of individual parameters. 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`)},Re(o).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:f}=h;const m=Re(l||u).map(_=>typeof _=="string"?Cm(_):Array.isArray(_)?_:[_]),p=this.getAlias(h);Array.isArray(p)?p.forEach(a):a(p);const g=[];m.forEach(_=>{_.forEach(v=>{let y={};if(typeof v!="object"){y.src=v;for(let x=0;x{this._assetMap[_]=g})})}resolveBundle(t){const e=Rn(t);t=Re(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=Rn(t);t=Re(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const u=n.filter(c=>c[h]?c[h]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.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=It.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??It.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class km{constructor(){this._detections=[],this._initialized=!1,this.resolver=new tT,this.loader=new Bw,this.cache=tr,this._backgroundLoader=new Mw(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=Rn(t),s=Re(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},u=o.map(c=>{const d=s[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return tr.get(t);const e={};for(let i=0;i{const l=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[h]]=l,tr.set(u,l)}),o}async unload(t){this._initialized||await this.init();const e=Re(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=Re(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=>{tr.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 Mn.config.preferWorkers}set preferWorkers(t){K("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 Rr=new km;V.handleByList(k.LoadParser,Rr.loader.parsers).handleByList(k.ResolveParser,Rr.resolver.parsers).handleByList(k.CacheParser,Rr.cache.parsers).handleByList(k.DetectionParser,Rr.detections);const Nm={extension:k.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof U),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};V.add(Nm);async function Um(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 Gm={extension:{type:k.DetectionParser,priority:1},test:async()=>Um("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};V.add(Gm);const Hm={extension:{type:k.DetectionParser,priority:0},test:async()=>Um("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};V.add(Hm);const $m=["png","jpg","jpeg"],zm={extension:{type:k.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...$m],remove:async r=>r.filter(t=>!$m.includes(t))};V.add(zm);const eT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ru(r){return eT?!1:document.createElement("video").canPlayType(r)!==""}const Vm={extension:{type:k.DetectionParser,priority:0},test:async()=>Ru("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};V.add(Vm);const Wm={extension:{type:k.DetectionParser,priority:0},test:async()=>Ru("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};V.add(Wm);const Xm={extension:{type:k.DetectionParser,priority:0},test:async()=>Ru("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};V.add(Xm);const jm={extension:k.ResolveParser,test:Mn.test,parse:r=>{var t;return{resolution:parseFloat(((t=$.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:It.extname(r).slice(1),src:r}}};V.add(jm);var ne=(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))(ne||{});const Dn={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 Mi,ys;function Ym(){ys={s3tc:Mi.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Mi.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Mi.getExtension("WEBGL_compressed_texture_etc"),etc1:Mi.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Mi.getExtension("WEBGL_compressed_texture_pvrtc")||Mi.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Mi.getExtension("WEBGL_compressed_texture_atc"),astc:Mi.getExtension("WEBGL_compressed_texture_astc")}}const qm={extension:{type:k.DetectionParser,priority:2},test:async()=>{const r=$.ADAPTER.createCanvas().getContext("webgl");return r?(Mi=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{ys||Ym();const t=[];for(const e in ys)ys[e]&&t.push(e);return[...t,...r]},remove:async r=>(ys||Ym(),r.filter(t=>!(t in ys)))};V.add(qm);class Km extends cn{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 Qo(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 Qo(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class er extends Km{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=er._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||er._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=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),f=c+n-1&~(n-1),m=d*f*Dn[e];for(let p=0;p1?u:d,levelHeight:i>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),f=c+n-1&~(n-1),m=d*f*Dn[e];return h}}const Mu=4,wa=124,iT=32,Zm=20,rT=542327876,Ta={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},sT={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},Aa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},nT=1,oT=2,aT=4,hT=64,lT=512,uT=131072,cT=827611204,dT=861165636,fT=894720068,pT=808540228,mT=4,gT={[cT]:ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,[dT]:ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,[fT]:ne.COMPRESSED_RGBA_S3TC_DXT5_EXT},_T={70:ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ne.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ne.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ne.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ne.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ne.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Jm(r){const t=new Uint32Array(r);if(t[0]!==rT)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,wa/Uint32Array.BYTES_PER_ELEMENT),i=e[Ta.HEIGHT],s=e[Ta.WIDTH],n=e[Ta.MIPMAP_COUNT],o=new Uint32Array(r,Ta.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,iT/Uint32Array.BYTES_PER_ELEMENT),a=o[nT];if(a&aT){const h=o[sT.FOURCC];if(h!==pT){const v=gT[h],y=Mu+wa,x=new Uint8Array(r,y);return[new er(x,{format:v,width:s,height:i,levels:n})]}const l=Mu+wa,u=new Uint32Array(t.buffer,l,Zm/Uint32Array.BYTES_PER_ELEMENT),c=u[Aa.DXGI_FORMAT],d=u[Aa.RESOURCE_DIMENSION],f=u[Aa.MISC_FLAG],m=u[Aa.ARRAY_SIZE],p=_T[c];if(p===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===mT)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,_=Mu+wa+Zm;if(m===1)g.push(new Uint8Array(r,_));else{const v=Dn[p];let y=0,x=s,b=i;for(let A=0;A>>1,b=b>>>1}let S=_;for(let A=0;Anew er(v,{format:p,width:s,height:i,levels:n}))}throw a&hT?new Error("DDSParser does not support uncompressed texture data."):a&lT?new Error("DDSParser does not supported YUV uncompressed texture data."):a&uT?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&oT?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 Qm=[171,75,84,88,32,49,49,187,13,10,26,10],yT=67305985,Ze={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},Du=64,Bu={[j.UNSIGNED_BYTE]:1,[j.UNSIGNED_SHORT]:2,[j.INT]:4,[j.UNSIGNED_INT]:4,[j.FLOAT]:4,[j.HALF_FLOAT]:8},tg={[R.RGBA]:4,[R.RGB]:3,[R.RG]:2,[R.RED]:1,[R.LUMINANCE]:1,[R.LUMINANCE_ALPHA]:2,[R.ALPHA]:1},eg={[j.UNSIGNED_SHORT_4_4_4_4]:2,[j.UNSIGNED_SHORT_5_5_5_1]:2,[j.UNSIGNED_SHORT_5_6_5]:2};function ig(r,t,e=!1){const i=new DataView(t);if(!vT(r,i))return null;const s=i.getUint32(Ze.ENDIANNESS,!0)===yT,n=i.getUint32(Ze.GL_TYPE,s),o=i.getUint32(Ze.GL_FORMAT,s),a=i.getUint32(Ze.GL_INTERNAL_FORMAT,s),h=i.getUint32(Ze.PIXEL_WIDTH,s),l=i.getUint32(Ze.PIXEL_HEIGHT,s)||1,u=i.getUint32(Ze.PIXEL_DEPTH,s)||1,c=i.getUint32(Ze.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(Ze.NUMBER_OF_FACES,s),f=i.getUint32(Ze.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(Ze.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const p=4,g=4,_=h+3&-4,v=l+3&-4,y=new Array(c);let x=h*l;n===0&&(x=_*v);let b;if(n!==0?Bu[n]?b=Bu[n]*tg[o]:b=eg[n]:b=Dn[a],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=e?bT(i,m,s):null;let A=x*b,T=h,w=l,P=_,N=v,I=Du+m;for(let E=0;E1||n!==0?T:P,levelHeight:f>1||n!==0?w:N,levelBuffer:new Uint8Array(t,L,A)},L+=A}I+=C+4,I=I%4!==0?I+4-I%4:I,T=T>>1||1,w=w>>1||1,P=T+p-1&~(p-1),N=w+g-1&~(g-1),A=P*N*b}return n!==0?{uncompressed:y.map(E=>{let C=E[0].levelBuffer,L=!1;return n===j.FLOAT?C=new Float32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4):n===j.UNSIGNED_INT?(L=!0,C=new Uint32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)):n===j.INT&&(L=!0,C=new Int32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)),{resource:new cn(C,{width:E[0].levelWidth,height:E[0].levelHeight}),type:n,format:L?xT(o):o}}),kvData:S}:{compressed:y.map(E=>new er(null,{format:a,width:h,height:l,levels:f,levelBuffers:E})),kvData:S}}function vT(r,t){for(let e=0;et-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h{const o=new Q(n,{mipmap:$e.OFF,alphaMode:ie.NO_PREMULTIPLIED_ALPHA,resolution:ai(r),...t.data});return _s(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};V.add(rg);const sg={extension:{type:k.LoadParser,priority:me.High},name:"loadKTX",test(r){return Ri(r,".ktx")},async load(r,t,e){const i=await(await $.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=ig(r,i),a=s??n,h={mipmap:$e.OFF,alphaMode:ie.NO_PREMULTIPLIED_ALPHA,resolution:ai(r),...t.data},l=a.map(u=>{a===n&&Object.assign(h,{type:u.type,format:u.format});const c=u.resource??u,d=new Q(c,h);return d.ktxKeyValueData=o,_s(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};V.add(sg);const ng={extension:k.ResolveParser,test:r=>{const t=It.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=It.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=$.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=$.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};V.add(ng);const Ea=new J,wT=4,og=class Ro{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&&Ro._flipY(i,s,n),a&&Ro._unpremultiplyAlpha(i);const h=new fp(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&&Ro._flipY(i,s,n),a&&Ro._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 Zi?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Ea.width=e.width,Ea.height=e.height,e=Ea)));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===R.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=Ea,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(wT*u*c);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(s?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=h*4+(s?2:0)+2,d=c,f=l;{const m=s+o,p=n,g=e+m,_=e-m,v=i+p;if(t[u++]=g,t[u++]=v,t[--c]=v,t[--c]=_,n){const y=i-p;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let m=1;m0||t&&i<=0){const s=e/2;for(let n=s+s%2;n=6){hg(e,!1);const o=[];for(let l=0;l=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)}},ug={build(r){Bn.build(r)},triangulate(r,t){Bn.triangulate(r,t)}};var ge=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ge||{}),Di=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Di||{});const ir={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 ethis.maxSegments&&(e=this.maxSegments),e}},TT=ir;class Ou{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,u=s-e,c=i-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=h*h+l*l,m=u*u+c*c,p=h*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(m)/d,v=g*p/f,y=_*p/m,x=g*c+_*l,b=g*u+_*h,S=l*(_+v),A=h*(_+v),T=c*(g+y),w=u*(g+y),P=Math.atan2(A-b,S-x),N=Math.atan2(w-b,T-x);return{cx:x+t,cy:b+e,radius:n,startAngle:P,endAngle:N,anticlockwise:l*u>c*h}}static arc(t,e,i,s,n,o,a,h,l){const u=a-o,c=ir._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/fn)*40),d=u/(c*2),f=d*2,m=Math.cos(d),p=Math.sin(d),g=c-1,_=g%1/g;for(let v=0;v<=g;++v){const y=v+_*v,x=d+o+f*y,b=Math.cos(x),S=-Math.sin(x);l.push((m*b+p*S)*n+i,(m*-S+p*b)*n+s)}}}class cg{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 Sa{static curveLength(t,e,i,s,n,o,a,h){let l=0,u=0,c=0,d=0,f=0,m=0,p=0,g=0,_=0,v=0,y=0,x=t,b=e;for(let S=1;S<=10;++S)u=S/10,c=u*u,d=c*u,f=1-u,m=f*f,p=m*f,g=p*t+3*m*u*i+3*f*c*n+d*a,_=p*e+3*m*u*s+3*f*c*o+d*h,v=x-g,y=b-_,x=g,b=_,l+=Math.sqrt(v*v+y*y);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const u=ir._segmentsCount(Sa.curveLength(h,l,t,e,i,s,n,o));let c=0,d=0,f=0,m=0,p=0;a.push(h,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,m=_*_,p=m*_,a.push(f*h+3*d*_*t+3*c*m*i+p*n,f*l+3*d*_*e+3*c*m*s+p*o)}}function dg(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,u=r+e*n,c=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const m=h+d,p=l+f,g=u+d,_=c+f;return a.push(m,p,g,_),2}function Mr(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let u=Math.atan2(h,l),c=Math.atan2(s-r,n-t);a&&uc&&(c+=Math.PI*2);let d=u;const f=c-u,m=Math.abs(f),p=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(p)/Math.PI>>0)+1,_=f/g;if(d+=_,a){o.push(r,t,e,i);for(let v=1,y=d;v=0&&(n.join===ge.ROUND?d+=Mr(y,x,y-A*E,x-T*E,y-w*E,x-P*E,u,!1)+4:d+=2,u.push(y-w*C,x-P*C,y+w*E,x+P*E));continue}const pt=(-A+_)*(-T+x)-(-A+y)*(-T+v),Bt=(-w+b)*(-P+x)-(-w+y)*(-P+S),zt=(X*Bt-F*pt)/at,ee=(O*pt-lt*Bt)/at,Ee=(zt-y)*(zt-y)+(ee-x)*(ee-x),Xt=y+(zt-y)*E,vt=x+(ee-x)*E,Ft=y-(zt-y)*C,Ot=x-(ee-x)*C,xi=Math.min(X*X+lt*lt,F*F+O*O),bi=et?E:C,Co=xi+bi*bi*p,wM=Ee<=Co;let Ph=n.join;if(Ph===ge.MITER&&Ee/p>g&&(Ph=ge.BEVEL),wM)switch(Ph){case ge.MITER:{u.push(Xt,vt,Ft,Ot);break}case ge.BEVEL:{et?u.push(Xt,vt,y+A*C,x+T*C,Xt,vt,y+w*C,x+P*C):u.push(y-A*E,x-T*E,Ft,Ot,y-w*E,x-P*E,Ft,Ot),d+=2;break}case ge.ROUND:{et?(u.push(Xt,vt,y+A*C,x+T*C),d+=Mr(y,x,y+A*C,x+T*C,y+w*C,x+P*C,u,!0)+4,u.push(Xt,vt,y+w*C,x+P*C)):(u.push(y-A*E,x-T*E,Ft,Ot),d+=Mr(y,x,y-A*E,x-T*E,y-w*E,x-P*E,u,!1)+4,u.push(y-w*E,x-P*E,Ft,Ot));break}}else{switch(u.push(y-A*E,x-T*E,y+A*C,x+T*C),Ph){case ge.MITER:{et?u.push(Ft,Ot,Ft,Ot):u.push(Xt,vt,Xt,vt),d+=2;break}case ge.ROUND:{et?d+=Mr(y,x,y+A*C,x+T*C,y+w*C,x+P*C,u,!0)+2:d+=Mr(y,x,y-A*E,x-T*E,y-w*E,x-P*E,u,!1)+2;break}}u.push(y-w*E,x-P*E,y+w*C,x+P*C),d+=2}}_=i[(c-2)*2],v=i[(c-2)*2+1],y=i[(c-1)*2],x=i[(c-1)*2+1],A=-(v-x),T=_-y,N=Math.sqrt(A*A+T*T),A/=N,T/=N,A*=m,T*=m,u.push(y-A*E,x-T*E,y+A*C,x+T*C),h||(n.cap===Di.ROUND?d+=Mr(y-A*(E-C)*.5,x-T*(E-C)*.5,y-A*E,x-T*E,y+A*C,x+T*C,u,!1)+2:n.cap===Di.SQUARE&&(d+=dg(y,x,A,T,E,C,!1,u)));const L=t.indices,z=ir.epsilon*ir.epsilon;for(let G=f;G0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,s=null){const n=new vs(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 vs(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;t0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h65535;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;t65535*2)return!1;const t=this.batches;for(let e=0;e0&&(s=Fn.pop(),s||(s=new ea,s.texArray=new aa),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),p.touched=1,p._batchEnabled=t,p._batchLocation=n,p.wrapMode=ri.REPEAT,s.texArray.elements[s.texArray.count++]=p,n++)),s.size+=d.size,u+=d.size,a=p._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}Q._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;l0&&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 qi,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new qi,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),Ca.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Sa.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=Ou.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=a;this.arc(h,l,u,c,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=fn:o&&s<=n&&(s+=fn),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-h);c0;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 J(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new gn(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new pn(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new mn(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 qi(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===Ut.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;s0){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/(u-1);n[f]=a,n[f+1]=0,n[f+2]=a,n[f+3]=1}let c=0;for(let d=0;d0?this.textureScale*this._width/2:this._width/2;for(let l=0;l0?this.build():this.updateVertices()}}class vg extends ws{constructor(t,e,i){const s=new _g(t.width,t.height,e,i),n=new Ts(U.WHITE);super(s,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:i}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==i)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const Ia=10;class IT extends vg{constructor(t,e,i,s,n){var o,a,h,l;super(U.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e??((o=t.defaultBorders)==null?void 0:o.left)??Ia,this._rightWidth=s??((a=t.defaultBorders)==null?void 0:a.right)??Ia,this._topHeight=i??((h=t.defaultBorders)==null?void 0:h.top)??Ia,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Ia,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,s=this._height>i?1:this._height/i;return Math.min(e,s)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const i=1/this._origWidth,s=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=s*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class RT extends ws{constructor(t=U.EMPTY,e,i,s,n){const o=new Ln(e,i,s);o.getBuffer("aVertexPosition").static=!1;const a=new Ts(t);super(o,a,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class MT extends ws{constructor(t,e,i=0){const s=new yg(t.height,e,i),n=new Ts(t);i>0&&(t.baseTexture.wrapMode=ri.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 DT extends se{constructor(t=1500,e,i=16384,s=!1){super();const n=16384;i>n&&(i=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=i,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=q.NORMAL,this.autoResize=s,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new nt(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.lengthi&&!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=Tl(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=nt.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;fs&&(p=s),m>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[m];g.uploadDynamic(e,f,p);const _=t._bufferUpdateIDs[m]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,p)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,p*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o0);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}}$u.extension={name:"particle",type:k.RendererPlugin},V.add($u);var kn=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(kn||{});const Ra={willReadFrequently:!0},di=class W{static get experimentalLetterSpacingSupported(){let t=W._experimentalLetterSpacingSupported;if(t!==void 0){const e=$.ADAPTER.getCanvasRenderingContext2D().prototype;t=W._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=W._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=W.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",Ra);a.font=n;const h=(i?W.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let m=0;m0&&(s?n-=e:n+=(W.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=W._canvas){const s=i.getContext("2d",Ra);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=W.collapseSpaces(u),d=W.collapseNewlines(u);let f=!c;const m=e.wordWrapWidth+l,p=W.tokenize(t);for(let g=0;gm)if(o!==""&&(a+=W.addLine(o),o="",n=0),W.canBreakWords(_,e.breakWords)){const y=W.wordWrapSplit(_);for(let x=0;xm&&(a+=W.addLine(o),f=!1,o="",n=0),o+=b,n+=T}}else{o.length>0&&(a+=W.addLine(o),o="",n=0);const y=g===p.length-1;a+=W.addLine(_,!y),f=!1,o="",n=0}else v+n>m&&(f=!1,a+=W.addLine(o),o="",n=0),(o.length>0||!W.isBreakingSpace(_)||f)&&(o+=_,n+=v)}return a+=W.addLine(o,!1),a}static addLine(t,e=!0){return t=W.trimRight(t),t=e?`${t} `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=W._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(!W.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:W._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:W._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;sa;--d){for(let p=0;p{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]})(),di.experimentalLetterSpacing=!1,di._fonts={},di._newlines=[10,13],di._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Bi=di;const OT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],bg=class Mo{constructor(t){this.styleID=0,this.reset(),Vu(this,t,t)}clone(){const t={};return Vu(t,this,Mo.defaultStyle),new Mo(t)}reset(){Vu(this,Mo.defaultStyle,Mo.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=zu(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=zu(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){LT(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=zu(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)&&!OT.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};bg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:kn.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 Fi=bg;function zu(r){const t=nt.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 LT(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e0&&m>p&&(g=(p+m)/2);const _=p+d,v=i.lineHeight*(f+1);let y=_;f+10}}function NT(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s{this.queue&&this.prepareItems()},this.registerFindHook(zT),this.registerFindHook(VT),this.registerFindHook(NT),this.registerFindHook(UT),this.registerFindHook(GT),this.registerUploadHook(HT),this.registerUploadHook($T)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Mt.system.addOnce(this.tick,this,li.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=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Mt.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}};Ag.uploadsPerFrame=4;let Da=Ag;Object.defineProperties($,{UPLOADS_PER_FRAME:{get(){return Da.uploadsPerFrame},set(r){K("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Da.uploadsPerFrame=r}}});function Eg(r,t){return t instanceof Q?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function WT(r,t){if(!(t instanceof ci))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramei)&&this.onLoop(),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Mt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Mt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const Nn=new B;class Xu extends ui{constructor(t,e=100,i=100){super(t),this.tileTransform=new ps,this._width=e,this._height=i,this.uvMatrix=this.texture.uvMatrix||new da(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;!e||!e.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,i=this._width*(1-this._anchor._x),s=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,i,s)}getLocalBounds(t){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new J),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Nn);const e=this._width,i=this._height,s=-e*this.anchor._x;if(Nn.x>=s&&Nn.x=n&&Nn.y1?Ke.from(qT,YT,e):Ke.from(Sg,KT,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==ri.CLAMP:h.wrapMode===ri.CLAMP&&(h.wrapMode=ri.REPEAT));const f=d?this.simpleShader:this.shader,m=a.width,p=a.height,g=t._width,_=t._height;Fa.set(u.a*m/g,u.b*m/_,u.c*p/g,u.d*p/_,u.tx/g,u.ty/_),Fa.invert(),d?Fa.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Fa.toArray(!0),f.uniforms.uColor=nt.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=Tl(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}ju.extension={name:"tilingSprite",type:k.RendererPlugin},V.add(ju);const Cg=class Do{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof U?t:null,this.baseTexture=t instanceof Q?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=ai(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<=Do.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Do.BATCH_SIZE;for(;e-t{this._batchIndex*Do.BATCH_SIZE{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=It.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Pg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const Ig={extension:k.Asset,cache:{test:r=>r instanceof Yu,getCacheableAssets:(r,t)=>Pg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&JT.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=$.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:k.LoadParser,priority:me.Normal},async testParse(r,t){return It.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=It.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=ba(s,t.src);const n=(await e.load([s]))[s],o=new Yu(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const u=[];for(const d of a){if(typeof d!="string")continue;let f=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(f=ba(f,t.src),u.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);o.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};V.add(Ig);class Un{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Gn{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const u=a[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f;h[c]=m}i[o].push(h)}const s=new Un;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 Oa{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 Un,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")?Oa.test($.ADAPTER.parseXML(t)):!1}static parse(t){return Oa.parse($.ADAPTER.parseXML(t))}}const qu=[Gn,Oa,La];function Rg(r){for(let t=0;t=h-P*o){if(p===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--S,g=null,_=null,v=null,p=0,m=0,y=0;continue}if(y=Math.max(P+T.fontProperties.descent,y),N*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--S,p+=y*o,p=Math.ceil(p),m=0,y=0;continue}tA(g,_,T,m,p,o,c);const I=ka(T.text);f.char.push({id:I,page:x.length-1,x:m/o,y:p/o,width:N,height:P,xoffset:0,yoffset:0,xadvance:w-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),m+=(N+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let S=0,A=u.length;S 0.99) {\r alpha = 1.0;\r }\r \r // Gamma correction for coverage-like alpha\r float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r float gamma = mix(1.0, 1.0 / 2.2, luma);\r float coverage = pow(uColor.a * alpha, gamma); \r \r // NPM Textures, NPM outputs\r gl_FragColor = vec4(uColor.rgb, coverage);\r }\r `,rA=`// Mesh material default fragment\r attribute vec2 aVertexPosition;\r attribute vec2 aTextureCoord;\r \r uniform mat3 projectionMatrix;\r uniform mat3 translationMatrix;\r uniform mat3 uTextureMatrix;\r \r varying vec2 vTextureCoord;\r \r void main(void)\r {\r gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r \r vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r }\r `;const Dg=[],Bg=[],Fg=[],Og=class Xy extends se{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},Xy.styleDefaults,e);if(!Oi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new nt(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 qe(()=>{this.dirty=!0},this,0,0),this._roundPixels=$.ROUND_PIXELS,this.dirty=!0,this._resolution=$.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var N;const t=Oi.available[this._fontName],e=this.fontSize,i=e/t.size,s=new B,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,` `)||" ",l=Mg(h),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Dg:Bg;let d=null,f=0,m=0,p=0,g=-1,_=0,v=0,y=0,x=0;for(let I=0;I0&&s.x>u&&(++v,xr(n,1+g-v,1+I-g),I=g,g=-1,o.push(_),a.push(n.length>0?n[n.length-1].prevSpaces:0),m=Math.max(m,_),p++,s.x=0,s.y+=t.lineHeight,d=null,x=0)}const b=l[l.length-1];b!=="\r"&&b!==` `&&(/(?:\s)/.test(b)&&(f=_),o.push(f),m=Math.max(m,f),a.push(-1));const S=[];for(let I=0;I<=p;I++){let E=0;this._align==="right"?E=m-o[I]:this._align==="center"?E=(m-o[I])/2:this._align==="justify"&&(E=a[I]<0?0:(m-o[I])/a[I]),S.push(E)}const A=n.length,T={},w=[],P=this._activePagesMeshData;c.push(...P);for(let I=0;I6*C)||E.vertices.lengthe[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=U.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Og.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let sA=Og;const nA=[".xml",".fnt"],Lg={extension:{type:k.LoadParser,priority:me.Normal},name:"loadBitmapFont",test(r){return nA.includes(It.extname(r).toLowerCase())},async testParse(r){return Gn.test(r)||La.test(r)},async parse(r,t,e){const i=Gn.test(r)?Gn.parse(r):La.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;la[l]);return Oi.install(i,h,!0)},async load(r,t){return(await $.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};V.add(Lg);const Ku=class Ks extends Fi{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Ks(Object.keys(Ks.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 Ks.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Ks;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return $.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:It.basename(t,It.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} @font-face { font-family: "${e.family}"; src: url('${e.dataSrc}'); font-weight: ${e.weight}; font-style: ${e.style}; font-display: ${e.display}; }`,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=up(t)),typeof t=="number"?lp(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,Ks.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}=$.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}};Ku.availableFonts={},Ku.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 Na=Ku;const Hn=class Zs extends ui{constructor(t="",e={}){super(U.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=U.from(i,{scaleMode:$.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new J,s.trim=new J,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),u=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Zs.defaultMaxWidth,this.maxHeight=Zs.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Zs.defaultAutoResolution,this._resolution=Zs.defaultResolution??$.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(s)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};Hn.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Hn.defaultMaxWidth=2024,Hn.defaultMaxHeight=2024,Hn.defaultAutoResolution=!0;const oA=Object.freeze(Object.defineProperty({__proto__:null,ALPHA_MODES:ie,AbstractMultiResource:gu,AccessibilityManager:Eu,AlphaFilter:mm,AnimatedSprite:Ba,Application:Su,ArrayResource:hm,Assets:Rr,AssetsClass:km,Attribute:dn,BLEND_MODES:q,BUFFER_BITS:Bo,BUFFER_TYPE:Ve,BackgroundSystem:xn,BaseImageResource:Ii,BasePrepare:Da,BaseRenderTexture:Wl,BaseTexture:Q,BatchDrawCall:ea,BatchGeometry:Nl,BatchRenderer:Ki,BatchShaderGenerator:Op,BatchSystem:Vl,BatchTextureArray:aa,BitmapFont:Oi,BitmapFontData:Un,BitmapText:sA,BlobResource:Km,BlurFilter:xu,BlurFilterPass:ya,Bounds:Sn,BrowserAdapter:Gd,Buffer:Rt,BufferResource:cn,BufferSystem:pu,CLEAR_MODES:ze,COLOR_MASK_BITS:Ud,Cache:tr,CanvasResource:lm,Circle:pn,Color:nt,ColorMatrixFilter:Pn,CompressedTextureResource:er,Container:se,ContextSystem:bn,CountLimiter:Tg,CubeResource:cm,DEG_TO_RAD:Tp,DRAW_MODES:He,DisplacementFilter:gm,DisplayObject:_t,ENV:Vi,Ellipse:mn,EventBoundary:ym,EventSystem:va,ExtensionType:k,Extract:ag,FORMATS:R,FORMATS_TO_COMPONENTS:tg,FXAAFilter:_m,FederatedDisplayObject:xm,FederatedEvent:gs,FederatedMouseEvent:In,FederatedPointerEvent:Ie,FederatedWheelEvent:Pr,FillStyle:bs,Filter:Gt,FilterState:Up,FilterSystem:Kl,Framebuffer:ha,FramebufferSystem:Zl,GC_MODES:Fo,GLFramebuffer:Gp,GLProgram:Kp,GLTexture:pa,GRAPHICS_CURVES:TT,GenerateTextureSystem:su,Geometry:Pi,GeometrySystem:Ql,Graphics:ci,GraphicsData:vs,GraphicsGeometry:Nu,HTMLText:Hn,HTMLTextStyle:Na,IGLUniformData:Nb,INSTALLED:ta,INTERNAL_FORMATS:ne,INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:Dn,ImageBitmapResource:Cr,ImageResource:Xl,LINE_CAP:Di,LINE_JOIN:ge,LineStyle:On,LoaderParserPriority:me,MASK_TYPES:Pt,MIPMAP_MODES:$e,MSAA_QUALITY:Et,MaskData:zp,MaskSystem:tu,Matrix:rt,Mesh:ws,MeshBatchUvs:pg,MeshGeometry:Ln,MeshMaterial:Ts,MultisampleSystem:fu,NineSlicePlane:IT,NoiseFilter:bu,ObjectRenderer:yn,ObjectRendererSystem:mu,ObservablePoint:qe,PI_2:fn,PRECISION:de,ParticleContainer:DT,ParticleRenderer:$u,PlaneGeometry:_g,PluginSystem:iu,Point:B,Polygon:qi,Prepare:Wu,Program:hi,ProjectionSystem:ru,Quad:Np,QuadUv:Yl,RAD_TO_DEG:wp,RENDERER_TYPE:Fh,Rectangle:J,RenderTexture:Zi,RenderTexturePool:jl,RenderTextureSystem:nu,Renderer:ga,ResizePlugin:Cu,Resource:fs,RopeGeometry:yg,RoundedRectangle:gn,Runner:pe,SAMPLER_TYPES:H,SCALE_MODES:ii,SHAPES:Ut,SVGResource:_a,ScissorSystem:Yp,Shader:Ke,ShaderSystem:ou,SimpleMesh:RT,SimplePlane:vg,SimpleRope:MT,Sprite:ui,SpriteMaskFilter:$p,Spritesheet:Yu,StartupSystem:Tn,State:Ye,StateSystem:rm,StencilSystem:eu,SystemManager:sm,TARGETS:pr,TEXT_GRADIENT:kn,TYPES:j,TYPES_TO_BYTES_PER_COMPONENT:Bu,TYPES_TO_BYTES_PER_PIXEL:eg,TemporaryDisplayObject:dm,Text:Ma,TextFormat:Gn,TextMetrics:Bi,TextStyle:Fi,Texture:U,TextureGCSystem:Ji,TextureMatrix:da,TextureSystem:au,TextureUvs:la,Ticker:Mt,TickerPlugin:uu,TilingSprite:Xu,TilingSpriteRenderer:ju,TimeLimiter:jT,Transform:ps,TransformFeedback:iw,TransformFeedbackSystem:hu,UPDATE_PRIORITY:li,UniformGroup:Pe,VERSION:rw,VideoResource:vu,ViewSystem:En,ViewableBuffer:Qo,WRAP_MODES:ri,XMLFormat:Oa,XMLStringFormat:La,accessibleTarget:bm,autoDetectFormat:Rg,autoDetectRenderer:cu,autoDetectResource:Ll,cacheTextureArray:Nm,checkDataUrl:Ir,checkExtension:Ri,checkMaxIfStatementsInShader:xp,convertToList:Re,copySearchParams:ba,createStringVariations:Cm,createTexture:_s,createUBOElements:Qp,curves:ir,defaultFilterVertex:du,defaultVertex:am,detectAvif:Gm,detectCompressedTextures:qm,detectDefaults:zm,detectMp4:Wm,detectOgv:Xm,detectWebm:Vm,detectWebp:Hm,extensions:V,filters:wu,generateProgram:Zp,generateUniformBufferSync:em,getFontFamilyName:Rm,getTestContext:Pp,getUBOData:tm,graphicsUtils:ST,groupD8:gt,isMobile:We,isSingleItem:Rn,loadBitmapFont:Lg,loadDDS:rg,loadImageBitmap:Fm,loadJson:Pm,loadKTX:sg,loadSVG:Om,loadTextures:Mn,loadTxt:Im,loadVideo:Lm,loadWebFont:Mm,parseDDS:Jm,parseKTX:ig,resolveCompressedTextureUrl:ng,resolveTextureUrl:jm,settings:$,spritesheetAsset:Ig,uniformParsers:Er,unsafeEvalSupported:Fp,utils:hb},Symbol.toStringTag,{value:"Module"}));class kg{constructor(t){M(this,"tickCtx");M(this,"interceptor");M(this,"listeners");M(this,"running");this.tickCtx=t,this.interceptor={_beforeAllList:[],_afterAllList:[],_beforeList:[],_afterList:[],beforeAll:e=>{this.interceptor._beforeAllList.push(e)},afterAll:e=>{this.interceptor._afterAllList.push(e)},before:e=>{this.interceptor._beforeList.push(e)},after:e=>{this.interceptor._afterList.push(e)}},this.listeners=[],this.running=!1}add(t,e=null,i=0){this.listeners.push({tick:t,context:e,priority:i})}async run(t,e){this.running=!0;const i=Math.ceil(t/1e3*e);for(const s of this.interceptor._beforeAllList)await s.call(null,this.tickCtx).catch(n=>{throw this.running=!1,n});for(let s=0;s<=i;s++){const n=1e3/e,o=s*n;if(!this.running)throw new Error("stop");await this.tick(o).catch(a=>{throw this.running=!1,a})}for(const s of this.interceptor._afterAllList)await s.call(null,this.tickCtx).catch(n=>{throw this.running=!1,n});this.running=!1}stop(){this.running=!1}async tick(t){const e=this.tickCtx,i=this.listeners;for(const s of this.interceptor._beforeList)await s.call(null,t,e);for(const s of i)await s.tick.call(s.context,t,e);for(const s of this.interceptor._afterList)await s.call(null,t,e)}remove(t){this.listeners=this.listeners.filter(e=>e.tick!==t)}removeAll(){this.listeners=[]}reset(){this.interceptor._beforeAllList=[],this.interceptor._afterAllList=[],this.interceptor._beforeList=[],this.interceptor._afterList=[],this.listeners=[],this.tickCtx={}}}var aA=Object.defineProperty,Ng=Object.getOwnPropertySymbols,hA=Object.prototype.hasOwnProperty,lA=Object.prototype.propertyIsEnumerable,Li=Math.pow,Ug=(r,t,e)=>t in r?aA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uA=(r,t)=>{for(var e in t||(t={}))hA.call(t,e)&&Ug(r,e,t[e]);if(Ng)for(var e of Ng(t))lA.call(t,e)&&Ug(r,e,t[e]);return r},Zu=(r,t,e)=>{if(!t.has(r))throw TypeError("Cannot "+e)},D=(r,t,e)=>(Zu(r,t,"read from private field"),e?e.call(r):t.get(r)),ot=(r,t,e)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,e)},oe=(r,t,e,i)=>(Zu(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),yt=(r,t,e)=>(Zu(r,t,"access private method"),e),ht=new Uint8Array(8),ki=new DataView(ht.buffer),Me=r=>[(r%256+256)%256],ut=r=>(ki.setUint16(0,r,!1),[ht[0],ht[1]]),cA=r=>(ki.setInt16(0,r,!1),[ht[0],ht[1]]),Gg=r=>(ki.setUint32(0,r,!1),[ht[1],ht[2],ht[3]]),Z=r=>(ki.setUint32(0,r,!1),[ht[0],ht[1],ht[2],ht[3]]),dA=r=>(ki.setUint32(0,Math.floor(r/Li(2,32)),!1),ki.setUint32(4,r,!1),[ht[0],ht[1],ht[2],ht[3],ht[4],ht[5],ht[6],ht[7]]),Ju=r=>(ki.setInt16(0,Li(2,8)*r,!1),[ht[0],ht[1]]),fi=r=>(ki.setInt32(0,Li(2,16)*r,!1),[ht[0],ht[1],ht[2],ht[3]]),Qu=r=>(ki.setInt32(0,Li(2,30)*r,!1),[ht[0],ht[1],ht[2],ht[3]]),pi=(r,t=!1)=>{let e=Array(r.length).fill(null).map((i,s)=>r.charCodeAt(s));return t&&e.push(0),e},Dr=r=>r&&r[r.length-1],$n=(r,t,e=!0)=>{let i=r*t;return e?Math.round(i):i},Hg=r=>{let t=r*(Math.PI/180),e=Math.cos(t),i=Math.sin(t);return[e,i,0,-i,e,0,0,0,1]},fA=Hg(0),$g=r=>[fi(r[0]),fi(r[1]),Qu(r[2]),fi(r[3]),fi(r[4]),Qu(r[5]),fi(r[6]),fi(r[7]),Qu(r[8])],qt=(r,t,e)=>({type:r,contents:t&&new Uint8Array(t.flat(10)),children:e}),Kt=(r,t,e,i,s)=>qt(r,[Me(t),Gg(e),i??[]],s),pA=r=>r?qt("ftyp",[pi("isom"),Z(0),pi("iso4"),pi("hvc1")]):qt("ftyp",[pi("isom"),Z(0),pi("isom"),pi("avc1"),pi("mp41")]),mA=()=>({type:"mdat",largeSize:!0}),gA=(r,t)=>qt("moov",null,[_A(t,r),...r.map(e=>yA(e,t))]),_A=(r,t)=>{let e=$n(Math.max(0,...t.filter(s=>s.samples.length>0).map(s=>Dr(s.samples).timestamp+Dr(s.samples).duration)),nc),i=Math.max(...t.map(s=>s.id))+1;return Kt("mvhd",0,0,[Z(r),Z(r),Z(nc),Z(e),fi(1),Ju(1),Array(10).fill(0),$g(fA),Array(24).fill(0),Z(i)])},yA=(r,t)=>qt("trak",null,[vA(r,t),xA(r,t)]),vA=(r,t)=>{let e=Dr(r.samples),i=$n(e?e.timestamp+e.duration:0,nc);return Kt("tkhd",0,3,[Z(t),Z(t),Z(r.id),Z(0),Z(i),Array(8).fill(0),ut(0),ut(0),Ju(r.info.type==="audio"?1:0),ut(0),$g(Hg(r.info.type==="video"?r.info.rotation:0)),fi(r.info.type==="video"?r.info.width:0),fi(r.info.type==="video"?r.info.height:0)])},xA=(r,t)=>qt("mdia",null,[bA(r,t),wA(r.info.type==="video"?"vide":"soun"),TA(r)]),bA=(r,t)=>{let e=Dr(r.samples),i=$n(e?e.timestamp+e.duration:0,r.timescale);return Kt("mdhd",0,0,[Z(t),Z(t),Z(r.timescale),Z(i),ut(21956),ut(0)])},wA=r=>Kt("hdlr",0,0,[pi("mhlr"),pi(r),Z(0),Z(0),Z(0),pi("mp4-muxer-hdlr")]),TA=r=>qt("minf",null,[r.info.type==="video"?AA():EA(),SA(),IA(r)]),AA=()=>Kt("vmhd",0,1,[ut(0),ut(0),ut(0),ut(0)]),EA=()=>Kt("smhd",0,0,[ut(0),ut(0)]),SA=()=>qt("dinf",null,[CA()]),CA=()=>Kt("dref",0,0,[Z(1)],[PA()]),PA=()=>Kt("url ",0,1),IA=r=>qt("stbl",null,[RA(r),UA(r),GA(r),HA(r),$A(r),zA(r)]),RA=r=>Kt("stsd",0,0,[Z(1)],[r.info.type==="video"?MA(VA[r.info.codec],r):LA(XA[r.info.codec],r)]),MA=(r,t)=>qt(r,[Array(6).fill(0),ut(1),ut(0),ut(0),Array(12).fill(0),ut(t.info.width),ut(t.info.height),Z(4718592),Z(4718592),Z(0),ut(1),Array(32).fill(0),ut(24),cA(65535)],[WA[t.info.codec](t)]),DA=r=>r.codecPrivate&&qt("avcC",[...r.codecPrivate]),BA=r=>r.codecPrivate&&qt("hvcC",[...r.codecPrivate]),FA=r=>r.codecPrivate&&qt("vpcC",[...r.codecPrivate]),OA=r=>r.codecPrivate&&qt("av1C",[...r.codecPrivate]),LA=(r,t)=>qt(r,[Array(6).fill(0),ut(1),ut(0),ut(0),Z(0),ut(t.info.numberOfChannels),ut(16),ut(0),ut(0),fi(t.info.sampleRate)],[jA[t.info.codec](t)]),kA=r=>Kt("esds",0,0,[Z(58753152),Me(32+r.codecPrivate.byteLength),ut(1),Me(0),Z(75530368),Me(18+r.codecPrivate.byteLength),Me(64),Me(21),Gg(0),Z(130071),Z(130071),Z(92307584),Me(r.codecPrivate.byteLength),...r.codecPrivate,Z(109084800),Me(1),Me(2)]),NA=r=>qt("dOps",[Me(0),Me(r.info.numberOfChannels),ut(3840),Z(r.info.sampleRate),Ju(0),Me(0)]),UA=r=>Kt("stts",0,0,[Z(r.timeToSampleTable.length),r.timeToSampleTable.map(t=>[Z(t.sampleCount),Z(t.sampleDelta)])]),GA=r=>{if(r.samples.every(e=>e.type==="key"))return null;let t=[...r.samples.entries()].filter(([,e])=>e.type==="key");return Kt("stss",0,0,[Z(t.length),t.map(([e])=>Z(e+1))])},HA=r=>Kt("stsc",0,0,[Z(r.compactlyCodedChunkTable.length),r.compactlyCodedChunkTable.map(t=>[Z(t.firstChunk),Z(t.samplesPerChunk),Z(1)])]),$A=r=>Kt("stsz",0,0,[Z(0),Z(r.samples.length),r.samples.map(t=>Z(t.size))]),zA=r=>r.writtenChunks.length>0&&Dr(r.writtenChunks).offset>=Li(2,32)?Kt("co64",0,0,[Z(r.writtenChunks.length),r.writtenChunks.map(t=>dA(t.offset))]):Kt("stco",0,0,[Z(r.writtenChunks.length),r.writtenChunks.map(t=>Z(t.offset))]),VA={avc:"avc1",hevc:"hvc1",vp9:"vp09",av1:"av01"},WA={avc:DA,hevc:BA,vp9:FA,av1:OA},XA={aac:"mp4a",opus:"opus"},jA={aac:kA,opus:NA},zg=class{constructor(){this.buffer=null}},Vg=class{constructor(r,t,e){this.onData=r,this.onDone=t,this.options=e}},YA=class{constructor(r,t){this.stream=r,this.options=t}},Br,As,tc=class{constructor(){this.pos=0,ot(this,Br,new Uint8Array(8)),ot(this,As,new DataView(D(this,Br).buffer)),this.offsets=new WeakMap}seek(r){this.pos=r}writeU32(r){D(this,As).setUint32(0,r,!1),this.write(D(this,Br).subarray(0,4))}writeU64(r){D(this,As).setUint32(0,Math.floor(r/Li(2,32)),!1),D(this,As).setUint32(4,r,!1),this.write(D(this,Br).subarray(0,8))}writeAscii(r){for(let t=0;te.start-i.start);r.push({start:t[0].start,size:t[0].data.byteLength});for(let e=1;ea.start<=t&&tZA){for(let a=0;a=r.written[s+1].start;)r.written[s].end=Math.max(r.written[s].end,r.written[s+1].end),r.written.splice(s+1,1)},sc=new WeakSet,jg=function(r){let e={start:Math.floor(r/D(this,Je))*D(this,Je),data:new Uint8Array(D(this,Je)),written:[],shouldFlush:!1};return D(this,_e).push(e),D(this,_e).sort((i,s)=>i.start-s.start),D(this,_e).indexOf(e)},Xn=new WeakSet,$a=function(r=!1){for(let t=0;tr.stream.write({type:"write",data:e,position:i}),void 0,{chunkSize:(t=r.options)==null?void 0:t.chunkSize}))}},nc=1e3,QA=["avc","hevc","vp9","av1"],tE=["aac","opus"],eE=2082844800,iE=.5,rE=["strict","offset"],St,Zt,Lr,kr,Nr,oc,za,ac,qg,hc,Kg,lc,Zg,uc,Jg,Va,cc,dc,Qg,jn,Wa,Yn,Xa,ja,fc,sE=class{constructor(r){ot(this,ac),ot(this,hc),ot(this,lc),ot(this,uc),ot(this,Va),ot(this,dc),ot(this,jn),ot(this,Yn),ot(this,ja),ot(this,St,void 0),ot(this,Zt,void 0),ot(this,Lr,void 0),ot(this,kr,null),ot(this,Nr,null),ot(this,oc,Math.floor(Date.now()/1e3)+eE),ot(this,za,!1);var t;if(yt(this,ac,qg).call(this,r),this.target=r.target,oe(this,St,uA({firstTimestampBehavior:"strict"},r)),r.target instanceof zg)oe(this,Zt,new qA(r.target));else if(r.target instanceof Vg)oe(this,Zt,(t=r.target.options)!=null&&t.chunked?new Yg(r.target):new Wg(r.target));else if(r.target instanceof YA)oe(this,Zt,new JA(r.target));else throw new Error(`Invalid target: ${r.target}`);yt(this,hc,Kg).call(this),yt(this,lc,Zg).call(this)}addVideoChunk(r,t,e){let i=new Uint8Array(r.byteLength);r.copyTo(i),this.addVideoChunkRaw(i,r.type,e??r.timestamp,r.duration,t)}addVideoChunkRaw(r,t,e,i,s){if(yt(this,ja,fc).call(this),!D(this,St).video)throw new Error("No video track declared.");yt(this,Va,cc).call(this,D(this,kr),r,t,e,i,s)}addAudioChunk(r,t,e){let i=new Uint8Array(r.byteLength);r.copyTo(i),this.addAudioChunkRaw(i,r.type,e??r.timestamp,r.duration,t)}addAudioChunkRaw(r,t,e,i,s){if(yt(this,ja,fc).call(this),!D(this,St).audio)throw new Error("No audio track declared.");yt(this,Va,cc).call(this,D(this,Nr),r,t,e,i,s)}finalize(){D(this,kr)&&yt(this,jn,Wa).call(this,D(this,kr)),D(this,Nr)&&yt(this,jn,Wa).call(this,D(this,Nr));let r=D(this,Zt).offsets.get(D(this,Lr)),t=D(this,Zt).pos-r;D(this,Lr).size=t,D(this,Zt).patchBox(D(this,Lr));let e=gA([D(this,kr),D(this,Nr)].filter(Boolean),D(this,oc));D(this,Zt).writeBox(e),yt(this,Yn,Xa).call(this),D(this,Zt).finalize(),oe(this,za,!0)}};St=new WeakMap,Zt=new WeakMap,Lr=new WeakMap,kr=new WeakMap,Nr=new WeakMap,oc=new WeakMap,za=new WeakMap,ac=new WeakSet,qg=function(r){if(r.video){if(!QA.includes(r.video.codec))throw new Error(`Unsupported video codec: ${r.video.codec}`);if(r.video.rotation!==void 0&&![0,90,180,270].includes(r.video.rotation))throw new Error(`Invalid video rotation: ${r.video.rotation}. Has to be 0, 90, 180 or 270.`)}if(r.audio&&!tE.includes(r.audio.codec))throw new Error(`Unsupported audio codec: ${r.audio.codec}`);if(r.firstTimestampBehavior&&!rE.includes(r.firstTimestampBehavior))throw new Error(`Invalid first timestamp behavior: ${r.firstTimestampBehavior}`)},hc=new WeakSet,Kg=function(){var r;let t=((r=D(this,St).video)==null?void 0:r.codec)==="hevc";D(this,Zt).writeBox(pA(t)),oe(this,Lr,mA()),D(this,Zt).writeBox(D(this,Lr)),yt(this,Yn,Xa).call(this)},lc=new WeakSet,Zg=function(){var r;if(D(this,St).video&&oe(this,kr,{id:1,info:{type:"video",codec:D(this,St).video.codec,width:D(this,St).video.width,height:D(this,St).video.height,rotation:(r=D(this,St).video.rotation)!=null?r:0},timescale:720,codecPrivate:new Uint8Array(0),samples:[],writtenChunks:[],currentChunk:null,firstTimestamp:void 0,lastTimestamp:-1,timeToSampleTable:[],lastTimescaleUnits:null,compactlyCodedChunkTable:[]}),D(this,St).audio){let t=yt(this,uc,Jg).call(this,2,D(this,St).audio.sampleRate,D(this,St).audio.numberOfChannels);oe(this,Nr,{id:D(this,St).video?2:1,info:{type:"audio",codec:D(this,St).audio.codec,numberOfChannels:D(this,St).audio.numberOfChannels,sampleRate:D(this,St).audio.sampleRate},timescale:D(this,St).audio.sampleRate,codecPrivate:t,samples:[],writtenChunks:[],currentChunk:null,firstTimestamp:void 0,lastTimestamp:-1,timeToSampleTable:[],lastTimescaleUnits:null,compactlyCodedChunkTable:[]})}},uc=new WeakSet,Jg=function(r,t,e){let s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350].indexOf(t),n=e,o="";o+=r.toString(2).padStart(5,"0"),o+=s.toString(2).padStart(4,"0"),s===15&&(o+=t.toString(2).padStart(24,"0")),o+=n.toString(2).padStart(4,"0");let a=Math.ceil(o.length/8)*8;o=o.padEnd(a,"0");let h=new Uint8Array(o.length/8);for(let l=0;l=iE)&&(r.currentChunk&&yt(this,jn,Wa).call(this,r),r.currentChunk={startTimestamp:a,sampleData:[],sampleCount:0}),r.currentChunk.sampleData.push(t),r.currentChunk.sampleCount++,(o=n==null?void 0:n.decoderConfig)!=null&&o.description&&(r.codecPrivate=new Uint8Array(n.decoderConfig.description)),r.samples.push({timestamp:a,duration:h,size:t.byteLength,type:e}),r.lastTimescaleUnits!==null){let l=$n(a,r.timescale,!1),u=Math.round(l-r.lastTimescaleUnits);r.lastTimescaleUnits+=u;let c=Dr(r.timeToSampleTable);c.sampleCount===1?(c.sampleDelta=u,c.sampleCount++):c.sampleDelta===u?c.sampleCount++:(c.sampleCount--,r.timeToSampleTable.push({sampleCount:2,sampleDelta:u}))}else r.lastTimescaleUnits=0,r.timeToSampleTable.push({sampleCount:1,sampleDelta:$n(h,r.timescale)})},dc=new WeakSet,Qg=function(r,t){if(D(this,St).firstTimestampBehavior==="strict"&&t.lastTimestamp===-1&&r!==0)throw new Error(`The first chunk for your media track must have a timestamp of 0 (received ${r}). Non-zero first timestamps are often caused by directly piping frames or audio data from a MediaStreamTrack into the encoder. Their timestamps are typically relative to the age of the document, which is probably what you want. If you want to offset all timestamps of a track such that the first one is zero, set firstTimestampBehavior: 'offset' in the options. `);if(D(this,St).firstTimestampBehavior==="offset"&&(r-=t.firstTimestamp),r{var n,o;if(!this.active)return;const{imageSource:i,audioBuffers:s}=e;if(i){const a=new VideoFrame(i,{timestamp:t*1e3});(n=this.videoEncoder)==null||n.encode(a,{keyFrame:t/(1e3/this.fps)%150===0}),a.close()}if(!this.onlyVideo){const a=await this.genAudioData(t,s);(o=this.audioEncoder)==null||o.encode(a),a.close()}this.onProgress&&this.onProgress(t/this.duration,t,this.duration),ei.debug("progress",t/this.duration)})}async genAudioData(t,e){const i=this.audioConfig.sampleRate,s=this.audioConfig.numberOfChannels,n=this.audioConfig.sampleRate*(1/this.fps),a=new OfflineAudioContext(s,n,i).createBuffer(s,n,i);let h;if(e){e.forEach((l,u)=>{for(let c=0;c{var i;return(i=this.muxer)==null?void 0:i.addVideoChunk(t,e)},error:t=>{ei.error("video encoder error",t),this.errorReject(t)}}),this.videoEncoder.configure(this.videoConfig),this.onlyVideo||(this.audioEncoder=new AudioEncoder({output:(t,e)=>{var i;return(i=this.muxer)==null?void 0:i.addAudioChunk(t,e)},error:t=>{ei.error("audio encoder error",t),this.errorReject(t)}}),this.audioEncoder.configure(this.audioConfig))}async endEncoding(){var e,i,s,n,o,a,h;await((e=this.videoEncoder)==null?void 0:e.flush()),(i=this.videoEncoder)==null||i.close(),await((s=this.audioEncoder)==null?void 0:s.flush()),(n=this.audioEncoder)==null||n.close(),(o=this.muxer)==null||o.finalize();const t=(h=(a=this.muxer)==null?void 0:a.target)==null?void 0:h.buffer;if(t){const l=new Blob([t],{type:"video/mp4"});return this.muxer&&(this.muxer=void 0),l}}add(t){this.ticker.add(t)}start(t){return t&&(this.duration=t),this.createMuxerAndEncoder(),new Promise((e,i)=>{const s=Date.now();this.errorReject=i,this.active=!0,this.ticker.run(this.duration,this.fps).then(async()=>{const n=await this.endEncoding().catch(o=>{ei.error("end encode error",o),i(o)});e(n)}).catch(n=>{ei.error("ticker run error",n),i(n)}).finally(()=>{this.errorReject=e_,this.active=!1,ei.debug("synthesize cost",Date.now()-s)})})}stop(){this.active=!1,this.ticker.stop()}}const aE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let hE=(r=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(r));for(;r--;)t+=aE[e[r]&63];return t};function Es(){return hE(8)}async function lE(r,t,e,i){const s=r.sampleRate,n=r.numberOfChannels,o=Math.floor(t/1e3*s),a=s*(1/e),h=new OfflineAudioContext(n,a,s);let l=h.createBuffer(n,a,s);const u=new Float32Array(a);for(let c=0;csetTimeout(t,r))}async function uE(r,t=44100){return new Promise((e,i)=>{const s=new AudioContext({sampleRate:t});s.decodeAudioData(r,e,i).finally(()=>{s.close()})})}async function cE(r){const t=await(await fetch(r)).arrayBuffer();return await uE(t)}class qn{static set(t,e){this.widthScale=t/this.baseWidth,this.heightScale=e/this.baseHeight}static width(t){return this.widthScale*t}static height(t){return this.heightScale*t}static x(t){return this.widthScale*t}static y(t){return this.heightScale*t}static fontSize(t){return this.widthScale*t}}M(qn,"baseWidth",pc),M(qn,"baseHeight",mc),M(qn,"widthScale",1),M(qn,"heightScale",1);async function dE(){return!(typeof OfflineAudioContext>"u"||typeof VideoEncoder>"u"||typeof VideoFrame>"u"||typeof AudioEncoder>"u"||typeof AudioData>"u"||!(await VideoEncoder.isConfigSupported(gc)).supported||!(await AudioEncoder.isConfigSupported(_c)).supported)}async function fE(){let r=!1,t=!1;return typeof VideoEncoder<"u"&&typeof VideoFrame<"u"&&(await VideoEncoder.isConfigSupported(gc)).supported&&(r=!0),typeof OfflineAudioContext<"u"&&typeof AudioEncoder<"u"&&typeof AudioData<"u"&&(await AudioEncoder.isConfigSupported(_c)).supported&&(t=!0),{video:r,audio:t}}function Ss(r){return[r.x,r.y,r.scale.x,r.scale.y,r.rotation,r.skew.x,r.skew.y,r.pivot.x,r.pivot.y]}function yc(r){if(!r)return;const t={BlackMaskFilter:no,BlurFilter:ro,NoiseFilter:so,OldFilmFilter:oo,VignetteFilter:ao};return r.map(e=>t[e.__type].fromJSON())}class pE{constructor(t){M(this,"container");M(this,"duration");M(this,"fps");M(this,"ticker");M(this,"active");M(this,"onProgress");this.container=t.container,this.duration=t.duration,this.fps=t.fps,this.ticker=t.ticker,this.onProgress=t.onProgress,this.active=!1,this.createPreviewTickInterceptor()}createPreviewTickInterceptor(){this.ticker.interceptor.beforeAll(async t=>{this.active&&(t.previewerAudioContext=new AudioContext,t.previewerAudioBufferSourceNodes=[])}),this.ticker.interceptor.afterAll(async t=>{var e;this.active&&t.previewerAudioContext&&((e=t.previewerAudioBufferSourceNodes)==null||e.forEach(i=>{i.disconnect()}),t.previewerAudioBufferSourceNodes=[],t.previewerAudioContext.close(),t.previewerAudioContext=void 0)}),this.ticker.interceptor.before(async(t,e)=>{this.active&&(e.tickStartTime=Date.now())}),this.ticker.interceptor.after(async(t,e)=>{var i;if(this.active){if(e.tickStartTime&&e.imageSource&&t<=this.duration){const s=e.imageSource.transferToImageBitmap();(i=this.container.getContext("bitmaprenderer"))==null||i.transferFromImageBitmap(s);const o=1e3/this.fps-(Date.now()-e.tickStartTime);o>0&&await i_(o)}this.onProgress&&this.onProgress(t/this.duration,t,this.duration)}})}async start(t){t&&(this.duration=t),this.active=!0,await this.ticker.run(this.duration,this.fps).finally(()=>{this.active=!1})}stop(){this.active=!1,this.ticker.stop()}}class mE{constructor(t={}){M(this,"options");M(this,"width");M(this,"height");M(this,"background");M(this,"fps");M(this,"onlyVideo");M(this,"scenes");M(this,"renderer");M(this,"ticker");M(this,"synthesizer");M(this,"previewer");M(this,"onProgress");this.options=t,this.width=this.options.width??pc,this.height=this.options.height??mc,this.background=this.options.background??t_,this.fps=this.options.fps??nE,this.onlyVideo=this.options.onlyVideo??!1,this.onProgress=this.options.onProgress,this.scenes=[],this.renderer=cu({view:new OffscreenCanvas(this.width,this.height),width:this.width,height:this.height,background:this.background}),this.ticker=new kg({}),this.addCreatorTickerInterceptor(),globalThis.__PIXI_RENDERER__=this.renderer}addCreatorTickerInterceptor(){this.ticker.interceptor.beforeAll(async()=>{this.ticker.tickCtx={sliceAudioBuffer:this.onlyVideo?void 0:(t,e,i)=>lE(t,e,this.fps,i)}}),this.ticker.interceptor.after(async(t,e)=>{await i_(1),e.currentStage&&this.renderer.render(e.currentStage),e.imageSource=this.renderer.view,e.audioBuffers=e.slicedAudioBuffers,e.currentStage=void 0,e.slicedAudioBuffers=[]})}add(t){this.scenes.push(t),this.ticker.add(t.tick,t)}remove(t){this.scenes=this.scenes.filter(e=>e.uuid!==t.uuid),this.ticker.remove(t.tick),t.destroy()}reset(){this.scenes.forEach(t=>{this.remove(t)}),this.scenes=[]}load(t){this.reset(),t.forEach(e=>{this.add(e)})}genDuration(){let t=0;return this.scenes.forEach((e,i)=>{const s=this.scenes[i-1];i>0&&(e.start=s.start+s.duration+1),t+=e.duration}),{duration:t}}preloadResource(t){const e=[],i=s=>{if(typeof s.load=="function"&&e.push(s.load()),s.children&&s.children.length>0)for(const n of s.children)i(n)};for(const s of t.children)i(s);for(const s of t.sounds)e.push(s.load());return Promise.all(e)}preloadAllResource(){const t=[];for(const e of this.scenes)t.push(this.preloadResource(e));return Promise.all(t)}loadSceneAnimation(t){t.loadAnimation()}loadAllSceneAnimation(){this.scenes.forEach(t=>{this.loadSceneAnimation(t)})}async preview(t,e){var s,n;if((s=this.previewer)!=null&&s.active||(n=this.synthesizer)!=null&&n.active){ei.warn("ticker is running");return}e&&this.load(e),this.loadAllSceneAnimation(),await this.preloadAllResource();const{duration:i}=this.genDuration();this.previewer?this.previewer.container!==t&&(this.previewer.container=t):this.previewer=new pE({container:t,duration:i,fps:this.fps,ticker:this.ticker,onProgress:this.onProgress}),await this.previewer.start(i)}stopPreview(){this.previewer&&this.previewer.stop()}async start(t){var s,n;if((s=this.previewer)!=null&&s.active||(n=this.synthesizer)!=null&&n.active){ei.warn("ticker is running");return}t&&this.load(t),this.loadAllSceneAnimation(),await this.preloadAllResource();const{duration:e}=this.genDuration();return this.synthesizer||(this.synthesizer=new oE({width:this.width,height:this.height,duration:e,fps:this.fps,ticker:this.ticker,onlyVideo:this.onlyVideo,onProgress:this.onProgress})),await this.synthesizer.start(e)}stop(){this.synthesizer&&(this.synthesizer.stop(),this.synthesizer=void 0)}}class vc{constructor(){M(this,"type");M(this,"animationParams")}addAnimation(t){this.animationParams||(this.animationParams=[]),Array.isArray(t)?this.animationParams.push({value:t}):this.animationParams.push(t)}removeAnimationByIndex(t){var e;(e=this.animationParams)==null||e.splice(t,1)}removeAllAnimation(){this.animationParams=[]}}function xc(r,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(i=>{Object.defineProperty(r.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i)||Object.create(null))})})}const gE={extension:k.Asset,detection:{test:async()=>!0,add:async r=>[...r],remove:async r=>r.filter(t=>r.includes(t))},loader:{extension:{type:[k.LoadParser],priority:me.High},test(r){return r.startsWith("blob:")},async load(r){return U.from(r)}}};V.add(gE);var _E=typeof global=="object"&&global&&global.Object===Object&&global;const r_=_E;var yE=typeof self=="object"&&self&&self.Object===Object&&self,vE=r_||yE||Function("return this")();const mi=vE;var xE=mi.Symbol;const Cs=xE;var s_=Object.prototype,bE=s_.hasOwnProperty,wE=s_.toString,Kn=Cs?Cs.toStringTag:void 0;function TE(r){var t=bE.call(r,Kn),e=r[Kn];try{r[Kn]=void 0;var i=!0}catch{}var s=wE.call(r);return i&&(t?r[Kn]=e:delete r[Kn]),s}var AE=Object.prototype,EE=AE.toString;function SE(r){return EE.call(r)}var CE="[object Null]",PE="[object Undefined]",n_=Cs?Cs.toStringTag:void 0;function Zn(r){return r==null?r===void 0?PE:CE:n_&&n_ in Object(r)?TE(r):SE(r)}function Jn(r){return r!=null&&typeof r=="object"}var IE=Array.isArray;const bc=IE;function Qn(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var RE="[object AsyncFunction]",ME="[object Function]",DE="[object GeneratorFunction]",BE="[object Proxy]";function o_(r){if(!Qn(r))return!1;var t=Zn(r);return t==ME||t==DE||t==RE||t==BE}var FE=mi["__core-js_shared__"];const wc=FE;var a_=function(){var r=/[^.]+$/.exec(wc&&wc.keys&&wc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function OE(r){return!!a_&&a_ in r}var LE=Function.prototype,kE=LE.toString;function Ur(r){if(r!=null){try{return kE.call(r)}catch{}try{return r+""}catch{}}return""}var NE=/[\\^$.*+?()[\]{}|]/g,UE=/^\[object .+?Constructor\]$/,GE=Function.prototype,HE=Object.prototype,$E=GE.toString,zE=HE.hasOwnProperty,VE=RegExp("^"+$E.call(zE).replace(NE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function WE(r){if(!Qn(r)||OE(r))return!1;var t=o_(r)?VE:UE;return t.test(Ur(r))}function XE(r,t){return r==null?void 0:r[t]}function Gr(r,t){var e=XE(r,t);return WE(e)?e:void 0}var jE=Gr(mi,"WeakMap");const Tc=jE;var h_=Object.create,YE=function(){function r(){}return function(t){if(!Qn(t))return{};if(h_)return h_(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();const qE=YE;function KE(r,t){var e=-1,i=r.length;for(t||(t=Array(i));++e-1&&r%1==0&&r-1&&r%1==0&&r<=sS}function p_(r){return r!=null&&f_(r.length)&&!o_(r)}var nS=Object.prototype;function Ac(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||nS;return r===e}function oS(r,t){for(var e=-1,i=Array(r);++e-1}function xC(r,t){var e=this.__data__,i=qa(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}function Ni(r){var t=-1,e=r==null?0:r.length;for(this.clear();++ts.cloneSelf()))||null,e}destroy(){typeof this.source=="string"&&this.source.startsWith("blob:")&&URL.revokeObjectURL(this.source),super.destroy()}toJSON(){return{__type:"Img",uuid:this.uuid,name:this.name,source:sr.setSourceToDB(this.source),alpha:this.alpha,width:this.width,height:this.height,transform:Ss(this),animationParams:this.animationParams,filters:this.filters}}static async fromJSON(e){const i=new sr;return i.uuid=e.uuid,i.name=e.name,e.source&&(i.source=await sr.getSourceFromDB(e.source)),i.alpha=e.alpha,i.width=e.width,i.height=e.height,i.setTransform(...e.transform),i.animationParams=e.animationParams,i.filters=yc(e.filters),i}static setSourceToDB(e){return e}static async getSourceFromDB(e){return e}}xc(sr,[vc]);class Ms extends Ma{constructor(){super(...arguments);M(this,"uuid",Es());M(this,"type","Text")}cloneSelf(){var i;const e=new Ms(this.text,Ui(this.style));return e.name=this.name,e.uuid=this.uuid,e.alpha=this.alpha,e.visible=this.visible,e.setTransform(...Ss(this)),e.animationParams=Ui(this.animationParams),e.filters=((i=this.filters)==null?void 0:i.map(s=>s.cloneSelf()))||null,e}toJSON(){return{__type:"Text",name:this.name,uuid:this.uuid,text:this.text,style:{fontSize:this.style.fontSize,fontWeight:this.style.fontWeight,fontStyle:this.style.fontStyle,fontFamily:this.style.fontFamily,fill:this.style.fill,wordWrap:this.style.wordWrap,breakWords:this.style.breakWords,wordWrapWidth:this.style.wordWrapWidth,leading:this.style.leading},alpha:this.alpha,width:this.width,height:this.height,transform:Ss(this),animationParams:this.animationParams,filters:this.filters}}static fromJSON(e){const i=new Ms(e.text,e.style);return i.name=e.name,i.uuid=e.uuid,i.alpha=e.alpha,i.width=e.width,i.height=e.height,i.setTransform(...e.transform),i.animationParams=e.animationParams,i.filters=yc(e.filters),i}}xc(Ms,[vc]);class Ds extends ci{constructor(){super(...arguments);M(this,"uuid",Es());M(this,"type","Graphics")}cloneSelf(){var i;const e=new Ds(this.clone().geometry);return e.name=this.name,e.uuid=this.uuid,e.alpha=this.alpha,e.visible=this.visible,e.width=this.width,e.height=this.height,e.setTransform(...Ss(this)),e.animationParams=Ui(this.animationParams),e.filters=((i=this.filters)==null?void 0:i.map(s=>s.cloneSelf()))||null,e}toJSON(){return{__type:"Graphics",name:this.name,graphicsData:this.geometry.graphicsData.map(e=>[e.shape,{...e.fillStyle,texture:void 0},{...e.lineStyle,texture:void 0}]),uuid:this.uuid,alpha:this.alpha,width:this.width,height:this.height,transform:Ss(this),animationParams:this.animationParams,filters:this.filters}}static fromJSON(e){const i=new Nu;i.graphicsData=e.graphicsData.map(n=>{const o=new J;o.x=n[0].x,o.y=n[0].y,o.width=n[0].width,o.height=n[0].height;const a=new bs;a.alpha=n[1].alpha,a.color=n[1].color,a.visible=n[1].visible;const h=new On;return h.color=n[2].color,h.alpha=n[2].alpha,h.visible=n[2].visible,h.width=n[2].width,h.alignment=n[2].alignment,h.native=n[2].native,h.cap=n[2].cap,h.join=n[2].join,h.miterLimit=n[2].miterLimit,new vs(o,a,h)});const s=new Ds(i);return s.name=e.name,s.uuid=e.uuid,s.alpha=e.alpha,s.width=e.width,s.height=e.height,s.setTransform(...e.transform),s.animationParams=e.animationParams,s.filters=yc(e.filters),s}}xc(Ds,[vc]);class zr{constructor(t){M(this,"name");M(this,"source");M(this,"start");M(this,"duration");M(this,"loop");M(this,"volume");M(this,"uuid");M(this,"buffer");M(this,"bufferDuration");this.name=t.name??"",this.source=t.source,this.start=t.start??0,this.duration=t.duration??0,this.loop=t.loop??!1,this.volume=t.volume??1,this.uuid=Es()}async load(){this.buffer=await cE(this.source),this.duration===0&&(this.duration=this.buffer.duration*1e3,this.bufferDuration=this.duration)}toJSON(){return{__type:"Sound",name:this.name,source:zr.setSourceToDB(this.source),start:this.start,duration:this.duration,loop:this.loop,volume:this.volume,uuid:this.uuid}}static async fromJSON(t){const e=new zr({source:await zr.getSourceFromDB(t.source)});return e.name=t.name,e.start=t.start,e.duration=t.duration,e.loop=t.loop,e.volume=t.volume,e.uuid=t.uuid,e}static setSourceToDB(t){return t}static async getSourceFromDB(t){return t}cloneSelf(){}destroy(){var t;(t=this.source)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(this.source)}async tick(t,e){let i=t;if(this.loop&&i>this.start+this.duration&&(i=i%(this.start+this.duration)),e.sliceAudioBuffer&&this.buffer&&i>=this.start&&i<=this.start+this.duration){const s=e.slicedAudioBuffers??[],n=await e.sliceAudioBuffer(this.buffer,i-this.start,this.volume);if(s.push(n),e.slicedAudioBuffers=s,e.previewerAudioContext&&e.previewerAudioBufferSourceNodes){const o=e.previewerAudioBufferSourceNodes.find(a=>a.buffer===this.buffer);if(o)o.context.state!=="running"&&o.start();else{const a=e.previewerAudioContext.createBufferSource();a.buffer=this.buffer,a.connect(e.previewerAudioContext.destination),a.start(),e.previewerAudioBufferSourceNodes.push(a)}}}else if(e.previewerAudioContext&&e.previewerAudioBufferSourceNodes){const s=e.previewerAudioBufferSourceNodes.find(n=>n.buffer===this.buffer);s&&s.stop()}}}class Ja extends Gt{cloneSelf(){return new Ja}}class ro extends xu{constructor(){super(...arguments);M(this,"name","BlurFilter")}cloneSelf(){return new ro}toJSON(){return{__type:"BlurFilter"}}static fromJSON(){return new ro}}class so extends bu{cloneSelf(){return new so}toJSON(){return{__type:"NoiseFilter"}}static fromJSON(){return new so}}class no extends Pn{constructor(){super(),this.blackAndWhite(!0),this.brightness(0,!0)}cloneSelf(){return new no}toJSON(){return{__type:"BlackMaskFilter"}}static fromJSON(){return new no}}var gI=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void) { gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; }`,_I=`varying vec2 vTextureCoord; uniform sampler2D uSampler; uniform vec4 filterArea; uniform vec2 dimensions; uniform float sepia; uniform float noise; uniform float noiseSize; uniform float scratch; uniform float scratchDensity; uniform float scratchWidth; uniform float vignetting; uniform float vignettingAlpha; uniform float vignettingBlur; uniform float seed; const float SQRT_2 = 1.414213; const vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0); float rand(vec2 co) { return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); } vec3 Overlay(vec3 src, vec3 dst) { // if (dst <= 0.5) then: 2 * src * dst // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src) return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z))); } void main() { gl_FragColor = texture2D(uSampler, vTextureCoord); vec3 color = gl_FragColor.rgb; if (sepia > 0.0) { float gray = (color.x + color.y + color.z) / 3.0; vec3 grayscale = vec3(gray); color = Overlay(SEPIA_RGB, grayscale); color = grayscale + sepia * (color - grayscale); } vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy; if (vignetting > 0.0) { float outter = SQRT_2 - vignetting * SQRT_2; vec2 dir = vec2(vec2(0.5, 0.5) - coord); dir.y *= dimensions.y / dimensions.x; float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); } if (scratchDensity > seed && scratch != 0.0) { float phase = seed * 256.0; float s = mod(floor(phase), 2.0); float dist = 1.0 / scratchDensity; float d = distance(coord, vec2(seed * dist, abs(s - seed * dist))); if (d < seed * 0.6 + 0.4) { highp float period = scratchDensity * 10.0; float xx = coord.x * period + phase; float aa = abs(mod(xx, 0.5) * 4.0); float bb = mod(floor(xx / 0.5), 2.0); float yy = (1.0 - bb) * aa + bb * (2.0 - aa); float kk = 2.0 * period; float dw = scratchWidth / dimensions.x * (0.75 + seed); float dh = dw * kk; float tine = (yy - (2.0 - dh)); if (tine > 0.0) { float _sign = sign(scratch); tine = s * tine / period + scratch + 0.1; tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5); color.rgb *= tine; } } } if (noise > 0.0 && noiseSize > 0.0) { vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; pixelCoord.x = floor(pixelCoord.x / noiseSize); pixelCoord.y = floor(pixelCoord.y / noiseSize); // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0); // float _noise = snoise(d) * 0.5; float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; color += _noise * noise; } gl_FragColor.rgb = color; } `;const Y_=class extends Gt{constructor(r,t=0){super(gI,_I),this.seed=0,this.uniforms.dimensions=new Float32Array(2),typeof r=="number"?(this.seed=r,r=void 0):this.seed=t,Object.assign(this,Y_.defaults,r)}apply(r,t,e,i){var s,n;this.uniforms.dimensions[0]=(s=t.filterFrame)==null?void 0:s.width,this.uniforms.dimensions[1]=(n=t.filterFrame)==null?void 0:n.height,this.uniforms.seed=this.seed,r.applyFilter(this,t,e,i)}set sepia(r){this.uniforms.sepia=r}get sepia(){return this.uniforms.sepia}set noise(r){this.uniforms.noise=r}get noise(){return this.uniforms.noise}set noiseSize(r){this.uniforms.noiseSize=r}get noiseSize(){return this.uniforms.noiseSize}set scratch(r){this.uniforms.scratch=r}get scratch(){return this.uniforms.scratch}set scratchDensity(r){this.uniforms.scratchDensity=r}get scratchDensity(){return this.uniforms.scratchDensity}set scratchWidth(r){this.uniforms.scratchWidth=r}get scratchWidth(){return this.uniforms.scratchWidth}set vignetting(r){this.uniforms.vignetting=r}get vignetting(){return this.uniforms.vignetting}set vignettingAlpha(r){this.uniforms.vignettingAlpha=r}get vignettingAlpha(){return this.uniforms.vignettingAlpha}set vignettingBlur(r){this.uniforms.vignettingBlur=r}get vignettingBlur(){return this.uniforms.vignettingBlur}};let Oc=Y_;Oc.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3};class oo extends Oc{constructor(){super(...arguments);M(this,"name","OldFilmFilter")}cloneSelf(){return new oo}toJSON(){return{__type:"OldFilmFilter"}}static fromJSON(){return new oo}}class ao extends Oc{constructor(){super();M(this,"name","VignetteFilter");this.sepia=0,this.noise=0,this.vignetting=.5}cloneSelf(){return new ao}toJSON(){return{__type:"VignetteFilter"}}static fromJSON(){return new ao}}function Gi(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function q_(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*! * GSAP 3.12.2 * https://greensock.com * * @license Copyright 2008-2023, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var ye={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Bs={duration:.5,overwrite:!1,delay:0},Lc,Jt,Tt,De=1e8,ct=1/De,kc=Math.PI*2,yI=kc/4,vI=0,K_=Math.sqrt,xI=Math.cos,bI=Math.sin,Ht=function(t){return typeof t=="string"},At=function(t){return typeof t=="function"},Hi=function(t){return typeof t=="number"},Nc=function(t){return typeof t>"u"},gi=function(t){return typeof t=="object"},ae=function(t){return t!==!1},Uc=function(){return typeof window<"u"},Qa=function(t){return At(t)||Ht(t)},Z_=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Qt=Array.isArray,Gc=/(?:-?\.?\d|\.)+/gi,J_=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Fs=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Hc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Q_=/[+-]=-?[.\d]+/,t0=/[^,'"\[\]\s]+/gi,wI=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,bt,Be,$c,zc,ve={},th={},e0,i0=function(t){return(th=Wr(t,ve))&&ce},Vc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},eh=function(t,e){return!e&&console.warn(t)},r0=function(t,e){return t&&(ve[t]=e)&&th&&(th[t]=e)||ve},ho=function(){return 0},TI={suppressEvents:!0,isStart:!0,kill:!1},ih={suppressEvents:!0,kill:!1},AI={suppressEvents:!0},Wc={},nr=[],Xc={},s0,xe={},jc={},n0=30,rh=[],Yc="",qc=function(t){var e=t[0],i,s;if(gi(e)||At(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=rh.length;s--&&!rh[s].targetTest(e););i=rh[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},Vr=function(t){return t._gsap||qc(Le(t))[0]._gsap},o0=function(t,e,i){return(i=t[e])&&At(i)?t[e]():Nc(i)&&t.getAttribute&&t.getAttribute(e)||i},he=function(t,e){return(t=t.split(",")).forEach(e)||t},Ct=function(t){return Math.round(t*1e5)/1e5||0},Wt=function(t){return Math.round(t*1e7)/1e7||0},Os=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},EI=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++sa;)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},oh=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},or=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Xr=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},PI=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Kc=function(t,e,i,s){return t._startAt&&(Jt?t._startAt.revert(ih):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},II=function r(t){return!t||t._ts&&r(t.parent)},d0=function(t){return t._repeat?Ls(t._tTime,t=t.duration()+t._rDelay)*t:0},Ls=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},ah=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},hh=function(t){return t._end=Wt(t._start+(t._tDur/Math.abs(t._ts||t._rts||ct)||0))},lh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=Wt(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),hh(t),i._dirty||Xr(i,t)),t},f0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._startct)&&e.render(i,!0)),Xr(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-ct}},_i=function(t,e,i,s){return e.parent&&or(e),e._start=Wt((Hi(i)?i:i||t!==bt?Oe(t,i,e):t._time)+e._delay),e._end=Wt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),c0(t,e,"_first","_last",t._sort?"_start":0),Zc(e)||(t._recent=e),s||f0(t,e),t._ts<0&&lh(t,t._tTime),t},p0=function(t,e){return(ve.ScrollTrigger||Vc("scrollTrigger",e))&&ve.ScrollTrigger.create(e,t)},m0=function(t,e,i,s,n){if(od(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!Jt&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&s0!==be.frame)return nr.push(t),t._lazy=[n,s],1},RI=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Zc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},MI=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&RI(t)&&!(!t._initted&&Zc(t))||(t._ts<0||t._dp._ts<0)&&!Zc(t))?0:1,a=t._rDelay,h=0,l,u,c;if(a&&t._repeat&&(h=co(0,t._tDur,e),u=Ls(h,a),t._yoyo&&u&1&&(o=1-o),u!==Ls(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||Jt||s||t._zTime===ct||!e&&t._zTime){if(!t._initted&&m0(t,e,s,i,h))return;for(c=t._zTime,t._zTime=e||(i?ct:0),i||(i=e&&!c),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&Kc(t,e,i,!0),t._onUpdate&&!i&&ke(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&ke(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&or(t,1),!i&&!Jt&&(ke(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},DI=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._start0&&!s&&lh(t,t._tTime=t._tDur*a),t.parent&&hh(t),i||Xr(t.parent,t),t},g0=function(t){return t instanceof le?Xr(t):ks(t,t._dur)},BI={_start:0,endTime:ho,totalDuration:ho},Oe=function r(t,e,i){var s=t.labels,n=t._recent||BI,o=t.duration()>=De?n.endTime(!1):t._dur,a,h,l;return Ht(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*(Qt(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},uo=function(t,e,i){var s=Hi(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 Dt(e[0],o,e[n+1])},ar=function(t,e){return t||t===0?e(t):e},co=function(t,e,i){return ie?e:i},te=function(t,e){return!Ht(t)||!(e=wI.exec(t))?"":e[1]},FI=function(t,e,i){return ar(i,function(s){return co(t,e,s)})},Jc=[].slice,_0=function(t,e){return t&&gi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&gi(t[0]))&&!t.nodeType&&t!==Be},OI=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return Ht(s)&&!e||_0(s,1)?(n=i).push.apply(n,Le(s)):i.push(s)})||i},Le=function(t,e,i){return Tt&&!e&&Tt.selector?Tt.selector(t):Ht(t)&&!i&&($c||!Us())?Jc.call((e||zc).querySelectorAll(t),0):Qt(t)?OI(t,i):_0(t)?Jc.call(t,0):t?[t]:[]},Qc=function(t){return t=Le(t)[0]||eh("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Le(e,i.querySelectorAll?i:i===t?eh("Invalid scope")||zc.createElement("div"):t)}},y0=function(t){return t.sort(function(){return .5-Math.random()})},v0=function(t){if(At(t))return t;var e=gi(t)?t:{each:t},i=jr(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,u=s,c=s;return Ht(s)?u=c={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(u=s[0],c=s[1]),function(d,f,m){var p=(m||e).length,g=o[p],_,v,y,x,b,S,A,T,w;if(!g){if(w=e.grid==="auto"?0:(e.grid||[1,De])[1],!w){for(A=-De;A<(A=m[w++].getBoundingClientRect().left)&&wA&&(A=b),bp?p-1:l?l==="y"?p/w:w:Math.max(w,p/w))||0)*(s==="edges"?-1:1),g.b=p<0?n-p:n,g.u=te(e.amount||e.each)||0,i=i&&p<0?M0(i):i}return p=(g[d]-g.min)/g.max||0,Wt(g.b+(i?i(p):p)*g.v)+g.u}},td=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=Wt(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(Hi(i)?0:te(i))}},x0=function(t,e){var i=Qt(t),s,n;return!i&&gi(t)&&(s=i=t.radius||De,t.values?(t=Le(t.values),(n=!Hi(t[0]))&&(s*=s)):t=td(t.increment)),ar(e,i?At(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=De,u=0,c=t.length,d,f;c--;)n?(d=t[c].x-a,f=t[c].y-h,d=d*d+f*f):d=Math.abs(t[c]-a),ds?n-o:o)})},fo=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:Gc),i+=t.substr(e,s-e)+b0(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 ar(n,function(h){return i+((h-t)/o*a||0)})},HI=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=Ht(t),a={},h,l,u,c,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(Qt(t)&&!Qt(e)){for(u=[],c=t.length,d=c-2,l=1;l(a=Math.abs(a))&&(h=o,n=a);return h},ke=function(t,e,i){var s=t.vars,n=s[e],o=Tt,a=t._ctx,h,l,u;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&nr.length&&sh(),a&&(Tt=a),u=h?n.apply(l,h):n.call(l),Tt=o,u},po=function(t){return or(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Jt),t.progress()<1&&ke(t,"onInterrupt"),t},Ns,E0=[],S0=function(t){if(Uc()&&t){t=!t.name&&t.default||t;var e=t.name,i=At(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:ho,render:ld,add:sd,kill:rR,modifier:iR,rawVars:0},o={targetTest:0,get:0,getSetter:hd,aliases:{},register:0};if(Us(),t!==s){if(xe[e])return;Fe(s,Fe(nh(t,n),o)),Wr(s.prototype,Wr(n,nh(t,o))),xe[s.prop=e]=s,t.targetTest&&(rh.push(s),Wc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}r0(e,s),t.register&&t.register(ce,s,ue)}else t&&E0.push(t)},dt=255,mo={aqua:[0,dt,dt],lime:[0,dt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,dt],navy:[0,0,128],white:[dt,dt,dt],olive:[128,128,0],yellow:[dt,dt,0],orange:[dt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[dt,0,0],pink:[dt,192,203],cyan:[0,dt,dt],transparent:[dt,dt,dt,0]},ed=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)*dt+.5|0},C0=function(t,e,i){var s=t?Hi(t)?[t>>16,t>>8&dt,t&dt]:0:mo.black,n,o,a,h,l,u,c,d,f,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),mo[t])s=mo[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&dt,s&dt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&dt,t&dt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(Gc),!e)h=+s[0]%360/360,l=+s[1]/100,u=+s[2]/100,o=u<=.5?u*(l+1):u+l-u*l,n=u*2-o,s.length>3&&(s[3]*=1),s[0]=ed(h+1/3,n,o),s[1]=ed(h,n,o),s[2]=ed(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(J_),i&&s.length<4&&(s[3]=1),s}else s=t.match(Gc)||mo.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/dt,o=s[1]/dt,a=s[2]/dt,c=Math.max(n,o,a),d=Math.min(n,o,a),u=(c+d)/2,c===d?h=l=0:(f=c-d,l=u>.5?f/(2-c-d):f/(c+d),h=c===n?(o-a)/f+(ot&&(i+=_-e),s+=_,b=s-i,y=b-o,(y>0||v)&&(S=++c.frame,d=b-c.time*1e3,c.time=b=b/1e3,o+=y+(y>=n?4:n-y),x=1),v||(h=l(p)),x)for(f=0;f=_&&f--},_listeners:a},c}(),Us=function(){return!go&&be.wake()},st={},zI=/^[\d.\-M][\d.\-,\s]/,VI=/["']/g,WI=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n1&&i.config?i.config.apply(null,~t.indexOf("{")?[WI(e[1])]:XI(t).split(",").map(h0)):st._CE&&zI.test(t)?st._CE("",t):i},M0=function(t){return function(e){return 1-t(1-e)}},D0=function r(t,e){for(var i=t._first,s;i;)i instanceof le?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},jr=function(t,e){return t&&(At(t)?t:st[t]||jI(t))||e},Yr=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 he(t,function(a){st[a]=ve[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},B0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},id=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/kc*(Math.asin(1/s)||0),a=function(u){return u===1?1:s*Math.pow(2,-10*u)*bI((u-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:B0(a);return n=kc/n,h.config=function(l,u){return r(t,l,u)},h},rd=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)}:B0(i);return s.config=function(n){return r(t,n)},s};he("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;Yr(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,Yr("Elastic",id("in"),id("out"),id()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,ks(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(Us(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(lh(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&&i0||!this._tDur&&!i)&&_i(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===ct||!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.ratio},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.ratio},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?Ls(this._tTime,n)+1:1},t.timeScale=function(i){if(!arguments.length)return this._rts===-ct?0:this._rts;if(this._rts===i)return this;var s=this.parent&&this._ts?ah(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-ct?0:this._rts,this.totalTime(co(-Math.abs(this._delay),this._tDur,s),!0),hh(this),PI(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):(Us(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==ct&&(this._tTime-=ct)))),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)&&_i(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?ah(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=AI);var s=Jt;return Jt=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),Jt=s,this},t.globalTime=function(i){for(var s=this,n=arguments.length?i:s.rawTime();s;)n=s._start+n/(s._ts||1),s=s._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1/0:this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,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(Oe(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?-ct:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-ct,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&&n1?(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=At(i)?i:l0,a=function(){var l=s.then;s.then=null,At(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(){po(this)},r}();Fe(_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:-ct,_prom:0,_ps:!1,_rts:1});var le=function(r){q_(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),bt&&_i(i.parent||bt,Gi(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&p0(Gi(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return uo(0,arguments,this),this},e.from=function(s,n,o){return uo(1,arguments,this),this},e.fromTo=function(s,n,o,a){return uo(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,lo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Dt(s,n,Oe(this,o),1),this},e.call=function(s,n,o){return _i(this,Dt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,u){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=u,o.parent=this,new Dt(s,o,Oe(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,u){return o.runBackwards=1,lo(o).immediateRender=ae(o.immediateRender),this.staggerTo(s,n,o,a,h,l,u)},e.staggerFromTo=function(s,n,o,a,h,l,u,c){return a.startAt=o,lo(a).immediateRender=ae(a.immediateRender),this.staggerTo(s,n,a,h,l,u,c)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=s<=0?0:Wt(s),c=this._zTime<0!=s<0&&(this._initted||!l),d,f,m,p,g,_,v,y,x,b,S,A;if(this!==bt&&u>h&&s>=0&&(u=h),u!==this._tTime||o||c){if(a!==this._time&&l&&(u+=this._time-a,s+=this._time-a),d=u,x=this._start,y=this._ts,_=!y,c&&(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=Wt(u%g),u===h?(p=this._repeat,d=l):(p=~~(u/g),p&&p===u/g&&(d=l,p--),d>l&&(d=l)),b=Ls(this._tTime,g),!a&&this._tTime&&b!==p&&this._tTime-b*g-this._dur<=0&&(b=p),S&&p&1&&(d=l-d,A=1),p!==b&&!this._lock){var T=S&&b&1,w=T===(S&&p&1);if(p=a&&s>=0)for(f=this._first;f;){if(m=f._next,(f._act||d>=f._start)&&f._ts&&v!==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&&!_){v=0,m&&(u+=this._zTime=-ct);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&&v!==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||Jt&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!_){v=0,m&&(u+=this._zTime=P?-ct:ct);break}}f=m}}if(v&&!n&&(this.pause(),v.render(d>=a?0:-ct)._zTime=d>=a?1:-1,this._ts))return this._start=x,hh(this),this.render(s,n,o);this._onUpdate&&!n&&ke(this,"onUpdate",!0),(u===h&&this._tTime>=this.totalDuration()||!u&&a)&&(x===this._start||Math.abs(y)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(u===h&&this._ts>0||!u&&this._ts<0)&&or(this,1),!n&&!(s<0&&!a)&&(u||a||!h)&&(ke(this,u===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(Hi(n)||(n=Oe(this,n,s)),!(s instanceof _o)){if(Qt(s))return s.forEach(function(a){return o.add(a,n)}),this;if(Ht(s))return this.addLabel(s,n);if(At(s))s=Dt.delayedCall(0,s);else return this}return this!==s?_i(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=-De);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof Dt?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 Ht(s)?this.removeLabel(s):At(s)?this.killTweensOf(s):(oh(this,s),s===this._recent&&(this._recent=this._last),Xr(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Wt(be.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]=Oe(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=Dt.delayedCall(0,n||ho,o);return a.data="isPause",this._hasPause=1,_i(this,a,Oe(this,s))},e.removePause=function(s){var n=this._first;for(s=Oe(this,s);n;)n._start===s&&n.data==="isPause"&&or(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)lr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=Le(s),h=this._first,l=Hi(n),u;h;)h instanceof Dt?EI(h._targets,a)&&(l?(!lr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(u=h.getTweensOf(a,n)).length&&o.push.apply(o,u),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=Oe(o,s),h=n,l=h.startAt,u=h.onStart,c=h.onStartParams,d=h.immediateRender,f,m=Dt.to(o,Fe({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())||ct,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&&ks(m,g,0,1).render(m._time,!0,!0),f=1}u&&u.apply(m,c||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Fe({startAt:{time:Oe(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),A0(this,Oe(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),A0(this,Oe(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+ct)},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 Xr(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={}),Xr(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=De,l,u,c;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(c=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),u=a._start,u>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,_i(o,a,u-a._delay,1)._lock=0):h=u,u<0&&a._ts&&(n-=u,(!c&&!o._dp||c&&c.smoothChildTiming)&&(o._start+=u/o._ts,o._time-=u,o._tTime-=u),o.shiftChildren(-u,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;ks(o,o===bt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(bt._ts&&(a0(bt,ah(s,bt)),s0=be.frame),be.frame>=n0){n0+=ye.autoSleep||120;var n=bt._first;if((!n||!n._ts)&&ye.autoSleep&&be._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||be.sleep()}}},t}(_o);Fe(le.prototype,{_lock:0,_hasPause:0,_forcing:0});var YI=function(t,e,i,s,n,o,a){var h=new ue(this._pt,t,e,0,1,G0,null,n),l=0,u=0,c,d,f,m,p,g,_,v;for(h.b=i,h.e=s,i+="",s+="",(_=~s.indexOf("random("))&&(s=fo(s)),o&&(v=[i,s],o(v,t,e),i=v[0],s=v[1]),d=i.match(Hc)||[];c=Hc.exec(s);)m=c[0],p=s.substring(l,c.index),f?f=(f+1)%5:p.substr(-5)==="rgba("&&(f=1),m!==d[u++]&&(g=parseFloat(d[u-1])||0,h._pt={_next:h._pt,p:p||u===1?p:",",s:g,c:m.charAt(1)==="="?Os(g,m)-g:parseFloat(m)-g,m:f&&f<4?Math.round:0},l=Hc.lastIndex);return h.c=l")}),x.duration();else{S={};for(T in m)T==="ease"||T==="easeEach"||JI(T,m[T],S,m.easeEach);for(T in S)for(E=S[T].sort(function(z,G){return z.t-G.t}),I=0,b=0;bh-ct&&!u?h:sl&&(d=l)),_=this._yoyo&&m&1,_&&(x=this._yEase,d=l-d),g=Ls(this._tTime,p),d===a&&!o&&this._initted)return this._tTime=c,this;m!==g&&(y&&this._yEase&&D0(y,_),this.vars.repeatRefresh&&!_&&!this._lock&&(this._lock=o=1,this.render(Wt(p*m),!0).invalidate()._lock=0))}if(!this._initted){if(m0(this,u?s:d,o,n,c))return this._tTime=0,this;if(a!==this._time)return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(x||this._ease)(d/l),this._from&&(this.ratio=v=1-v),d&&!a&&!n&&!m&&(ke(this,"onStart"),this._tTime!==c))return this;for(f=this._pt;f;)f.r(v,f.d),f=f._next;y&&y.render(s<0?s:!d&&_?-ct:y._dur*y._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(u&&Kc(this,s,n,o),ke(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&ke(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&Kc(this,s,!0,!0),(s||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&or(this,1),!n&&!(u&&!a)&&(c||a||_)&&(ke(this,c===h?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&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){go||be.wake(),this._ts||this.play();var h=Math.min(this._dur,(this._dp._time-this._start)*this._ts),l;return this._initted||od(this,h),l=this._ease(h/this._dur),KI(this,s,n,o,a,l,h)?this.resetTo(s,n,o,a):(lh(this,0),this.parent||c0(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?po(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,lr&&lr.vars.overwrite!==!0)._first||po(this),this.parent&&o!==this.timeline.totalDuration()&&ks(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?Le(s):a,l=this._ptLookup,u=this._pt,c,d,f,m,p,g,_;if((!n||n==="all")&&CI(a,h))return n==="all"&&(this._pt=0),po(this);for(c=this._op=this._op||[],n!=="all"&&(Ht(n)&&(p={},he(n,function(v){return p[v]=1}),n=p),n=ZI(a,n)),_=a.length;_--;)if(~h.indexOf(a[_])){d=l[_],n==="all"?(c[_]=n,m=d,f={}):(f=c[_]=c[_]||{},m=n);for(p in m)g=d&&d[p],g&&((!("kill"in g.d)||g.d.kill(p)===!0)&&oh(this,g,"_pt"),delete d[p]),f!=="all"&&(f[p]=1)}return this._initted&&!this._pt&&u&&po(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return uo(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 uo(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 bt.killTweensOf(s,n,o)},t}(_o);Fe(Dt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),he("staggerTo,staggerFrom,staggerFromTo",function(r){Dt[r]=function(){var t=new le,e=Jc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var ad=function(t,e,i){return t[e]=i},N0=function(t,e,i){return t[e](i)},QI=function(t,e,i,s){return t[e](s.fp,i)},tR=function(t,e,i){return t.setAttribute(e,i)},hd=function(t,e){return At(t[e])?N0:Nc(t[e])&&t.setAttribute?tR:ad},U0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},eR=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},G0=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)},ld=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},iR=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},rR=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?oh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},sR=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},H0=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},ue=function(){function r(e,i,s,n,o,a,h,l,u){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||U0,this.d=h||this,this.set=l||ad,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(i,s,n){this.mSet=this.mSet||this.set,this.set=sR,this.m=i,this.mt=n,this.tween=s},r}();he(Yc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return Wc[r]=1}),ve.TweenMax=ve.TweenLite=Dt,ve.TimelineLite=ve.TimelineMax=le,bt=new le({sortChildren:!1,defaults:Bs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),ye.stringFilter=R0;var qr=[],uh={},nR=[],$0=0,oR=0,ud=function(t){return(uh[t]||nR).map(function(e){return e()})},cd=function(){var t=Date.now(),e=[];t-$0>2&&(ud("matchMediaInit"),qr.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Be.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),ud("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i)}),$0=t,ud("matchMedia"))},z0=function(){function r(e,i){this.selector=i&&Qc(i),this.data=[],this._r=[],this.isReverted=!1,this.id=oR++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){At(i)&&(n=s,s=i,i=At);var o=this,a=function(){var l=Tt,u=o.selector,c;return l&&l!==o&&l.data.push(o),n&&(o.selector=Qc(n)),Tt=o,c=s.apply(o,arguments),At(c)&&o._r.push(c),Tt=l,o.selector=u,o.isReverted=!1,c};return o.last=a,i===At?a(o):i?o[i]=a:a},t.ignore=function(i){var s=Tt;Tt=null,i(this),Tt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof Dt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i){var o=this.getTweens();this.data.forEach(function(h){h.data==="isFlip"&&(h.revert(),h.getChildren(!0,!0,!1).forEach(function(l){return o.splice(o.indexOf(l),1)}))}),o.map(function(h){return{g:h.globalTime(0),t:h}}).sort(function(h,l){return l.g-h.g||-1/0}).forEach(function(h){return h.t.revert(i)}),this.data.forEach(function(h){return!(h instanceof Dt)&&h.revert&&h.revert(i)}),this._r.forEach(function(h){return h(i,n)}),this.isReverted=!0}else this.data.forEach(function(h){return h.kill&&h.kill()});if(this.clear(),s)for(var a=qr.length;a--;)qr[a].id===this.id&&qr.splice(a,1)},t.revert=function(i){this.kill(i||{})},r}(),aR=function(){function r(e){this.contexts=[],this.scope=e}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,u;Tt&&!o.selector&&(o.selector=Tt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?u=1:(h=Be.matchMedia(i[l]),h&&(qr.indexOf(o)<0&&qr.push(o),(a[l]=h.matches)&&(u=1),h.addListener?h.addListener(cd):h.addEventListener("change",cd)));return u&&s(o),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),ch={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i1){var s=t.map(function(u){return ce.quickSetter(u,e,i)}),n=s.length;return function(u){for(var c=n;c--;)s[c](u)}}t=t[0]||{};var o=xe[e],a=Vr(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(u){var c=new o;Ns._pt=0,c.init(t,i?u+i:u,Ns,0,[t]),c.render(1,c),Ns._pt&&ld(1,Ns)}:a.set(t,h);return o?l:function(u){return l(t,h,i?u+i:u,a,1)}},quickTo:function(t,e,i){var s,n=ce.to(t,Wr((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,u){return n.resetTo(e,h,l,u)};return o.tween=n,o},isTweening:function(t){return bt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=jr(t.ease,Bs.ease)),u0(Bs,t||{})},config:function(t){return u0(ye,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&&!xe[a]&&!ve[a]&&eh(e+" effect requires "+a+" plugin.")}),jc[e]=function(a,h,l){return i(Le(a),Fe(h||{},n),l)},o&&(le.prototype[e]=function(a,h,l){return this.add(jc[e](a,gi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){st[t]=jr(e)},parseEase:function(t,e){return arguments.length?jr(t,e):st},getById:function(t){return bt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new le(t),s,n;for(i.smoothChildTiming=ae(t.smoothChildTiming),bt.remove(i),i._dp=0,i._time=i._tTime=bt._time,s=bt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof Dt&&s.vars.onComplete===s._targets[0]))&&_i(i,s,s._start-s._delay),s=n;return _i(bt,i,0),i},context:function(t,e){return t?new z0(t,e):Tt},matchMedia:function(t){return new aR(t)},matchMediaRefresh:function(){return qr.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||cd()},addEventListener:function(t,e){var i=uh[t]||(uh[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=uh[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:UI,wrapYoyo:GI,distribute:v0,random:b0,snap:x0,normalize:NI,getUnit:te,clamp:FI,splitColor:C0,toArray:Le,selector:Qc,mapRange:T0,pipe:LI,unitize:kI,interpolate:HI,shuffle:y0},install:i0,effects:jc,ticker:be,updateRoot:le.updateRoot,plugins:xe,globalTimeline:bt,core:{PropTween:ue,globals:r0,Tween:Dt,Timeline:le,Animation:_o,getCache:Vr,_removeLinkedListItem:oh,reverting:function(){return Jt},context:function(t){return t&&Tt&&(Tt.data.push(t),t._ctx=Tt),Tt},suppressOverwrites:function(t){return Lc=t}}};he("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return ch[r]=Dt[r]}),be.add(le.updateRoot),Ns=ch.to({},{duration:0});var hR=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},lR=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=hR(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},dd=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(Ht(n)&&(h={},he(n,function(u){return h[u]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}lR(a,n)}}}},ce=ch.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;)Jt?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)}},dd("roundProps",td),dd("modifiers"),dd("snap",x0))||ch;Dt.version=le.version=ce.version="3.12.2",e0=1,Uc()&&Us();var uR=st.Power0,cR=st.Power1,dR=st.Power2,fR=st.Power3,pR=st.Power4;st.Linear,st.Quad,st.Cubic,st.Quart,st.Quint,st.Strong;var mR=st.Elastic,gR=st.Back;st.SteppedEase;var _R=st.Bounce;st.Sine,st.Expo,st.Circ;/*! * CSSPlugin 3.12.2 * https://greensock.com * * Copyright 2008-2023, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var V0,ur,Gs,fd,Kr,W0,pd,yR=function(){return typeof window<"u"},$i={},Zr=180/Math.PI,Hs=Math.PI/180,$s=Math.atan2,X0=1e8,md=/([A-Z])/g,vR=/(left|right|width|margin|padding|x)/i,xR=/[\s,\(]\S/,yi={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},gd=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bR=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)},wR=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)},TR=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},j0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Y0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},AR=function(t,e,i){return t.style[e]=i},ER=function(t,e,i){return t.style.setProperty(e,i)},SR=function(t,e,i){return t._gsap[e]=i},CR=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},PR=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},IR=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},wt="transform",Qe=wt+"Origin",RR=function r(t,e){var i=this,s=this.target,n=s.style;if(t in $i&&n){if(this.tfm=this.tfm||{},t!=="transform")t=yi[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=zi(s,o)}):this.tfm[t]=s._gsap.x?s._gsap[t]:zi(s,t);else return yi.transform.split(",").forEach(function(o){return r.call(i,o,e)});if(this.props.indexOf(wt)>=0)return;s._gsap.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Qe,e,"")),t=wt}(n||e)&&this.props.push(t,e,n[t])},q0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},MR=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n=0?J0[o]:"")+t},yd=function(){yR()&&window.document&&(V0=window,ur=V0.document,Gs=ur.documentElement,Kr=_d("div")||{style:{}},_d("div"),wt=zs(wt),Qe=wt+"Origin",Kr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Z0=!!zs("perspective"),pd=ce.core.reverting,fd=1)},vd=function r(t){var e=_d("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(Gs.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)),Gs.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=vd.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===vd||(e=vd.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))},vo=function(t,e){if(e){var i=t.style;e in $i&&e!==Qe&&(e=wt),i.removeProperty?((e.substr(0,2)==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(e.replace(md,"-$1").toLowerCase())):i.removeAttribute(e)}},cr=function(t,e,i,s,n,o){var a=new ue(t._pt,e,i,0,1,o?Y0:j0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},iy={deg:1,rad:1,turn:1},DR={grid:1,flex:1},dr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=Kr.style,h=vR.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(h?"Width":"Height"),c=100,d=s==="px",f=s==="%",m,p,g,_;return s===o||!n||iy[s]||iy[o]?n:(o!=="px"&&!d&&(n=r(t,e,i,"px")),_=t.getCTM&&ey(t),(f||o==="%")&&($i[e]||~e.indexOf("adius"))?(m=_?t.getBBox()[h?"width":"height"]:t[u],Ct(f?n/m*c:n/100*m)):(a[h?"width":"height"]=c+(d?o:s),p=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===ur||!p.appendChild)&&(p=ur.body),g=p._gsap,g&&f&&g.width&&h&&g.time===be.time&&!g.uncache?Ct(n/g.width*c):((f||o==="%")&&!DR[vi(p,"display")]&&(a.position=vi(t,"position")),p===t&&(a.position="static"),p.appendChild(Kr),m=Kr[u],p.removeChild(Kr),a.position="absolute",h&&f&&(g=Vr(p),g.time=be.time,g.width=p[u]),Ct(d?m*n/c:m&&n?c/m*n:0))))},zi=function(t,e,i,s){var n;return fd||yd(),e in yi&&e!=="transform"&&(e=yi[e],~e.indexOf(",")&&(e=e.split(",")[0])),$i[e]&&e!=="transform"?(n=bo(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:fh(vi(t,Qe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=dh[e]&&dh[e](t,e,i)||vi(t,e)||o0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?dr(t,e,n,i)+i:n},BR=function(t,e,i,s){if(!i||i==="none"){var n=zs(e,t,1),o=n&&vi(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=vi(t,"borderTopColor"))}var a=new ue(this._pt,t.style,e,0,1,G0),h=0,l=0,u,c,d,f,m,p,g,_,v,y,x,b;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(t.style[e]=s,s=vi(t,e)||s,t.style[e]=i),u=[i,s],R0(u),i=u[0],s=u[1],d=i.match(Fs)||[],b=s.match(Fs)||[],b.length){for(;c=Fs.exec(s);)g=c[0],v=s.substring(h,c.index),m?m=(m+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(m=1),g!==(p=d[l++]||"")&&(f=parseFloat(p)||0,x=p.substr((f+"").length),g.charAt(1)==="="&&(g=Os(f,g)+x),_=parseFloat(g),y=g.substr((_+"").length),h=Fs.lastIndex-y.length,y||(y=y||ye.units[e]||x,h===s.length&&(s+=y,a.e+=y)),x!==y&&(f=dr(t,e,p,y)||0),a._pt={_next:a._pt,p:v||l===1?v:",",s:f,c:_-f,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h-1;)a=n[l],$i[a]&&(h=1,a=a==="transformOrigin"?Qe:wt),vo(i,a);h&&(vo(i,wt),o&&(o.svg&&i.removeAttribute("transform"),bo(i,1),o.uncache=1,q0(s)))}},dh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new ue(t._pt,e,i,0,0,OR);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},xo=[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=vi(t,wt);return ny(e)?xo:e.substr(7).match(J_).map(Ct)},xd=function(t,e){var i=t._gsap||Vr(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"?xo:n):(n===xo&&!t.offsetParent&&t!==Gs&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,Gs.appendChild(t)),n=oy(t),h?s.display=h:vo(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):Gs.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},bd=function(t,e,i,s,n,o){var a=t._gsap,h=n||xd(t,!0),l=a.xOrigin||0,u=a.yOrigin||0,c=a.xOffset||0,d=a.yOffset||0,f=h[0],m=h[1],p=h[2],g=h[3],_=h[4],v=h[5],y=e.split(" "),x=parseFloat(y[0])||0,b=parseFloat(y[1])||0,S,A,T,w;i?h!==xo&&(A=f*g-m*p)&&(T=x*(g/A)+b*(-p/A)+(p*v-g*_)/A,w=x*(-m/A)+b*(f/A)-(f*v-m*_)/A,x=T,b=w):(S=ty(t),x=S.x+(~y[0].indexOf("%")?x/100*S.width:x),b=S.y+(~(y[1]||y[0]).indexOf("%")?b/100*S.height:b)),s||s!==!1&&a.smooth?(_=x-l,v=b-u,a.xOffset=c+(_*f+v*p)-_,a.yOffset=d+(_*m+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=x,a.yOrigin=b,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Qe]="0px 0px",o&&(cr(o,a,"xOrigin",l,x),cr(o,a,"yOrigin",u,b),cr(o,a,"xOffset",c,a.xOffset),cr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",x+" "+b)},bo=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=vi(t,Qe)||"0",u,c,d,f,m,p,g,_,v,y,x,b,S,A,T,w,P,N,I,E,C,L,z,G,X,lt,F,O,tt,at,et,pt;return u=c=d=p=g=_=v=y=x=0,f=m=1,i.svg=!!(t.getCTM&&ey(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[wt]=(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[wt]!=="none"?h[wt]:"")),s.scale=s.rotate=s.translate="none"),A=xd(t,i.svg),i.svg&&(i.uncache?(X=t.getBBox(),l=i.xOrigin-X.x+"px "+(i.yOrigin-X.y)+"px",G=""):G=!e&&t.getAttribute("data-svg-origin"),bd(t,G||l,!!G||i.originIsAbsolute,i.smooth!==!1,A)),b=i.xOrigin||0,S=i.yOrigin||0,A!==xo&&(N=A[0],I=A[1],E=A[2],C=A[3],u=L=A[4],c=z=A[5],A.length===6?(f=Math.sqrt(N*N+I*I),m=Math.sqrt(C*C+E*E),p=N||I?$s(I,N)*Zr:0,v=E||C?$s(E,C)*Zr+p:0,v&&(m*=Math.abs(Math.cos(v*Hs))),i.svg&&(u-=b-(b*N+S*E),c-=S-(b*I+S*C))):(pt=A[6],at=A[7],F=A[8],O=A[9],tt=A[10],et=A[11],u=A[12],c=A[13],d=A[14],T=$s(pt,tt),g=T*Zr,T&&(w=Math.cos(-T),P=Math.sin(-T),G=L*w+F*P,X=z*w+O*P,lt=pt*w+tt*P,F=L*-P+F*w,O=z*-P+O*w,tt=pt*-P+tt*w,et=at*-P+et*w,L=G,z=X,pt=lt),T=$s(-E,tt),_=T*Zr,T&&(w=Math.cos(-T),P=Math.sin(-T),G=N*w-F*P,X=I*w-O*P,lt=E*w-tt*P,et=C*P+et*w,N=G,I=X,E=lt),T=$s(I,N),p=T*Zr,T&&(w=Math.cos(T),P=Math.sin(T),G=N*w+I*P,X=L*w+z*P,I=I*w-N*P,z=z*w-L*P,N=G,L=X),g&&Math.abs(g)+Math.abs(p)>359.9&&(g=p=0,_=180-_),f=Ct(Math.sqrt(N*N+I*I+E*E)),m=Ct(Math.sqrt(z*z+pt*pt)),T=$s(L,z),v=Math.abs(T)>2e-4?T*Zr:0,x=et?1/(et<0?-et:et):0),i.svg&&(G=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!ny(vi(t,wt)),G&&t.setAttribute("transform",G))),Math.abs(v)>90&&Math.abs(v)<270&&(n?(f*=-1,v+=p<=0?180:-180,p+=p<=0?180:-180):(m*=-1,v+=v<=0?180:-180)),e=e||i.uncache,i.x=u-((i.xPercent=u&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=c-((i.yPercent=c&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=Ct(f),i.scaleY=Ct(m),i.rotation=Ct(p)+a,i.rotationX=Ct(g)+a,i.rotationY=Ct(_)+a,i.skewX=v+a,i.skewY=y+a,i.transformPerspective=x+o,(i.zOrigin=parseFloat(l.split(" ")[2])||0)&&(s[Qe]=fh(l)),i.xOffset=i.yOffset=0,i.force3D=ye.force3D,i.renderTransform=i.svg?kR:Z0?ay:LR,i.uncache=0,i},fh=function(t){return(t=t.split(" "))[0]+" "+t[1]},wd=function(t,e,i){var s=te(e);return Ct(parseFloat(e)+parseFloat(dr(t,"x",i+"px",s)))+s},LR=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ay(t,e)},Jr="0deg",wo="0px",Qr=") ",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,u=i.rotationY,c=i.rotationX,d=i.skewX,f=i.skewY,m=i.scaleX,p=i.scaleY,g=i.transformPerspective,_=i.force3D,v=i.target,y=i.zOrigin,x="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Jr||u!==Jr)){var S=parseFloat(u)*Hs,A=Math.sin(S),T=Math.cos(S),w;S=parseFloat(c)*Hs,w=Math.cos(S),o=wd(v,o,A*w*-y),a=wd(v,a,-Math.sin(S)*-y),h=wd(v,h,T*w*-y+y)}g!==wo&&(x+="perspective("+g+Qr),(s||n)&&(x+="translate("+s+"%, "+n+"%) "),(b||o!==wo||a!==wo||h!==wo)&&(x+=h!==wo||b?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Qr),l!==Jr&&(x+="rotate("+l+Qr),u!==Jr&&(x+="rotateY("+u+Qr),c!==Jr&&(x+="rotateX("+c+Qr),(d!==Jr||f!==Jr)&&(x+="skew("+d+", "+f+Qr),(m!==1||p!==1)&&(x+="scale("+m+", "+p+Qr),v.style[wt]=x||"translate(0, 0)"},kR=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,u=i.skewY,c=i.scaleX,d=i.scaleY,f=i.target,m=i.xOrigin,p=i.yOrigin,g=i.xOffset,_=i.yOffset,v=i.forceCSS,y=parseFloat(o),x=parseFloat(a),b,S,A,T,w;h=parseFloat(h),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,h+=u),h||l?(h*=Hs,l*=Hs,b=Math.cos(h)*c,S=Math.sin(h)*c,A=Math.sin(h-l)*-d,T=Math.cos(h-l)*d,l&&(u*=Hs,w=Math.tan(l-u),w=Math.sqrt(1+w*w),A*=w,T*=w,u&&(w=Math.tan(u),w=Math.sqrt(1+w*w),b*=w,S*=w)),b=Ct(b),S=Ct(S),A=Ct(A),T=Ct(T)):(b=c,T=d,S=A=0),(y&&!~(o+"").indexOf("px")||x&&!~(a+"").indexOf("px"))&&(y=dr(f,"x",o,"px"),x=dr(f,"y",a,"px")),(m||p||g||_)&&(y=Ct(y+m-(m*b+p*A)+g),x=Ct(x+p-(m*S+p*T)+_)),(s||n)&&(w=f.getBBox(),y=Ct(y+s/100*w.width),x=Ct(x+n/100*w.height)),w="matrix("+b+","+S+","+A+","+T+","+y+","+x+")",f.setAttribute("transform",w),v&&(f.style[wt]=w)},NR=function(t,e,i,s,n){var o=360,a=Ht(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?Zr:1),l=h-s,u=s+l+"deg",c,d;return a&&(c=n.split("_")[1],c==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),c==="cw"&&l<0?l=(l+o*X0)%o-~~(l/o)*o:c==="ccw"&&l>0&&(l=(l-o*X0)%o-~~(l/o)*o)),t._pt=d=new ue(t._pt,e,i,s,l,bR),d.e=u,d.u="deg",t._props.push(i),d},hy=function(t,e){for(var i in e)t[i]=e[i];return t},UR=function(t,e,i){var s=hy({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,u,c,d,f,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[wt]=e,a=bo(i,1),vo(i,wt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[wt],o[wt]=e,a=bo(i,1),o[wt]=l);for(h in $i)l=s[h],u=a[h],l!==u&&n.indexOf(h)<0&&(f=te(l),m=te(u),c=f!==m?dr(i,h,l,m):parseFloat(l),d=parseFloat(u),t._pt=new ue(t._pt,a,h,c,d-c,gd),t._pt.u=m||0,t._props.push(h));hy(a,s)};he("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});dh[t>1?"border"+r:r]=function(a,h,l,u,c){var d,f;if(arguments.length<4)return d=o.map(function(m){return zi(a,m,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},o.forEach(function(m,p){return f[m]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,c)}});var ly={name:"css",register:yd,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,u,c,d,f,m,p,g,_,v,y,x,b,S,A,T;fd||yd(),this.styles=this.styles||K0(t),T=this.styles.props,this.tween=i;for(p in e)if(p!=="autoRound"&&(u=e[p],!(xe[p]&&O0(p,e,i,s,t,n)))){if(f=typeof u,m=dh[p],f==="function"&&(u=u.call(i,s,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=fo(u)),m)m(this,t,p,u,i)&&(A=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),u+="",hr.lastIndex=0,hr.test(l)||(g=te(l),_=te(u)),_?g!==_&&(l=dr(t,p,l,_)+_):g&&(u+=g),this.add(a,"setProperty",l,u,s,n,0,0,p),o.push(p),T.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],Ht(l)&&~l.indexOf("random(")&&(l=fo(l)),te(l+"")||(l+=ye.units[p]||te(zi(t,p))||""),(l+"").charAt(1)==="="&&(l=zi(t,p))):l=zi(t,p),d=parseFloat(l),v=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),v&&(u=u.substr(2)),c=parseFloat(u),p in yi&&(p==="autoAlpha"&&(d===1&&zi(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,a.visibility),cr(this,a,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),p!=="scale"&&p!=="transform"&&(p=yi[p],~p.indexOf(",")&&(p=p.split(",")[0]))),y=p in $i,y){if(this.styles.save(p),x||(b=t._gsap,b.renderTransform&&!e.parseTransform||bo(t,e.parseTransform),S=e.smoothOrigin!==!1&&b.smooth,x=this._pt=new ue(this._pt,a,wt,0,1,b.renderTransform,b,0,-1),x.dep=1),p==="scale")this._pt=new ue(this._pt,b,"scaleY",b.scaleY,(v?Os(b.scaleY,v+c):c)-b.scaleY||0,gd),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){T.push(Qe,0,a[Qe]),u=FR(u),b.svg?bd(t,u,0,S,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&cr(this,b,"zOrigin",b.zOrigin,_),cr(this,a,p,fh(l),fh(u)));continue}else if(p==="svgOrigin"){bd(t,u,1,S,0,this);continue}else if(p in sy){NR(this,b,p,d,v?Os(d,v+u):u);continue}else if(p==="smoothOrigin"){cr(this,b,"smooth",b.smooth,u);continue}else if(p==="force3D"){b[p]=u;continue}else if(p==="transform"){UR(this,u,t);continue}}else p in a||(p=zs(p)||p);if(y||(c||c===0)&&(d||d===0)&&!xR.test(u)&&p in a)g=(l+"").substr((d+"").length),c||(c=0),_=te(u)||(p in ye.units?ye.units[p]:g),g!==_&&(d=dr(t,p,l,_)),this._pt=new ue(this._pt,y?b:a,p,d,(v?Os(d,v+c):c)-d,!y&&(_==="px"||p==="zIndex")&&e.autoRound!==!1?TR:gd),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=wR);else if(p in a)BR.call(this,t,p,l,v?v+u:u);else if(p in t)this.add(t,p,l||t[p],v?v+u:u,s,n);else if(p!=="parseTransform"){Vc(p,u);continue}y||(p in a?T.push(p,0,a[p]):T.push(p,1,l||t[p])),o.push(p)}}A&&H0(this)},render:function(t,e){if(e.tween._time||!pd())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:zi,aliases:yi,getSetter:function(t,e,i){var s=yi[e];return s&&s.indexOf(",")<0&&(e=s),e in $i&&e!==Qe&&(t._gsap.x||zi(t,"x"))?i&&W0===i?e==="scale"?CR:SR:(W0=i||{})&&(e==="scale"?PR:IR):t.style&&!Nc(t.style[e])?AR:~e.indexOf("-")?ER:hd(t,e)},core:{_removeProperty:vo,_getMatrix:xd}};ce.utils.checkPrefix=zs,ce.core.getStyleSaver=K0,function(r,t,e,i){var s=he(r+","+t+","+e,function(n){$i[n]=1});he(t,function(n){ye.units[n]="deg",sy[n]=1}),yi[s[13]]=r+","+t,he(i,function(n){var o=n.split(":");yi[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"),he("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){ye.units[r]="px"}),ce.registerPlugin(ly);var Vs=ce.registerPlugin(ly)||ce;Vs.core.Tween;/*! * PixiPlugin 3.12.2 * https://greensock.com * * @license Copyright 2008-2023, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var fr,uy,ph,we,To,cy,Td,dy=function(){return typeof window<"u"},fy=function(){return fr||dy()&&(fr=window.gsap)&&fr.registerPlugin&&fr},Ad=function(t){return typeof t=="function"},py=function(t){return console.warn(t)},GR=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Ne=.212671,Ue=.71516,Ge=.072169,my=function(t){return Ad(we[t])?we[t]:we.filters[t]},mh=function(t,e){var i=[],s=0,n=0,o,a;for(o=0;o<4;o++){for(a=0;a<5;a++)n=a===4?t[s+4]:0,i[s+a]=t[s]*e[a]+t[s+1]*e[a+5]+t[s+2]*e[a+10]+t[s+3]*e[a+15]+n;s+=5}return i},gy=function(t,e){var i=1-e,s=i*Ne,n=i*Ue,o=i*Ge;return mh([s+e,n,o,0,0,s,n+e,o,0,0,s,n,o+e,0,0,0,0,0,1,0],t)},_y=function(t,e,i){var s=ph(e),n=s[0]/255,o=s[1]/255,a=s[2]/255,h=1-i;return mh([h+i*n*Ne,i*n*Ue,i*n*Ge,0,0,i*o*Ne,h+i*o*Ue,i*o*Ge,0,0,i*a*Ne,i*a*Ue,h+i*a*Ge,0,0,0,0,0,1,0],t)},yy=function(t,e){e*=Math.PI/180;var i=Math.cos(e),s=Math.sin(e);return mh([Ne+i*(1-Ne)+s*-Ne,Ue+i*-Ue+s*-Ue,Ge+i*-Ge+s*(1-Ge),0,0,Ne+i*-Ne+s*.143,Ue+i*(1-Ue)+s*.14,Ge+i*-Ge+s*-.283,0,0,Ne+i*-Ne+s*-(1-Ne),Ue+i*-Ue+s*Ue,Ge+i*(1-Ge)+s*Ge,0,0,0,0,0,1,0,0,0,0,0,1],t)},vy=function(t,e){return mh([e,0,0,0,.5*(1-e),0,e,0,0,.5*(1-e),0,0,e,0,.5*(1-e),0,0,0,1,0],t)},xy=function(t,e){var i=my(e),s=t.filters||[],n=s.length,o;for(i||py(e+" not found. PixiPlugin.registerPIXI(PIXI)");--n>-1;)if(s[n]instanceof i)return s[n];return o=new i,e==="BlurFilter"&&(o.blur=0),s.push(o),t.filters=s,o},$t=function(t,e,i,s){e.add(i,t,i[t],s[t]),e._props.push(t)},by=function(t,e){var i=my("ColorMatrixFilter"),s=new i;return s.matrix=e,s.brightness(t,!0),s.matrix},HR=function(t){var e={},i;for(i in t)e[i]=t[i];return e},Te={contrast:1,saturation:1,colorizeAmount:0,colorize:"rgb(255,255,255)",hue:0,brightness:1},$R=function(t,e,i){var s=xy(t,"ColorMatrixFilter"),n=t._gsColorMatrixFilter=t._gsColorMatrixFilter||HR(Te),o=e.combineCMF&&!("colorMatrixFilter"in e&&!e.colorMatrixFilter),a,h,l;for(l=s.matrix,e.resolution&&(s.resolution=e.resolution),e.matrix&&e.matrix.length===l.length?(h=e.matrix,n.contrast!==1&&$t("contrast",i,n,Te),n.hue&&$t("hue",i,n,Te),n.brightness!==1&&$t("brightness",i,n,Te),n.colorizeAmount&&($t("colorize",i,n,Te),$t("colorizeAmount",i,n,Te)),n.saturation!==1&&$t("saturation",i,n,Te)):(h=GR.slice(),e.contrast!=null?(h=vy(h,+e.contrast),$t("contrast",i,n,e)):n.contrast!==1&&(o?h=vy(h,n.contrast):$t("contrast",i,n,Te)),e.hue!=null?(h=yy(h,+e.hue),$t("hue",i,n,e)):n.hue&&(o?h=yy(h,n.hue):$t("hue",i,n,Te)),e.brightness!=null?(h=by(+e.brightness,h),$t("brightness",i,n,e)):n.brightness!==1&&(o?h=by(n.brightness,h):$t("brightness",i,n,Te)),e.colorize!=null?(e.colorizeAmount="colorizeAmount"in e?+e.colorizeAmount:1,h=_y(h,e.colorize,e.colorizeAmount),$t("colorize",i,n,e),$t("colorizeAmount",i,n,e)):n.colorizeAmount&&(o?h=_y(h,n.colorize,n.colorizeAmount):($t("colorize",i,n,Te),$t("colorizeAmount",i,n,Te))),e.saturation!=null?(h=gy(h,+e.saturation),$t("saturation",i,n,e)):n.saturation!==1&&(o?h=gy(h,n.saturation):$t("saturation",i,n,Te))),a=h.length;--a>-1;)h[a]!==l[a]&&i.add(l,a,l[a],h[a],"colorMatrixFilter");i._props.push("colorMatrixFilter")},zR=function(t,e){var i=e.t,s=e.p,n=e.color,o=e.set;o(i,s,n[0]<<16|n[1]<<8|n[2])},VR=function(t,e){var i=e.g;i&&(i.dirty++,i.clearDirty++)},WR=function(t,e){e.t.visible=!!e.t.alpha},wy=function(t,e,i,s){var n=t[e],o=ph(Ad(n)?t[e.indexOf("set")||!Ad(t["get"+e.substr(3)])?e:"get"+e.substr(3)]():n),a=ph(i);s._pt=new To(s._pt,t,e,0,0,zR,{t,p:e,color:o,set:cy(t,e)}),s.add(o,0,o[0],a[0]),s.add(o,1,o[1],a[1]),s.add(o,2,o[2],a[2])},XR={tint:1,lineColor:1,fillColor:1},Ty="position,scale,skew,pivot,anchor,tilePosition,tileScale".split(","),Ed={x:"position",y:"position",tileX:"tilePosition",tileY:"tilePosition"},jR={colorMatrixFilter:1,saturation:1,contrast:1,hue:1,colorize:1,colorizeAmount:1,brightness:1,combineCMF:1},gh=Math.PI/180,Ay=function(t){return typeof t=="string"},YR=function(t){return Ay(t)&&t.charAt(1)==="="?t.substr(0,2)+parseFloat(t.substr(2))*gh:t*gh},qR=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e5)/1e5,e)},KR=function(t,e,i,s,n,o){var a=360*(o?gh:1),h=Ay(n),l=h&&n.charAt(1)==="="?+(n.charAt(0)+"1"):0,u=parseFloat(l?n.substr(2):n)*(o?gh:1),c=l?u*l:u-s,d=s+c,f,m;return h&&(f=n.split("_")[1],f==="short"&&(c%=a,c!==c%(a/2)&&(c+=c<0?a:-a)),f==="cw"&&c<0?c=(c+a*1e10)%a-~~(c/a)*a:f==="ccw"&&c>0&&(c=(c-a*1e10)%a-~~(c/a)*a)),t._pt=m=new To(t._pt,e,i,s,c,qR),m.e=d,m},Ey=function(){dy()&&(uy=window,fr=fy(),we=we||uy.PIXI,Td=we&&we.VERSION&&we.VERSION.charAt(0)==="4",ph=function(e){return fr.utils.splitColor((e+"").substr(0,2)==="0x"?"#"+e.substr(2):e)})},_h,Ao;for(_h=0;_h-1;)t.filters[f].padding=Math.max(t.filters[f].padding,d)}else if(XR[c])if((c==="lineColor"||c==="fillColor")&&t instanceof we.Graphics)for(m=(t.geometry||t).graphicsData,this._pt=new To(this._pt,t,c,0,0,VR,{g:t.geometry||t}),f=m.length;--f>-1;)wy(Td?m[f]:m[f][c.substr(0,4)+"Style"],Td?c:"color",h,this);else wy(t,c,h,this);else c==="autoAlpha"?(this._pt=new To(this._pt,t,"visible",0,0,WR),this.add(t,"alpha",t.alpha,h),this._props.push("alpha","visible")):c!=="resolution"&&this.add(t,c,"get",h);this._props.push(c)}}};fy()&&fr.registerPlugin(Sd);const ZR={version:"3.12.2",name:"text",init(r,t,e){typeof t!="object"&&(t={value:t});let i=t.value;this.target=r,i=i.split(""),this.from=e._from,this.text=i,this._props.push("text")},render(r,t){r>1?r=1:r<0&&(r=0),t.from&&(r=1-r);const{text:e,target:i}=t,s=e.length,n=r*s+.5|0;i.text=e.slice(0,n).join("")}};Vs.config({units:{time:"ms"}}),Vs.registerPlugin(ZR),Vs.registerPlugin(Sd),Sd.registerPIXI(oA);const JR={get In(){return[{pixi:{alpha:0}},{pixi:{alpha:1},duration:1}]},get Out(){return[{pixi:{alpha:1}},{pixi:{alpha:0},duration:1}]},get FadeOut(){return[{pixi:{alpha:1}},{pixi:{alpha:0},duration:500}]},get FadeIn(){return[{pixi:{alpha:0}},{pixi:{alpha:1},duration:500}]},get ShakeX(){return[{},{keyframes:{"0%":{},"10%":{x:"-=10%"},"20%":{x:"+=10%"},"30%":{x:"-=10%"},"40%":{x:"+=10%"},"50%":{x:"-=10%"},"60%":{x:"+=10%"},"70%":{x:"-=10%"},"80%":{x:"+=10%"},"90%":{x:"-=10%"},"100%":{x:"+=10%"}},duration:1e3}]},get ShakeY(){return[{},{keyframes:{"0%":{},"10%":{y:"-=10%"},"20%":{y:"+=10%"},"30%":{y:"-=10%"},"40%":{y:"+=10%"},"50%":{y:"-=10%"},"60%":{y:"+=10%"},"70%":{y:"-=10%"},"80%":{y:"+=10%"},"90%":{y:"-=10%"},"100%":{y:"+=10%"}},duration:1e3}]},get ZoomIn(){return[{pixi:{alpha:0,scale:.7}},{pixi:{alpha:1,scale:1},duration:1e3}]},get ZoomOut(){return[{pixi:{alpha:1,scale:1}},{pixi:{alpha:0,scale:.7},duration:1e3}]},get EnterFromLeft(){return[{pixi:{alpha:0}},{pixi:{alpha:1},keyframes:{"0%":{x:"-=100%"},"100%":{x:"+=100%"}},duration:500}]},get EnterFromRight(){return[{pixi:{alpha:0}},{pixi:{alpha:1},keyframes:{"0%":{x:"+=100%"},"100%":{x:"-=100%"}},duration:500}]},get EnterFromBottom(){return[{pixi:{alpha:0}},{pixi:{alpha:1},keyframes:{"0%":{y:"+=100%"},"100%":{y:"-=100%"}},duration:500}]},get EnterFromTop(){return[{pixi:{alpha:0}},{pixi:{alpha:1},keyframes:{"0%":{y:"-=100%"},"100%":{y:"+=100%"}},duration:500}]},get ExitFromLeft(){return[{pixi:{alpha:1}},{pixi:{alpha:0},keyframes:{"50%":{x:"-=50%"},"100%":{x:"-=100%"}},duration:500}]},get ExitFromRight(){return[{pixi:{alpha:1}},{pixi:{alpha:0},keyframes:{"50%":{x:"+=50%"},"100%":{x:"+=100%"}},duration:500}]},get ExitFromBottom(){return[{pixi:{alpha:1}},{pixi:{alpha:0},keyframes:{"50%":{y:"+=50%"},"100%":{y:"+=100%"}},duration:500}]},get ExitFromTop(){return[{pixi:{alpha:1}},{pixi:{alpha:0},keyframes:{"50%":{y:"-=50%"},"100%":{y:"-=100%"}},duration:500}]}};class Sy{constructor(t){M(this,"name");M(this,"start");M(this,"duration");this.name="",this.start=t.start??0,this.duration=t.duration??0}async tick(t,e){}}class yh extends Sy{constructor(){super(...arguments);M(this,"name","FadeIn")}async tick(e,i){i.currentStage&&(e>=this.start&&e<=this.start+this.duration?i.currentStage.alpha=(e-this.start)/this.duration:i.currentStage.alpha=1)}toJSON(){return{__type:"FadeInTransition",start:this.start,duration:this.duration}}static fromJSON(e){return new yh({start:e.start,duration:e.duration})}}class Eo extends se{constructor(e){super();M(this,"uuid");M(this,"name");M(this,"options");M(this,"start");M(this,"duration");M(this,"sounds");M(this,"transitions");M(this,"type");M(this,"animationLine");this.options=e,this.uuid=Es(),this.name=(e==null?void 0:e.name)??"",this.start=(e==null?void 0:e.start)??0,this.duration=(e==null?void 0:e.duration)??0,this.sounds=[],this.transitions=[],this.type="",globalThis.__PIXI_STAGE__=this}addSound(e){this.sounds.push(e)}removeSound(e){this.sounds=this.sounds.filter(i=>i.uuid===e.uuid?(e.destroy(),!1):!0)}addTransition(e){this.transitions.push(e)}removeTransition(e){this.transitions=this.transitions.filter(i=>i!==e)}addFilter(e){this.filters?this.filters.push(e):this.filters=[e]}removeFilter(e){this.filters&&(this.filters=this.filters.filter(i=>i!==e))}setDuration(e){this.duration=e}setChildToTop(e){this.setChildIndex(e,this.children.length-1)}setChildToBottom(e){this.setChildIndex(e,0)}setChildUp(e){const i=this.children.indexOf(e);i0&&this.swapChildren(e,this.children[i-1])}cloneFrom(e){var i;this.name=e.name,this.start=e.start,this.duration=e.duration,this.type=e.type,this.sounds=Ui(e.sounds),this.transitions=Ui(e.transitions),this.filters=((i=e.filters)==null?void 0:i.map(s=>s.cloneSelf()))||null,e.children.map(s=>s.cloneSelf()).forEach(s=>{this.addChild(s)})}clone(){var i;const e=new Eo({name:this.name,start:this.start,duration:this.duration});return e.type=this.type,e.sounds=Ui(this.sounds),e.transitions=Ui(this.transitions),e.filters=((i=this.filters)==null?void 0:i.map(s=>s.cloneSelf()))||null,this.children.map(s=>s.cloneSelf()).forEach(s=>{e.addChild(s)}),e}toJSON(){return{__type:"Scene",type:this.type,uuid:this.uuid,name:this.name,start:this.start,duration:this.duration,sounds:this.sounds,transitions:this.transitions,children:this.children.filter(e=>!e.wireframe),filters:this.filters}}static async fromJSON(e,i){const s=i??new Eo,n={Text:Ms,Img:sr,Graphics:Ds},o={FadeInTransition:yh};s.type=e.type,s.duration=e.duration,s.uuid=e.uuid,s.name=e.name,s.start=e.start;const a=[];for(let u=0;u0&&s.addChild(...l),s}async loadResource(){const e=async i=>{if(typeof i.load=="function"&&await i.load(),i.children&&i.children.length>0)for(const s of i.children)await e(s)};for(const i of this.children)await e(i);for(const i of this.sounds)await i.load()}loadAnimation(){this.animationLine=Vs.timeline({paused:!0});const e=async i=>{var s;if(i.animationParams){const n=Vs.timeline();for(let o=0;o0)for(const n of i.children)e(n)};for(const i of this.children)e(i)}seek(e){var i;(i=this.animationLine)==null||i.seek(e)}async tick(e,i){if(e>=this.start&&e<=this.start+this.duration){i.currentStage=this;const s=e-this.start;this.seek(s);for(const n of this.sounds)await n.tick(s,i);for(const n of this.transitions)await n.tick(s,i)}else i.previewerAudioContext&&i.previewerAudioBufferSourceNodes&&this.sounds.forEach(s=>{var o;const n=(o=i.previewerAudioBufferSourceNodes)==null?void 0:o.find(a=>a.buffer===s.buffer);n&&n.stop()})}}class vh{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._hull=[new B,new B,new B,new B],this.currentID=-1,this.dirtyID=0}get x(){return this._x}set x(t){this._x=t,this.dirtyID++}get y(){return this._y}set y(t){this._y=t,this.dirtyID++}get width(){return this._width}set width(t){this._width=t,this.dirtyID++}get height(){return this._height}set height(t){this._height=t,this.dirtyID++}get hull(){return this.isDirty()&&this.update(),this._hull}get topLeft(){return this.isDirty()&&this.update(),this._hull[0]}get topRight(){return this.isDirty()&&this.update(),this._hull[1]}get bottomRight(){return this.isDirty()&&this.update(),this._hull[2]}get bottomLeft(){return this.isDirty()&&this.update(),this._hull[3]}isDirty(){return this.currentID!==this.dirtyID}update(){const[t,e,i,s]=this._hull;t.set(this._x,this._y),e.set(this._x+this._width,this._y),i.set(this._x+this._width,this._y+this._height),s.set(this._x,this._y+this._height)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}clone(){return new vh(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.y&&e0?this._freeList[--this._freeCount]:this.create()}allocateArray(t){let e,i;Array.isArray(t)?(e=t,i=t.length):(i=t,e=new Array(i)),this._borrowRate+=i,this._flowRate+=i;let s=0;if(this._freeCount>0){const n=this._freeList,o=Math.min(this._freeCount,i);let a=this._freeCount;for(let h=0;hthis.capacity&&(this.capacity=Math.max(this.capacity*this._capacityRatio,this._freeCount+t.length));for(let e=0,i=t.length;et){this.capacity>t*this._capacityRatio&&(this.capacity=t*this._capacityRatio);const i=Math.min(this._freeCount,this.capacity);for(let s=t;s{this._borrowRateAverage=this._borrowRateAverageProvider.next(this._borrowRate),this._marginAverage=this._marginAverageProvider.next(this._freeCount-this._borrowRate);const t=this._borrowRateAverageProvider.absDev();this._flowRate=0,this._borrowRate=0,this._returnRate=0;const e=this._freeCount,i=this._freeList.length;if(e<128&&this._borrowRateAverage<128&&i<128)return;const s=Math.max(this._borrowRateAverage*(this._capacityRatio-1),this._reserveCount);if(this._freeCount>s+t){const n=s+t;this.capacity=Math.min(this._freeList.length,Math.ceil(n)),this._freeCount=this._freeList.length}}}}var Cd;const Iy=new Map;class Ry{static build(t){let e=Iy.get(t);return e||(e=new class extends bh{create(){return new t}},Iy.set(t,e),e)}static buildFunctional(t){return new(Cd=class extends bh{constructor(...i){super(...i),Cd.prototype.__init.call(this)}__init(){this.create=t}},Cd)}}const My={color:16777215,outlineColor:0,outlineThickness:1,radius:8,shape:"tooth"},QR=ci;class tM extends QR{constructor(t,e,i={},s,n,o){super(),this.transformer=t;const a=Object.assign({},My,i);this._handle=e,this._style=a,this.onHandleDelta=s,this.onHandleCommit=n,this._dirty=!0,this.interactive=!0,this.cursor=o||"move",this._pointerDown=!1,this._pointerDragging=!1,this._pointerPosition=new B,this._pointerMoveTarget=null,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onpointerdown=this.onPointerDown,this.onpointermove=this.onPointerMove,this.onpointerup=this.onPointerUp,this.onpointerupoutside=this.onPointerUp}get handle(){return this._handle}set handle(t){this._handle=t,this._dirty=!0}get style(){return this._style}set style(t){this._style=Object.assign({},My,t),this._dirty=!0}render(t){this._dirty&&(this.draw(),this._dirty=!1),super.render(t)}draw(){const t=this._handle,e=this._style,i=e.radius;if(this.clear().lineStyle(e.outlineThickness,e.outlineColor).beginFill(e.color),e.shape==="square")this.drawRect(-i/2,-i/2,i,i);else if(e.shape==="tooth")switch(t){case"middleLeft":this.drawPolygon([-i/2,-i/2,-i/2,i/2,i/2,i/2,i*1.1,0,i/2,-i/2]);break;case"topCenter":this.drawPolygon([-i/2,-i/2,i/2,-i/2,i/2,i/2,0,i*1.1,-i/2,i/2]);break;case"middleRight":this.drawPolygon([-i/2,i/2,-i*1.1,0,-i/2,-i/2,i/2,-i/2,i/2,i/2]);break;case"bottomCenter":this.drawPolygon([0,-i*1.1,i/2,-i/2,i/2,i/2,-i/2,i/2,-i/2,-i/2]);break;case"rotator":this.drawCircle(0,0,i/Math.sqrt(2));break;default:this.drawRect(-i/2,-i/2,i,i);break}else this.drawCircle(0,0,i);this.endFill()}onPointerDown(t){this._pointerDown=!0,this._pointerDragging=!1,t.stopPropagation(),this._pointerMoveTarget&&(this._pointerMoveTarget.removeEventListener("globalpointermove",this.onPointerMove),this._pointerMoveTarget=null),this._pointerMoveTarget=this.transformer.stage||this,this._pointerMoveTarget.addEventListener("globalpointermove",this.onPointerMove)}onPointerMove(t){this._pointerDown&&(this._pointerDragging?this.onDrag(t):this.onDragStart(t),t.stopPropagation())}onPointerUp(t){this._pointerDragging&&this.onDragEnd(t),this._pointerDown=!1,this._pointerMoveTarget&&(this._pointerMoveTarget.removeEventListener("globalpointermove",this.onPointerMove),this._pointerMoveTarget=null)}onDragStart(t){this._pointerPosition.copyFrom(t.data.global),this._pointerDragging=!0}onDrag(t){const e=t.data.global;this.onHandleDelta&&this.onHandleDelta(e),this._pointerPosition.copyFrom(e)}onDragEnd(t){this._pointerDragging=!1,this.onHandleCommit&&this.onHandleCommit()}}function wh(r,t,e,i){const{x:s,y:n}=e,{x:o,y:a}=i;if(Math.abs(o-s)<.01)return Math.abs(r-s);if(Math.abs(a-n)<.01)return Math.abs(t-n);const h=(a-n)/(o-s);return Math.abs((h*r-t+(a-h*o))/Math.sqrt(h*h+1))}const Dy=Ry.build(B),eM=[new B,new B,new B,new B],iM=new rt,Ws=new B,rM=[0,0,0,1,-1,1,-1,-1,1,-1,1,0],sM=[0,0,-1,0,-1,-1,1,-1,1,1,0,1],nM=[0,0,1,0,1,1,-1,1,-1,-1,0,-1],oM=[0,0,0,-1,1,-1,1,1,-1,1,-1,0],Pd=new Array(12),aM=[rM,sM,nM,oM],hM=ci;class lM extends hM{constructor(t){super(),this.transformer=t,this.boxScalingHandles=[this.addChild(new ci),this.addChild(new ci),this.addChild(new ci),this.addChild(new ci)],this.boxScalingHandles.forEach(e=>{e.interactive=!0}),this.boxScalingHandles[0].cursor=So.topCenter,this.boxScalingHandles[1].cursor=So.middleRight,this.boxScalingHandles[2].cursor=So.bottomCenter,this.boxScalingHandles[3].cursor=So.middleLeft}hitHandleType(t,e,i){const{boxRotationEnabled:s,boxRotationTolerance:n,boxScalingEnabled:o,boxScalingTolerance:a}=this.transformer,[h,l,u,c]=t.hull,{x:d,y:f}=e.applyInverse(i,Ws);if(o){const m=wh(d,f,h,l)*e.d,p=wh(d,f,h,c)*e.a,g=wh(d,f,l,u)*e.a,_=wh(d,f,c,u)*e.d,v=Math.min(m,p,g,_);if(v{this.projectToLocal(t.hull[o],n)}),t.innerBounds.pad(2.5*e);const s=Dy.allocateArray(4);s.forEach((n,o)=>{this.projectToLocal(t.hull[o],n)}),t.innerBounds.pad(-1.5*this.transformer.boxScalingTolerance);for(let n=0;n<4;n++){const o=i[n],a=i[(n+1)%4],h=s[n],l=s[(n+1)%4];this.boxScalingHandles[n].clear().beginFill(16777215,1e-4).drawPolygon(o,h,l,a).endFill()}}drawBoxRotationTolerance(){const{boxRotateTopLeft:t,boxRotateTopRight:e,boxRotateBottomLeft:i,boxRotateBottomRight:s}=this.transformer.handleAnchors,n=this.transformer.boxRotationTolerance*2,o=iM.identity().scale(n,n).rotate(this.transformer.getGroupBounds().rotation);for(let a=0;a<4;a++){const h=aM[a];let l;switch(a){case 0:l=t;break;case 1:l=e;break;case 2:l=i;break;case 3:l=s;break}for(let u=0;u{this.rotateGroup("rotator",a)},this.commitGroup))},n=Sh.reduce((a,h)=>{const l=new e(this,h,i,null,this.commitGroup,So[h]);return l.onHandleDelta=u=>{this.scaleGroup(l.handle,u)},l.visible=this._scaleEnabled,a[h]=l,this.addChild(a[h]),a},{}),o={skewHorizontal:this.addChild(new e(this,"skewHorizontal",i,a=>{this.skewGroup("skewHorizontal",a)},this.commitGroup,"pointer")),skewVertical:this.addChild(new e(this,"skewVertical",i,a=>{this.skewGroup("skewVertical",a)},this.commitGroup,"pointer"))};this.handles=Object.assign({},n,s,o),this.handles.middleCenter.visible=!1,this.handles.skewHorizontal.visible=this._skewEnabled,this.handles.skewVertical.visible=this._skewEnabled,this.handleAnchors={rotator:new B,boxRotateTopLeft:new B,boxRotateTopRight:new B,boxRotateBottomLeft:new B,boxRotateBottomRight:new B,topLeft:new B,topCenter:new B,topRight:new B,middleLeft:new B,middleCenter:new B,middleRight:new B,bottomLeft:new B,bottomCenter:new B,bottomRight:new B,skewHorizontal:new B,skewVertical:new B},this.groupBounds=new xh,this.updateGroupBounds(),this._pointerDown=!1,this._pointerDragging=!1,this._pointerPosition=new B,this._pointerMoveTarget=null,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointerupoutside",this.onPointerUp)}get enabledHandles(){return this._enabledHandles}set enabledHandles(t){!this._enabledHandles&&!t||(this._enabledHandles=t,pM.forEach(e=>{this.handles[e].visible=!1}),t?t.forEach(e=>{this.handles[e].visible=!0}):(this.handles.rotator.visible=this._rotateEnabled,this.handles.skewHorizontal.visible=this._skewEnabled,this.handles.skewVertical.visible=this._skewEnabled,Sh.forEach(e=>{e!=="middleCenter"&&(this.handles[e].visible=this._scaleEnabled)})))}get handleStyle(){return this._handleStyle}set handleStyle(t){const e=this.handles;for(const i in e)e[i].style=t;this._handleStyle=t}get rotateEnabled(){return this._rotateEnabled}set rotateEnabled(t){if(this._rotateEnabled!==t){if(this._rotateEnabled=t,this._enabledHandles)return;this.handles.rotator.visible=t}}get scaleEnabled(){return this._scaleEnabled}set scaleEnabled(t){if(this._scaleEnabled!==t){if(this._scaleEnabled=t,this._enabledHandles)return;Sh.forEach(e=>{e!=="middleCenter"&&(this.handles[e].visible=t)})}}get skewEnabled(){return this._skewEnabled}set skewEnabled(t){if(this._skewEnabled!==t){if(this._skewEnabled=t,this._enabledHandles)return;this.handles.skewHorizontal.visible=t,this.handles.skewVertical.visible=t}}get transformType(){return this._transformType}get wireframeStyle(){return this._wireframeStyle}set wireframeStyle(t){this._wireframeStyle=Object.assign({},Hy,t)}getGroupBounds(t=!1){return t&&this.updateGroupBounds(),this.groupBounds}__init(){this.translateGroup=t=>{this._transformHandle=null,this._transformType="translate";const e=Xs.identity().translate(t.x,t.y);this.prependTransform(e)}}__init2(){this.rotateGroup=(t,e)=>{this._transformHandle=t,this._transformType="rotate";const i=this.groupBounds,s=this.worldTransform.apply(this.handleAnchors[t],js);this.projectionTransform.applyInverse(s,s),e=this.projectionTransform.applyInverse(e,Ny);const n=i.center,o=Math.atan2(s.y-n.y,s.x-n.x);let h=Math.atan2(e.y-n.y,e.x-n.x)-o,l=this.groupBounds.rotation+h;l=this.snapAngle(l,this.rotationSnapTolerance,this.rotationSnaps),h=l-this.groupBounds.rotation;const u=Xs.identity().translate(-n.x,-n.y).rotate(h).translate(n.x,n.y);this.prependTransform(u,!0),this.updateGroupBounds(l),this._skewX+=h,this._skewY+=h}}__init3(){this.scaleGroup=(t,e)=>{this._transformHandle=t,this._transformType="scale";const i=Gy[t].x,s=Gy[t].y,n=this.handles,o=this.groupBounds,a=o.rotation,h=o.innerBounds,l=this.worldTransform.apply(this.handleAnchors[t],js);this.projectionTransform.applyInverse(l,l),e=this.projectionTransform.applyInverse(e,Ny);const u=e.x-l.x,c=e.y-l.y,d=(o.topRight.x-o.topLeft.x)/h.width,f=(o.topRight.y-o.topLeft.y)/h.width,m=(o.bottomLeft.x-o.topLeft.x)/h.height,p=(o.bottomLeft.y-o.topLeft.y)/h.height,g=u*d+c*f,_=u*m+c*p;let v=1+g*i/h.width,y=1+_*s/h.height;this.lockAspectRatio&&(t==="topLeft"||t==="topRight"||t==="bottomLeft"||t==="bottomRight")&&(v>y?y=v:v=y);const b=Xs.identity();if(i!==0&&v!==0){const S=this.centeredScaling?o.center:i===1?o.topLeft:o.topRight;b.translate(-S.x,-S.y).rotate(-a).scale(v,1).rotate(a).translate(S.x,S.y)}if(s!==0&&y!==0){const S=this.centeredScaling?o.center:s===1?o.topLeft:o.bottomLeft;b.translate(-S.x,-S.y).rotate(-a).scale(1,y).rotate(a).translate(S.x,S.y)}if((y<0||v<0)&&!(y<0&&v<0))switch(t){case"topLeft":case"bottomLeft":this.swapHandles(n.topLeft,n.bottomLeft);break;case"topCenter":case"bottomCenter":this.swapHandles(n.topCenter,n.bottomCenter);break;case"topRight":case"bottomRight":this.swapHandles(n.topRight,n.bottomRight);break}this.prependTransform(b)}}__init4(){this.skewGroup=(t,e)=>{this._transformHandle=t,this._transformType="skew";const i=this.groupBounds,s=js.copyFrom(e);this.projectionTransform.applyInverse(s,s);const n=i.center,o=Xs.identity().translate(-n.x,-n.y);let a=this.groupBounds.rotation;if(t==="skewHorizontal"){const h=this._skewX;this._skewX=Math.atan2(s.y-n.y,s.x-n.x),this._skewX=this.snapAngle(this._skewX,this.skewSnapTolerance,this.skewSnaps),o.prepend(Oy(-h)),o.prepend(Oy(this._skewX))}else{const h=this._skewY,l=Math.atan2(s.y-n.y,s.x-n.x)-Math.PI/2;this._skewY=l,this._skewY=this.snapAngle(this._skewY,this.skewSnapTolerance,this.skewSnaps),o.prepend(Fy(h)),o.prepend(Fy(-this._skewY)),a-=this._skewY-h}o.translate(n.x,n.y),this.prependTransform(o,!0),this.updateGroupBounds(a)}}__init5(){this.commitGroup=()=>{this._transformHandle=null,this._transformType="none",this.transientGroupTilt!==!1&&this.group.length>1&&this.updateGroupBounds(0),this.emit("transformcommit")}}render(t){this.renderable&&this.visible&&(!this.lazyMode||this.lazyDirty)&&this.draw(),super.render(t)}draw(){const t=this.group,{color:e,thickness:i}=this._wireframeStyle;this.wireframe.clear(),this.boundingBoxes!=="none"&&this.wireframe.lineStyle(i,e),this.translateEnabled&&this.wireframe.beginFill(16777215,1e-4);for(let n=0,o=t.length;nu?p:u,c=g>c?g:c}return Eh.releaseArray(o),i=i||new xh,i.innerBounds.x=h,i.innerBounds.y=l,i.innerBounds.width=u-h,i.innerBounds.height=c-l,i.rotation=e,a.applyInverse(i.center,js),i.center.copyFrom(js),i}}const Ch=class Ch{constructor(t){M(this,"container");M(this,"width");M(this,"height");M(this,"background");M(this,"app");M(this,"scenes");M(this,"activeScene");M(this,"activeChild");M(this,"activeTransformer");M(this,"onChangeActiveChild");M(this,"onChangeActiveScene");this.container=t.container,this.width=t.width??pc,this.height=t.height??mc,this.background=t.background??t_,this.onChangeActiveChild=t.onChangeActiveChild,this.onChangeActiveScene=t.onChangeActiveScene,this.app=new Su({view:this.container,width:this.width,height:this.height,background:this.background}),this.scenes=[]}addTransformer(){var t;this.activeTransformer=new Ae({wireframeStyle:{thickness:4,color:3394764}}).on("pointertap",()=>{this.activeTransformer&&(this.activeTransformer.__isTapped?(this.activeChild=void 0,this.activeTransformer.group=[],this.onChangeActiveChild&&this.onChangeActiveChild(void 0),this.activeTransformer.__doubleTapTimer&&clearTimeout(this.activeTransformer.__doubleTapTimer),this.activeTransformer.__isTapped=!1):(this.activeTransformer.__isTapped=!0,this.activeTransformer.__doubleTapTimer=setTimeout(()=>{this.activeTransformer.__isTapped=!1},600)))}),(t=this.activeScene)==null||t.addChild(this.activeTransformer)}removeTransformer(){var t;this.activeTransformer&&((t=this.activeScene)==null||t.removeChild(this.activeTransformer),this.activeTransformer.destroy(),this.activeTransformer=void 0)}addChildTransformListener(t){t.interactive=!0,t.on("pointerdown",()=>{this.setActiveChild(t)})}setActiveChild(t){this.activeChild=t,this.activeTransformer||this.addTransformer(),this.activeTransformer&&(this.activeTransformer.group=[t],this.moveChildToTop(this.activeTransformer)),this.onChangeActiveChild&&this.onChangeActiveChild(t)}removeChildTransformListener(t){t instanceof zr||t instanceof Ja||t.removeAllListeners("click")}addScene(t,e){typeof e>"u"?this.scenes.push(t):this.scenes.splice(e,0,t);const i=s=>{if(s.children&&s.children.length>0)for(const n of s.children)i(n);else this.addChildTransformListener(s)};for(const s of t.children)i(s)}loadScenes(t){t.forEach(e=>{this.addScene(e)})}removeScene(t){this.scenes.splice(this.scenes.indexOf(t),1),this.activeScene===t&&(this.stageRemoveChild(this.activeScene),this.activeScene.destroy(),this.activeScene=void 0)}removeSceneByIndex(t){this.removeScene(this.scenes[t])}cloneScene(t){this.removeTransformer();const e=t??this.activeScene;if(e)return e.clone()}cloneSceneByIndex(t){return this.cloneScene(this.scenes[t])}swapScene(t,e){[this.scenes[t],this.scenes[e]]=[this.scenes[e],this.scenes[t]]}renderScene(t){this.activeScene&&(this.stageRemoveChild(this.activeScene),this.removeTransformer()),this.activeScene=t,this.activeScene.loadResource(),this.addTransformer(),this.stageAddChild(t),this.onChangeActiveScene&&this.onChangeActiveScene(t)}renderSceneByIndex(t){this.renderScene(this.scenes[t])}addChild(t,e){const i=e??this.activeScene;i&&(this.addChildTransformListener(t),i.addChild(t))}removeChild(t,e){const i=e??this.activeScene;i&&(this.removeChildTransformListener(t),i.removeChild(t),t.destroy())}cloneChild(t){const e=t??this.activeChild;if(e){const i=e.cloneSelf();return i.uuid=Es(),i}}toggleChildInteractive(t){t.interactive=!t.interactive}swapChildren(t,e){var i;(i=this.activeScene)==null||i.swapChildren(t,e)}moveChildToTop(t){const e=t??this.activeChild;this.activeScene&&e&&this.activeScene.setChildIndex(e,this.activeScene.children.length-1)}moveChildToBottom(t){var i;const e=t??this.activeChild;this.activeScene&&e&&((i=this.activeScene)==null||i.setChildIndex(e,0))}moveUpChild(t){const e=t??this.activeChild;if(this.activeScene&&e){const i=this.activeScene.children.indexOf(e);i0&&this.swapChildren(e,this.activeScene.children[i-1])}}exportScenes(){this.removeTransformer(),console.time("export");const t=this.scenes.map(e=>e.clone());return console.timeEnd("export"),t}saveAsJSON(){return JSON.stringify({version:"1.0",scenes:this.scenes})}async loadFromJSON(t){const e=JSON.parse(t),i=[];for(let s=0;si.uuid===t.uuid);e&&this.app.stage.removeChild(e)}setChildPosition(t,e){const i=e??this.activeChild,s=this.height,n=this.width;if(i)switch(t){case"top":i.y=0;break;case"middle":i.y=s/2-i.height/2;break;case"bottom":i.y=s-i.height;break;case"left":i.x=0;break;case"center":i.x=n/2-i.width/2;break;case"right":i.x=n-i.width;break}}};M(Ch,"supportSceneTypes",{Scene:Eo});let Rd=Ch;ei.setLevel("ERROR"),Y.Assets=Rr,Y.Back=gR,Y.BlackMaskFilter=no,Y.BlurFilter=ro,Y.Bounce=_R,Y.Converter=qn,Y.Creator=mE,Y.Editor=Rd,Y.Elastic=mR,Y.FadeInTransition=yh,Y.Filter=Ja,Y.Graphics=Ds,Y.Img=sr,Y.NoiseFilter=so,Y.OldFilmFilter=oo,Y.PREST_ANIMATION=JR,Y.Power0=uR,Y.Power1=cR,Y.Power2=dR,Y.Power3=fR,Y.Power4=pR,Y.Scene=Eo,Y.Sound=zr,Y.Text=Ms,Y.Texture=U,Y.Transition=Sy,Y.VignetteFilter=ao,Y.canIUse=fE,Y.isEnvSupported=dE,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});