function GTM(bt){if(!bt)return console.warn("GTM id not defined!");window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":(new Date).getTime(),event:"gtm.js"});const Rt=document.createComment("Google Tag Manager"),Dt=document.createComment("End Google Tag Manager"),Pt=document.createElement("script");Pt.async=!0,Pt.src=`https://www.googletagmanager.com/gtm.js?id=${bt}&l=dataLayer`,document.body.appendChild(Rt),document.body.appendChild(Pt),document.body.appendChild(Dt);const ie=document.createComment("Google Tag Manager (noscript)"),Ee=document.createComment("End Google Tag Manager (noscript)"),er=document.createElement("noscript"),lr=document.createElement("iframe");lr.src=`https://www.googletagmanager.com/ns.html?id=${bt}`,lr.width="0",lr.height="0",lr.style.display="none",lr.style.visibility="hidden",er.appendChild(lr),document.body.insertBefore(Ee,document.body.firstChild),document.body.insertBefore(er,document.body.firstChild),document.body.insertBefore(ie,document.body.firstChild),Pt.onload=()=>{window.modi=window.modi||{},window.modi.signin&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"signin",...window.modi.signin})),window.addEventListener("modi:signin",pt=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"signin",...pt.detail})}),window.addEventListener("modi:signup",pt=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"signup",...pt.detail})}),window.addEventListener("modi:signout",pt=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"signout",...pt.detail})})}}function COMM100(bt,Rt){if(!bt)return console.warn("Comm100 Site ID not defined!");if(!Rt)return console.warn("Comm100 Plan ID not defined!");const Dt=document.createElement("div");Dt.id=`comm100-button-${Rt}`,document.body.appendChild(Dt),window.Comm100API=window.Comm100API||{},window.Comm100API.chat_buttons=window.Comm100API.chat_buttons||[],window.Comm100API.chat_buttons.push({code_plan:Rt,div_id:`comm100-button-${Rt}`}),window.Comm100API.site_id=bt,window.Comm100API.main_code_plan=Rt;const Pt=document.createElement("script");Pt.type="text/javascript",Pt.async=!0,Pt.src=`https://vue.comm100.com/livechat.ashx?siteId=${bt}`,document.body.appendChild(Pt),setTimeout(()=>{if(!window.Comm100API.loaded){const ie=Pt.cloneNode(!0);ie.src=`https://standby.comm100vue.com/livechat.ashx?siteId=${bt}`,document.body.appendChild(ie)}},5e3)}function APG(bt){if(!bt)return console.warn("APG License id not found!");const Rt=document.createElement("div");Rt.id=`apg-${bt}`,Rt.setAttribute("data-apg-seal-id",bt),Rt.setAttribute("data-apg-image-size","256"),Rt.setAttribute("data-apg-image-type","basic-light-large"),document.body.appendChild(Rt);const Dt=document.createElement("script");Dt.type="text/javascript",Dt.src=`https://${bt}.snippet.antillephone.com/apg-seal.js`,Dt.async=!0,Dt.onload=()=>{const Pt=`apg_${bt.replaceAll("-","_")}`;window[Pt]&&window[Pt].init()},document.body.appendChild(Dt)}function LiveChatInc(bt){if(!bt)return console.warn("LiveChatInc License ID not defined!");function Rt(Pt){return Dt._h?Dt._h.apply(null,Pt):Dt._q.push(Pt)}window.__lc=window.__lc||{},window.__lc.license=parseInt(bt),window.__lc.integration_name="manual_channels";const Dt={_q:[],_h:null,_v:"2.0",on:function(){Rt(["on",[].call(arguments)])},once:function(){Rt(["once",[].call(arguments)])},off:function(){Rt(["off",[].call(arguments)])},get:function(){if(!Dt._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return Rt(["get",[].call(arguments)])},call:function(){Rt(["call",[].call(arguments)])},init:function(){const Pt=document.createComment("Start of LiveChat (http://www.livechat.com) code"),ie=document.createComment("End of LiveChat code"),Ee=document.createElement("script");Ee.async=!0,Ee.type="text/javascript",Ee.src="https://cdn.livechatinc.com/tracking.js",document.head.appendChild(Pt),document.head.appendChild(Ee),document.head.appendChild(ie)}};window.__lc.asyncInit||(Dt.init(),window.LiveChatWidget=window.LiveChatWidget||Dt)}function SUPSIS(bt){if(!bt)return console.warn("SUPSIS Site Name not defined!");const Rt=document.createComment("Start of SUPSIS Embed Code"),Dt=document.createComment("End of SUPSIS Embed Code");window.supsis=window.supsis||function(){(window.supsis.q=window.supsis.q||[]).push(arguments)},window.supsis.l=+new Date;const Pt=document.createElement("script");Pt.src=`https://${bt}.visitor.supsis.live/static/js/loader.js`,Pt.type="text/javascript",Pt.async=!0,Pt.defer=!0,document.body.appendChild(Rt),document.body.appendChild(Pt),document.body.appendChild(Dt)}function InitSmartico(bt,Rt){if(!bt||!Rt)return void console.warn("Smartico label or brand not found!");const ie=document.createElement("script");ie.src="https://libs.smartico.ai/smartico.js",ie.onload=function(){_smartico.init(bt,{brand_key:Rt}),setTimeout(function(){!function Dt(){window.modi&&window.modi.signin&&(window._smartico_user_id=window.modi.signin.customerId,window._smartico_language=localStorage.getItem("Language"))}()},2e3),window.addEventListener("trackingDatas",function(Ee){setTimeout(function(){!function Pt(Ee){const er=Ee.detail;"userLoggedIn"===er.event?(window._smartico_user_id=er.data.customerId,window._smartico_language=localStorage.getItem("Language")):"userLoggedOut"===er.event&&(window._smartico_user_id=null,window._smartico_language=null)}(Ee)},1e3)})},document.head.appendChild(ie)}function LMT(bt,Rt,Dt,Pt){if(!bt||!Rt||!Dt)return console.warn("There are missing parameters!");var ie,Ee,lr,pt,Qr,xs,$,gi;ie=window,Ee=document,lr=Dt,Qr={language:bt},ie[pt="SIR"]||(gi=ie[pt]=function(){(ie[pt].q=ie[pt].q||[]).push(arguments)},gi.l=1*new Date,gi.o=Qr,xs=Ee.createElement("script"),$=Ee.getElementsByTagName("script")[0],xs.async=1,xs.src=lr,xs.setAttribute("n",pt),$.parentNode.insertBefore(xs,$)),SIR("addWidget","#sr-widget","match.lmtPlus",Object.assign({matchId:Rt},Pt))}!function(bt,Rt){"object"==typeof exports&&typeof module<"u"?Rt(exports):"function"==typeof define&&define.amd?define(["exports"],Rt):Rt((bt=typeof globalThis<"u"?globalThis:bt||self).AnimationsDriver={})}(this,function(bt){"use strict";var gi,r,Rt=Object.defineProperty,Dt=Object.defineProperties,Pt=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,lr=(r,t,e)=>t in r?Rt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pt=(r,t)=>{for(var e in t||(t={}))Ee.call(t,e)&&lr(r,e,t[e]);if(ie)for(var e of ie(t))er.call(t,e)&&lr(r,e,t[e]);return r},Qr=(r,t)=>Dt(r,Pt(t)),xs=(r,t)=>{var e={};for(var s in r)Ee.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(null!=r&&ie)for(var s of ie(r))t.indexOf(s)<0&&er.call(r,s)&&(e[s]=r[s]);return e},$=(r,t,e)=>new Promise((s,i)=>{var n=a=>{try{o(e.next(a))}catch(h){i(h)}},l=a=>{try{o(e.throw(a))}catch(h){i(h)}},o=a=>a.done?s(a.value):Promise.resolve(a.value).then(n,l);o((e=e.apply(r,t)).next())}),Xs=((r=Xs||{})[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r),pu=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(pu||{}),Do=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Do||{}),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||{}),hr=(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))(hr||{}),j=(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))(j||{}),yi=(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))(yi||{}),st=(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))(st||{}),J=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(J||{}),Ge=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Ge||{}),_s=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(_s||{}),rr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(rr||{}),Te=(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))(Te||{}),kr=(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))(kr||{}),No=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(No||{}),sr=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(sr||{}),ne=(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))(ne||{}),$t=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))($t||{}),Fr=(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))(Fr||{});const Z={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return null!=(r=document.baseURI)?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>(new DOMParser).parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Oo=/iPhone/i,mu=/iPod/i,gu=/iPad/i,yu=/\biOS-universal(?:.+)Mac\b/i,Bo=/\bAndroid(?:.+)Mobile\b/i,xu=/Android/i,xi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Gn=/Silk/i,Jr=/Windows Phone/i,_u=/\bWindows(?:.+)ARM\b/i,bu=/BlackBerry/i,vu=/BB10/i,wu=/Opera Mini/i,Eu=/\b(CriOS|Chrome)(?:.+)Mobile/i,Au=/Mobile(?:.+)Firefox\b/i,Tu=function(r){return typeof r<"u"&&"MacIntel"===r.platform&&"number"==typeof r.maxTouchPoints&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Su(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:"string"==typeof r?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),typeof(s=e.split("Twitter"))[1]<"u"&&(e=s[0]);var i=function gg(r){return function(t){return t.test(r)}}(e),n={apple:{phone:i(Oo)&&!i(Jr),ipod:i(mu),tablet:!i(Oo)&&(i(gu)||Tu(t))&&!i(Jr),universal:i(yu),device:(i(Oo)||i(mu)||i(gu)||i(yu)||Tu(t))&&!i(Jr)},amazon:{phone:i(xi),tablet:!i(xi)&&i(Gn),device:i(xi)||i(Gn)},android:{phone:!i(Jr)&&i(xi)||!i(Jr)&&i(Bo),tablet:!i(Jr)&&!i(xi)&&!i(Bo)&&(i(Gn)||i(xu)),device:!i(Jr)&&(i(xi)||i(Gn)||i(Bo)||i(xu))||i(/\bokhttp\b/i)},windows:{phone:i(Jr),tablet:i(_u),device:i(Jr)||i(_u)},other:{blackberry:i(bu),blackberry10:i(vu),opera:i(wu),firefox:i(Au),chrome:i(Eu),device:i(bu)||i(vu)||i(wu)||i(Au)||i(Eu)},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 ts=(null!=(gi=Su.default)?gi:Su)(globalThis.navigator);Z.RETINA_PREFIX=/@([0-9\.]+)x/,Z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Iu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ru={exports:{}};!function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}function i(a,h,d){this.fn=a,this.context=h,this.once=d||!1}function n(a,h,d,c,u){if("function"!=typeof d)throw new TypeError("The listener must be a function");var f=new i(d,c||a,u),p=e?e+h:h;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],f]:a._events[p].push(f):(a._events[p]=f,a._eventsCount++),a}function l(a,h){0==--a._eventsCount?a._events=new s:delete a._events[h]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(e=!1)),o.prototype.eventNames=function(){var h,d,a=[];if(0===this._eventsCount)return a;for(d in h=this._events)t.call(h,d)&&a.push(e?d.slice(1):d);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(h)):a},o.prototype.listeners=function(a){var d=this._events[e?e+a:a];if(!d)return[];if(d.fn)return[d.fn];for(var c=0,u=d.length,f=new Array(u);c80*e){o=h=r[0],a=d=r[1];for(var p=e;ph&&(h=c),u>d&&(d=u);f=0!==(f=Math.max(h-o,d-a))?32767/f:0}return an(n,l,e,o,a,f,0),l}function Mu(r,t,e,s,i){var n,l;if(i===Xo(r,t,e,s)>0)for(n=t;n=t;n-=s)l=ku(n,r[n],r[n+1],l);return l&&Wn(l,l.next)&&(ln(l),l=l.next),l}function Ys(r,t){if(!r)return r;t||(t=r);var s,e=r;do{if(s=!1,e.steiner||!Wn(e,e.next)&&0!==Bt(e.prev,e,e.next))e=e.next;else{if(ln(e),(e=t=e.prev)===e.next)break;s=!0}}while(s||e!==t);return t}function an(r,t,e,s,i,n,l){if(r){!l&&n&&function Mg(r,t,e,s){var i=r;do{0===i.z&&(i.z=Vo(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,function Cg(r){var t,e,s,i,n,l,o,a,h=1;do{for(e=r,r=null,n=null,l=0;e;){for(l++,s=e,o=0,t=0;t0||a>0&&s;)0!==o&&(0===a||!s||e.z<=s.z)?(i=e,e=e.nextZ,o--):(i=s,s=s.nextZ,a--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;e=s}n.nextZ=null,h*=2}while(l>1)}(i)}(r,s,i,n);for(var a,h,o=r;r.prev!==r.next;)if(a=r.prev,h=r.next,n?vg(r,s,i,n):bg(r))t.push(a.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),ln(r),r=h.next,o=h.next;else if((r=h)===o){l?1===l?an(r=wg(Ys(r),t,e),t,e,s,i,n,2):2===l&&Eg(r,t,e,s,i,n):an(Ys(r),t,e,s,i,n,1);break}}}function bg(r){var t=r.prev,e=r,s=r.next;if(Bt(t,e,s)>=0)return!1;for(var i=t.x,n=e.x,l=s.x,o=t.y,a=e.y,h=s.y,d=in?i>l?i:l:n>l?n:l,f=o>a?o>h?o:h:a>h?a:h,p=s.next;p!==t;){if(p.x>=d&&p.x<=u&&p.y>=c&&p.y<=f&&_i(i,o,n,a,l,h,p.x,p.y)&&Bt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function vg(r,t,e,s){var i=r.prev,n=r,l=r.next;if(Bt(i,n,l)>=0)return!1;for(var o=i.x,a=n.x,h=l.x,d=i.y,c=n.y,u=l.y,f=oa?o>h?o:h:a>h?a:h,g=d>c?d>u?d:u:c>u?c:u,x=Vo(f,p,t,e,s),y=Vo(m,g,t,e,s),_=r.prevZ,b=r.nextZ;_&&_.z>=x&&b&&b.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==l&&_i(o,d,a,c,h,u,_.x,_.y)&&Bt(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==i&&b!==l&&_i(o,d,a,c,h,u,b.x,b.y)&&Bt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==l&&_i(o,d,a,c,h,u,_.x,_.y)&&Bt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==i&&b!==l&&_i(o,d,a,c,h,u,b.x,b.y)&&Bt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function wg(r,t,e){var s=r;do{var i=s.prev,n=s.next.next;!Wn(i,n)&&Cu(i,s,s.next,n)&&on(i,n)&&on(n,i)&&(t.push(i.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),ln(s),ln(s.next),s=r=n),s=s.next}while(s!==r);return Ys(s)}function Eg(r,t,e,s,i,n){var l=r;do{for(var o=l.next.next;o!==l.prev;){if(l.i!==o.i&&kg(l,o)){var a=Pu(l,o);return l=Ys(l,l.next),a=Ys(a,a.next),an(l,t,e,s,i,n,0),void an(a,t,e,s,i,n,0)}o=o.next}l=l.next}while(l!==r)}function Tg(r,t){return r.x-t.x}function Sg(r,t){var e=function Ig(r,t){var l,e=t,s=r.x,i=r.y,n=-1/0;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){var o=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=s&&o>n&&(n=o,l=e.x=e.x&&e.x>=h&&s!==e.x&&_i(il.x||e.x===l.x&&Rg(l,e)))&&(l=e,c=u)),e=e.next}while(e!==a);return l}(r,t);if(!e)return t;var s=Pu(e,r);return Ys(s,s.next),Ys(e,e.next)}function Rg(r,t){return Bt(r.prev,r,t.prev)<0&&Bt(t.next,r,r.next)<0}function Vo(r,t,e,s,i){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-e)*i|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Pg(r){var t=r,e=r;do{(t.x=(r-l)*(n-o)&&(r-l)*(s-o)>=(e-l)*(t-o)&&(e-l)*(n-o)>=(i-l)*(s-o)}function kg(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function Fg(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&&Cu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}(r,t)&&(on(r,t)&&on(t,r)&&function Dg(r,t){var e=r,s=!1,i=(r.x+t.x)/2,n=(r.y+t.y)/2;do{e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next}while(e!==r);return s}(r,t)&&(Bt(r.prev,r,t.prev)||Bt(r,t.prev,t))||Wn(r,t)&&Bt(r.prev,r,r.next)>0&&Bt(t.prev,t,t.next)>0)}function Bt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Wn(r,t){return r.x===t.x&&r.y===t.y}function Cu(r,t,e,s){var i=$n(Bt(r,t,e)),n=$n(Bt(r,t,s)),l=$n(Bt(e,s,r)),o=$n(Bt(e,s,t));return!!(i!==n&&l!==o||0===i&&jn(r,e,t)||0===n&&jn(r,s,t)||0===l&&jn(e,r,s)||0===o&&jn(e,t,s))}function jn(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 $n(r){return r>0?1:r<0?-1:0}function on(r,t){return Bt(r.prev,r,r.next)<0?Bt(r,t,r.next)>=0&&Bt(r,r.prev,t)>=0:Bt(r,t,r.prev)<0||Bt(r,r.next,t)<0}function Pu(r,t){var e=new Uo(r.i,r.x,r.y),s=new Uo(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function ku(r,t,e,s){var i=new Uo(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function ln(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 Uo(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}function Xo(r,t,e,s){for(var i=0,n=t,l=e-s;n0&&e.holes.push(s+=r[i-1].length)}return e};const Og=Iu(Lo.exports);var zn={exports:{}};!function(r,t){!function(e){var s=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,n="object"==typeof Dr&&Dr;(n.global===n||n.window===n||n.self===n)&&(e=n);var l,E,o=2147483647,a=36,d=26,c=38,u=700,g=/^xn--/,x=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=a-1,v=Math.floor,w=String.fromCharCode;function T(F){throw new RangeError(_[F])}function A(F,L){for(var Y=F.length,H=[];Y--;)H[Y]=L(F[Y]);return H}function D(F,L){var Y=F.split("@"),H="";return Y.length>1&&(H=Y[0]+"@",F=Y[1]),H+A((F=F.replace(y,".")).split("."),L).join(".")}function C(F){for(var G,z,L=[],Y=0,H=F.length;Y=55296&&G<=56319&&Y65535&&(Y+=w((L-=65536)>>>10&1023|55296),L=56320|1023&L),Y+w(L)}).join("")}function I(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:a}function P(F,L){return F+22+75*(F<26)-((0!=L)<<5)}function B(F,L,Y){var H=0;for(F=Y?v(F/u):F>>1,F+=v(F/L);F>b*d>>1;H+=a)F=v(F/b);return v(H+(b+1)*F/(F+c))}function U(F){var H,lt,ht,ft,yt,at,ct,Mt,ce,jt,L=[],Y=F.length,G=0,z=128,K=72;for((lt=F.lastIndexOf("-"))<0&&(lt=0),ht=0;ht=128&&T("not-basic"),L.push(F.charCodeAt(ht));for(ft=lt>0?lt+1:0;ft=Y&&T("invalid-input"),((Mt=I(F.charCodeAt(ft++)))>=a||Mt>v((o-G)/at))&&T("overflow"),G+=Mt*at,!(Mt<(ce=ct<=K?1:ct>=K+d?d:ct-K));ct+=a)at>v(o/(jt=a-ce))&&T("overflow"),at*=jt;K=B(G-yt,H=L.length+1,0==yt),v(G/H)>o-z&&T("overflow"),z+=v(G/H),G%=H,L.splice(G++,0,z)}return M(L)}function O(F){var L,Y,H,G,z,K,lt,ht,ft,yt,at,Mt,ce,jt,ge,ct=[];for(Mt=(F=C(F)).length,L=128,Y=0,z=72,K=0;K=L&&atv((o-Y)/(ce=H+1))&&T("overflow"),Y+=(lt-L)*ce,L=lt,K=0;Ko&&T("overflow"),at==L){for(ht=Y,ft=a;!(ht<(yt=ft<=z?1:ft>=z+d?d:ft-z));ft+=a)ct.push(w(P(yt+(ge=ht-yt)%(jt=a-yt),0))),ht=v(ge/jt);ct.push(w(P(ht,0))),z=B(Y,ce,H==G),Y=0,++H}++Y,++L}return ct.join("")}if(l={version:"1.4.1",ucs2:{decode:C,encode:M},decode:U,encode:O,toASCII:function N(F){return D(F,function(L){return x.test(L)?"xn--"+O(L):L})},toUnicode:function k(F){return D(F,function(L){return g.test(L)?U(L.slice(4).toLowerCase()):L})}},s&&i)if(r.exports==s)i.exports=l;else for(E in l)l.hasOwnProperty(E)&&(s[E]=l[E]);else e.punycode=l}(Dr)}(zn,zn.exports);var Bg=zn.exports,bi=TypeError;const Lg=function xg(r){if(r.__esModule)return r;var t=r.default;if("function"==typeof t){var e=function s(){return this instanceof s?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(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Yo="function"==typeof Map&&Map.prototype,Go=Object.getOwnPropertyDescriptor&&Yo?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,qn=Yo&&Go&&"function"==typeof Go.get?Go.get:null,Fu=Yo&&Map.prototype.forEach,Ho="function"==typeof Set&&Set.prototype,Wo=Object.getOwnPropertyDescriptor&&Ho?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zn=Ho&&Wo&&"function"==typeof Wo.get?Wo.get:null,Du=Ho&&Set.prototype.forEach,hn="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,cn="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,Nu="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,Yg=Boolean.prototype.valueOf,Gg=Object.prototype.toString,Hg=Function.prototype.toString,Wg=String.prototype.match,jo=String.prototype.slice,bs=String.prototype.replace,jg=String.prototype.toUpperCase,Ou=String.prototype.toLowerCase,Bu=RegExp.prototype.test,Lu=Array.prototype.concat,Nr=Array.prototype.join,$g=Array.prototype.slice,Vu=Math.floor,$o="function"==typeof BigInt?BigInt.prototype.valueOf:null,zo=Object.getOwnPropertySymbols,qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,vi="function"==typeof Symbol&&"object"==typeof Symbol.iterator,un="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol,1)?Symbol.toStringTag:null,Uu=Object.prototype.propertyIsEnumerable,Xu=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Yu(r,t){if(r===1/0||r===-1/0||r!=r||r&&r>-1e3&&r<1e3||Bu.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof r){var s=r<0?-Vu(-r):Vu(r);if(s!==r){var i=String(s),n=jo.call(t,i.length+1);return bs.call(i,e,"$&_")+"."+bs.call(bs.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return bs.call(t,e,"$&_")}var Zo=Lg,Gu=Zo.custom,Hu=zu(Gu)?Gu:null,Wu={__proto__:null,double:'"',single:"'"},zg={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Kn=function r(t,e,s,i){var n=e||{};if(es(n,"quoteStyle")&&!es(Wu,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(es(n,"maxStringLength")&&("number"==typeof n.maxStringLength?n.maxStringLength<0&&n.maxStringLength!==1/0:null!==n.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var l=!es(n,"customInspect")||n.customInspect;if("boolean"!=typeof l&&"symbol"!==l)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(es(n,"indent")&&null!==n.indent&&"\t"!==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(es(n,"numericSeparator")&&"boolean"!=typeof n.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=n.numericSeparator;if(typeof t>"u")return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return Zu(t,n);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var a=String(t);return o?Yu(t,a):a}if("bigint"==typeof t){var h=String(t)+"n";return o?Yu(t,h):h}var d=typeof n.depth>"u"?5:n.depth;if(typeof s>"u"&&(s=0),s>=d&&d>0&&"object"==typeof t)return Ko(t)?"[Array]":"[Object]";var c=function d0(r,t){var e;if("\t"===r.indent)e="\t";else{if(!("number"==typeof r.indent&&r.indent>0))return null;e=Nr.call(Array(r.indent+1)," ")}return{base:e,prev:Nr.call(Array(t+1),e)}}(n,s);if(typeof i>"u")i=[];else if(qu(i,t)>=0)return"[Circular]";function u(I,P,B){if(P&&(i=$g.call(i)).push(P),B){var U={depth:n.depth};return es(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),r(I,U,s+1,i)}return r(I,n,s+1,i)}if("function"==typeof t&&!$u(t)){var f=function s0(r){if(r.name)return r.name;var t=Wg.call(Hg.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}(t),p=Qn(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Nr.call(p,", ")+" }":"")}if(zu(t)){var m=vi?bs.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):qo.call(t);return"object"!=typeof t||vi?m:dn(m)}if(function h0(r){return!(!r||"object"!=typeof r)&&(typeof HTMLElement<"u"&&r instanceof HTMLElement||"string"==typeof r.nodeName&&"function"==typeof r.getAttribute)}(t)){for(var g="<"+Ou.call(String(t.nodeName)),x=t.attributes||[],y=0;y"}if(Ko(t)){if(0===t.length)return"[]";var _=Qn(t,u);return c&&!function u0(r){for(var t=0;t=0)return!1;return!0}(_)?"["+Jo(_,c)+"]":"[ "+Nr.call(_,", ")+" ]"}if(function Kg(r){return"[object Error]"===vs(r)&&Gs(r)}(t)){var b=Qn(t,u);return"cause"in Error.prototype||!("cause"in t)||Uu.call(t,"cause")?0===b.length?"["+String(t)+"]":"{ ["+String(t)+"] "+Nr.call(b,", ")+" }":"{ ["+String(t)+"] "+Nr.call(Lu.call("[cause]: "+u(t.cause),b),", ")+" }"}if("object"==typeof t&&l){if(Hu&&"function"==typeof t[Hu]&&Zo)return Zo(t,{depth:d-s});if("symbol"!==l&&"function"==typeof t.inspect)return t.inspect()}if(function i0(r){if(!qn||!r||"object"!=typeof r)return!1;try{qn.call(r);try{Zn.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}(t)){var v=[];return Fu&&Fu.call(t,function(I,P){v.push(u(P,t,!0)+" => "+u(I,t))}),Ku("Map",qn.call(t),v,c)}if(function o0(r){if(!Zn||!r||"object"!=typeof r)return!1;try{Zn.call(r);try{qn.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}(t)){var w=[];return Du&&Du.call(t,function(I){w.push(u(I,t))}),Ku("Set",Zn.call(t),w,c)}if(function n0(r){if(!hn||!r||"object"!=typeof r)return!1;try{hn.call(r,hn);try{cn.call(r,cn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}(t))return Qo("WeakMap");if(function l0(r){if(!cn||!r||"object"!=typeof r)return!1;try{cn.call(r,cn);try{hn.call(r,hn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}(t))return Qo("WeakSet");if(function a0(r){if(!Nu||!r||"object"!=typeof r)return!1;try{return Nu.call(r),!0}catch{}return!1}(t))return Qo("WeakRef");if(function Jg(r){return"[object Number]"===vs(r)&&Gs(r)}(t))return dn(u(Number(t)));if(function e0(r){if(!r||"object"!=typeof r||!$o)return!1;try{return $o.call(r),!0}catch{}return!1}(t))return dn(u($o.call(t)));if(function t0(r){return"[object Boolean]"===vs(r)&&Gs(r)}(t))return dn(Yg.call(t));if(function Qg(r){return"[object String]"===vs(r)&&Gs(r)}(t))return dn(u(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Dr<"u"&&t===Dr)return"{ [object globalThis] }";if(!function Zg(r){return"[object Date]"===vs(r)&&Gs(r)}(t)&&!$u(t)){var E=Qn(t,u),T=Xu?Xu(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",D=!T&&un&&Object(t)===t&&un in t?jo.call(vs(t),8,-1):A?"Object":"",M=(T||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(D||A?"["+Nr.call(Lu.call([],D||[],A||[]),": ")+"] ":"");return 0===E.length?M+"{}":c?M+"{"+Jo(E,c)+"}":M+"{ "+Nr.call(E,", ")+" }"}return String(t)};function ju(r,t,e){var i=Wu[e.quoteStyle||t];return i+r+i}function qg(r){return bs.call(String(r),/"/g,""")}function Gs(r){return!un||!("object"==typeof r&&(un in r||typeof r[un]<"u"))}function Ko(r){return"[object Array]"===vs(r)&&Gs(r)}function $u(r){return"[object RegExp]"===vs(r)&&Gs(r)}function zu(r){if(vi)return r&&"object"==typeof r&&r instanceof Symbol;if("symbol"==typeof r)return!0;if(!r||"object"!=typeof r||!qo)return!1;try{return qo.call(r),!0}catch{}return!1}var r0=Object.prototype.hasOwnProperty||function(r){return r in this};function es(r,t){return r0.call(r,t)}function vs(r){return Gg.call(r)}function qu(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,s=r.length;et.maxStringLength){var e=r.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return Zu(jo.call(r,0,t.maxStringLength),t)+s}var i=zg[t.quoteStyle||"single"];return i.lastIndex=0,ju(bs.call(bs.call(r,i,"\\$1"),/[\x00-\x1f]/g,c0),"single",t)}function c0(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":"")+jg.call(t.toString(16))}function dn(r){return"Object("+r+")"}function Qo(r){return r+" { ? }"}function Ku(r,t,e,s){return r+" ("+t+") {"+(s?Jo(e,s):Nr.call(e,", "))+"}"}function Jo(r,t){if(0===r.length)return"";var e="\n"+t.prev+t.base;return e+Nr.call(r,","+e)+"\n"+t.prev}function Qn(r,t){var e=Ko(r),s=[];if(e){s.length=r.length;for(var i=0;i"u"||!ue?vt:ue(Uint8Array),Hs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?vt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?vt:ArrayBuffer,"%ArrayIteratorPrototype%":Ai&&ue?ue([][Symbol.iterator]()):vt,"%AsyncFromSyncIteratorPrototype%":vt,"%AsyncFunction%":Ti,"%AsyncGenerator%":Ti,"%AsyncGeneratorFunction%":Ti,"%AsyncIteratorPrototype%":Ti,"%Atomics%":typeof Atomics>"u"?vt:Atomics,"%BigInt%":typeof BigInt>"u"?vt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?vt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?vt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?vt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":oy,"%eval%":eval,"%EvalError%":ly,"%Float32Array%":typeof Float32Array>"u"?vt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?vt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?vt:FinalizationRegistry,"%Function%":gd,"%GeneratorFunction%":Ti,"%Int8Array%":typeof Int8Array>"u"?vt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?vt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?vt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ai&&ue?ue(ue([][Symbol.iterator]())):vt,"%JSON%":"object"==typeof JSON?JSON:vt,"%Map%":typeof Map>"u"?vt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ai||!ue?vt:ue((new Map)[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":ay,"%Object.getOwnPropertyDescriptor%":fn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?vt:Promise,"%Proxy%":typeof Proxy>"u"?vt:Proxy,"%RangeError%":hy,"%ReferenceError%":cy,"%Reflect%":typeof Reflect>"u"?vt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?vt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ai||!ue?vt:ue((new Set)[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?vt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ai&&ue?ue(""[Symbol.iterator]()):vt,"%Symbol%":Ai?Symbol:vt,"%SyntaxError%":wi,"%ThrowTypeError%":by,"%TypedArray%":Ey,"%TypeError%":Ei,"%Uint8Array%":typeof Uint8Array>"u"?vt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?vt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?vt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?vt:Uint32Array,"%URIError%":uy,"%WeakMap%":typeof WeakMap>"u"?vt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?vt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?vt:WeakSet,"%Function.prototype.call%":pn,"%Function.prototype.apply%":yd,"%Object.defineProperty%":_y,"%Object.getPrototypeOf%":vy,"%Math.abs%":dy,"%Math.floor%":fy,"%Math.max%":py,"%Math.min%":my,"%Math.pow%":gy,"%Math.round%":yy,"%Math.sign%":function(r){return F0(r)||0===r?r:r<0?-1:1},"%Reflect.getPrototypeOf%":wy};if(ue)try{null.error}catch(r){var Ay=ue(ue(r));Hs["%Error.prototype%"]=Ay}var Ty=function r(t){var e;if("%AsyncFunction%"===t)e=al("async function () {}");else if("%GeneratorFunction%"===t)e=al("function* () {}");else if("%AsyncGeneratorFunction%"===t)e=al("async function* () {}");else if("%AsyncGenerator%"===t){var s=r("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=r("%AsyncGenerator%");i&&ue&&(e=ue(i.prototype))}return Hs[t]=e,e},xd={__proto__:null,"%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"]},mn=ra,sa=function ny(){return md?nl:(md=1,nl=ra.call(Function.prototype.call,Object.prototype.hasOwnProperty))}(),Sy=mn.call(pn,Array.prototype.concat),Iy=mn.call(yd,Array.prototype.splice),_d=mn.call(pn,String.prototype.replace),ia=mn.call(pn,String.prototype.slice),Ry=mn.call(pn,RegExp.prototype.exec),My=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Cy=/\\(\\)?/g,ky=function(r,t){var s,e=r;if(sa(xd,e)&&(e="%"+(s=xd[e])[0]+"%"),sa(Hs,e)){var i=Hs[e];if(i===Ti&&(i=Ty(e)),typeof i>"u"&&!t)throw new Ei("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:s,name:e,value:i}}throw new wi("intrinsic "+r+" does not exist!")},ll=function(r,t){if("string"!=typeof r||0===r.length)throw new Ei("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new Ei('"allowMissing" argument must be a boolean');if(null===Ry(/^%?[^%]*%?$/,r))throw new wi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var e=function(r){var t=ia(r,0,1),e=ia(r,-1);if("%"===t&&"%"!==e)throw new wi("invalid intrinsic syntax, expected closing `%`");if("%"===e&&"%"!==t)throw new wi("invalid intrinsic syntax, expected opening `%`");var s=[];return _d(r,My,function(i,n,l,o){s[s.length]=l?_d(o,Cy,"$1"):n||i}),s}(r),s=e.length>0?e[0]:"",i=ky("%"+s+"%",t),n=i.name,l=i.value,o=!1,a=i.alias;a&&(s=a[0],Iy(e,Sy([0,1],a)));for(var h=1,d=!0;h=e.length){var p=fn(l,c);l=(d=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:l[c]}else d=sa(l,c),l=l[c];d&&!o&&(Hs[n]=l)}}return l},bd=ll,vd=dd,Fy=vd([bd("%String.prototype.indexOf%")]),wd=function(r,t){var e=bd(r,!!t);return"function"==typeof e&&Fy(r,".prototype.")>-1?vd([e]):e},gn=wd,Ny=Kn,Oy=bi,Ed=ll("%Map%",!0),By=gn("Map.prototype.get",!0),Ly=gn("Map.prototype.set",!0),Vy=gn("Map.prototype.has",!0),Uy=gn("Map.prototype.delete",!0),Xy=gn("Map.prototype.size",!0),Ad=!!Ed&&function(){var r,t={assert:function(e){if(!t.has(e))throw new Oy("Side channel does not contain "+Ny(e))},delete:function(e){if(r){var s=Uy(r,e);return 0===Xy(r)&&(r=void 0),s}return!1},get:function(e){if(r)return By(r,e)},has:function(e){return!!r&&Vy(r,e)},set:function(e,s){r||(r=new Ed),Ly(r,e,s)}};return t},na=wd,Gy=Kn,aa=Ad,Hy=bi,Si=ll("%WeakMap%",!0),Wy=na("WeakMap.prototype.get",!0),jy=na("WeakMap.prototype.set",!0),$y=na("WeakMap.prototype.has",!0),zy=na("WeakMap.prototype.delete",!0),qy=Si?function(){var r,t,e={assert:function(s){if(!e.has(s))throw new Hy("Side channel does not contain "+Gy(s))},delete:function(s){if(Si&&s&&("object"==typeof s||"function"==typeof s)){if(r)return zy(r,s)}else if(aa&&t)return t.delete(s);return!1},get:function(s){return Si&&s&&("object"==typeof s||"function"==typeof s)&&r?Wy(r,s):t&&t.get(s)},has:function(s){return Si&&s&&("object"==typeof s||"function"==typeof s)&&r?$y(r,s):!!t&&t.has(s)},set:function(s,i){Si&&s&&("object"==typeof s||"function"==typeof s)?(r||(r=new Si),jy(r,s,i)):aa&&(t||(t=aa()),t.set(s,i))}};return e}:aa,Zy=bi,Ky=Kn,ex=qy||Ad||function(){var r,t={assert:function(e){if(!t.has(e))throw new p0("Side channel does not contain "+f0(e))},delete:function(e){var s=r&&r.next,i=function(r,t){if(r)return Jn(r,t,!0)}(r,e);return i&&s&&s===i&&(r=void 0),!!i},get:function(e){return function(r,t){if(r){var e=Jn(r,t);return e&&e.value}}(r,e)},has:function(e){return function(r,t){return!!r&&!!Jn(r,t)}(r,e)},set:function(e,s){r||(r={next:void 0}),function(r,t,e){var s=Jn(r,t);s?s.value=e:r.next={key:t,next:r.next,value:e}}(r,e,s)}};return t},sx=String.prototype.replace,ix=/%20/g,cl={default:"RFC3986",formatters:{RFC1738:function(r){return sx.call(r,ix,"+")},RFC3986:function(r){return String(r)}},RFC1738:"RFC1738",RFC3986:"RFC3986"},nx=cl,ul=Object.prototype.hasOwnProperty,Ws=Array.isArray,Or=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),Td=function(r,t){for(var e=t&&t.plainObjects?{__proto__:null}:{},s=0;s1;){var t=r.pop(),e=t.obj[t.prop];if(Ws(e)){for(var s=[],i=0;i=1024?n.slice(o,o+1024):n,h=[],d=0;d=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||i===nx.RFC1738&&(40===c||41===c)?h[h.length]=a.charAt(d):c<128?h[h.length]=Or[c]:c<2048?h[h.length]=Or[192|c>>6]+Or[128|63&c]:c<55296||c>=57344?h[h.length]=Or[224|c>>12]+Or[128|c>>6&63]+Or[128|63&c]:(c=65536+((1023&c)<<10|1023&a.charCodeAt(d+=1)),h[h.length]=Or[240|c>>18]+Or[128|c>>12&63]+Or[128|c>>6&63]+Or[128|63&c])}l+=h.join("")}return l},isBuffer:function(r){return!(!r||"object"!=typeof r||!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r)))},isRegExp:function(r){return"[object RegExp]"===Object.prototype.toString.call(r)},maybeMap:function(r,t){if(Ws(r)){for(var e=[],s=0;s"u"&&(v=0)}if("function"==typeof d?_=d(e,_):_ instanceof Date?_=f(_):"comma"===s&&Br(_)&&(_=oa.maybeMap(_,function(F){return F instanceof Date?f(F):F})),null===_){if(l)return h&&!g?h(e,ae.encoder,x,"key",p):e;_=""}if(function(r){return"string"==typeof r||"number"==typeof r||"boolean"==typeof r||"symbol"==typeof r||"bigint"==typeof r}(_)||oa.isBuffer(_))return h?[m(g?e:h(e,ae.encoder,x,"key",p))+"="+m(h(_,ae.encoder,x,"value",p))]:[m(e)+"="+m(String(_))];var D,A=[];if(typeof _>"u")return A;if("comma"===s&&Br(_))g&&h&&(_=oa.maybeMap(_,h)),D=[{value:_.length>0?_.join(",")||null:void 0}];else if(Br(d))D=d;else{var C=Object.keys(_);D=c?C.sort(c):C}var M=a?String(e).replace(/\./g,"%2E"):String(e),I=i&&Br(_)&&1===_.length?M+"[]":M;if(n&&Br(_)&&0===_.length)return I+"[]";for(var P=0;P-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return r},Rx=function(r,t,e,s){if(r){var i=e.allowDots?r.replace(/\.([^.[]+)/g,"[$1]"):r,l=/(\[[^[\]]*])/g,o=e.depth>0&&/(\[[^[\]]*])/.exec(i),a=o?i.slice(0,o.index):i,h=[];if(a){if(!e.plainObjects&&pl.call(Object.prototype,a)&&!e.allowPrototypes)return;h.push(a)}for(var d=0;e.depth>0&&null!==(o=l.exec(i))&&d0&&"[]"===r[r.length-1]){var n=r.slice(0,-1).join("");i=Array.isArray(t)&&t[n]?t[n].length:0}for(var l=s?t:kd(t,e,i),o=r.length-1;o>=0;--o){var a,h=r[o];if("[]"===h&&e.parseArrays)a=e.allowEmptyArrays&&(""===l||e.strictNullHandling&&null===l)?[]:js.combine([],l);else{a=e.plainObjects?{__proto__:null}:{};var d="["===h.charAt(0)&&"]"===h.charAt(h.length-1)?h.slice(1,-1):h,c=e.decodeDotInKeys?d.replace(/%2E/g,"."):d,u=parseInt(c,10);e.parseArrays||""!==c?!isNaN(u)&&h!==c&&String(u)===c&&u>=0&&e.parseArrays&&u<=e.arrayLimit?(a=[])[u]=l:"__proto__"!==c&&(a[c]=l):a={0:l}}l=a}return l}(h,t,e,s)}},Dx={formats:cl,parse:function(r,t){var e=function(r){if(!r)return zt;if(typeof r.allowEmptyArrays<"u"&&"boolean"!=typeof r.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof r.decodeDotInKeys<"u"&&"boolean"!=typeof r.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==r.decoder&&typeof r.decoder<"u"&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(typeof r.charset<"u"&&"utf-8"!==r.charset&&"iso-8859-1"!==r.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof r.throwOnLimitExceeded<"u"&&"boolean"!=typeof r.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=typeof r.charset>"u"?zt.charset:r.charset,e=typeof r.duplicates>"u"?zt.duplicates:r.duplicates;if("combine"!==e&&"first"!==e&&"last"!==e)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:typeof r.allowDots>"u"?!0===r.decodeDotInKeys||zt.allowDots:!!r.allowDots,allowEmptyArrays:"boolean"==typeof r.allowEmptyArrays?!!r.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:"boolean"==typeof r.allowPrototypes?r.allowPrototypes:zt.allowPrototypes,allowSparse:"boolean"==typeof r.allowSparse?r.allowSparse:zt.allowSparse,arrayLimit:"number"==typeof r.arrayLimit?r.arrayLimit:zt.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof r.charsetSentinel?r.charsetSentinel:zt.charsetSentinel,comma:"boolean"==typeof r.comma?r.comma:zt.comma,decodeDotInKeys:"boolean"==typeof r.decodeDotInKeys?r.decodeDotInKeys:zt.decodeDotInKeys,decoder:"function"==typeof r.decoder?r.decoder:zt.decoder,delimiter:"string"==typeof r.delimiter||js.isRegExp(r.delimiter)?r.delimiter:zt.delimiter,depth:"number"==typeof r.depth||!1===r.depth?+r.depth:zt.depth,duplicates:e,ignoreQueryPrefix:!0===r.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof r.interpretNumericEntities?r.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:"number"==typeof r.parameterLimit?r.parameterLimit:zt.parameterLimit,parseArrays:!1!==r.parseArrays,plainObjects:"boolean"==typeof r.plainObjects?r.plainObjects:zt.plainObjects,strictDepth:"boolean"==typeof r.strictDepth?!!r.strictDepth:zt.strictDepth,strictNullHandling:"boolean"==typeof r.strictNullHandling?r.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof r.throwOnLimitExceeded&&r.throwOnLimitExceeded}}(t);if(""===r||null===r||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var s="string"==typeof r?function(r,t){var e={__proto__:null},s=t.ignoreQueryPrefix?r.replace(/^\?/,""):r;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i=t.parameterLimit===1/0?void 0:t.parameterLimit,n=s.split(t.delimiter,t.throwOnLimitExceeded?i+1:i);if(t.throwOnLimitExceeded&&n.length>i)throw new RangeError("Parameter limit exceeded. Only "+i+" parameter"+(1===i?"":"s")+" allowed.");var o,l=-1,a=t.charset;if(t.charsetSentinel)for(o=0;o-1&&(f=Pd(f)?[f]:f);var p=pl.call(e,u);p&&"combine"===t.duplicates?e[u]=js.combine(e[u],f):(!p||"last"===t.duplicates)&&(e[u]=f)}return e}(r,e):r,i=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),l=0;l"u"?!0===r.encodeDotInKeys||ae.allowDots:!!r.allowDots,allowEmptyArrays:"boolean"==typeof r.allowEmptyArrays?!!r.allowEmptyArrays:ae.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:"boolean"==typeof r.charsetSentinel?r.charsetSentinel:ae.charsetSentinel,commaRoundTrip:!!r.commaRoundTrip,delimiter:typeof r.delimiter>"u"?ae.delimiter:r.delimiter,encode:"boolean"==typeof r.encode?r.encode:ae.encode,encodeDotInKeys:"boolean"==typeof r.encodeDotInKeys?r.encodeDotInKeys:ae.encodeDotInKeys,encoder:"function"==typeof r.encoder?r.encoder:ae.encoder,encodeValuesOnly:"boolean"==typeof r.encodeValuesOnly?r.encodeValuesOnly:ae.encodeValuesOnly,filter:i,format:e,formatter:s,serializeDate:"function"==typeof r.serializeDate?r.serializeDate:ae.serializeDate,skipNulls:"boolean"==typeof r.skipNulls?r.skipNulls:ae.skipNulls,sort:"function"==typeof r.sort?r.sort:null,strictNullHandling:"boolean"==typeof r.strictNullHandling?r.strictNullHandling:ae.strictNullHandling}}(t);"function"==typeof s.filter?e=(0,s.filter)("",e):Br(s.filter)&&(i=s.filter);var l=[];if("object"!=typeof e||null===e)return"";var o=Rd[s.arrayFormat],a="comma"===o&&s.commaRoundTrip;i||(i=Object.keys(e)),s.sort&&i.sort(s.sort);for(var h=Id(),d=0;d0?p+f:""}},Nx=Bg;function rs(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ox=/^([a-z0-9.+-]+:)/i,Bx=/:[0-9]*$/,Lx=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Ux=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),ml=["'"].concat(Ux),Fd=["%","/","?",";","#"].concat(ml),Dd=["/","?","#"],Nd=/^[+a-z0-9A-Z_-]{0,63}$/,Yx=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Gx={javascript:!0,"javascript:":!0},gl={javascript:!0,"javascript:":!0},Ii={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},yl=Dx;rs.prototype.parse=function(r,t,e){if("string"!=typeof r)throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var s=r.indexOf("?"),i=-1!==s&&s127?v+="x":v+=b[w];if(!v.match(Nd)){var T=y.slice(0,f),A=y.slice(f+1),D=b.match(Yx);D&&(T.push(D[1]),A.unshift(D[2])),A.length&&(o="/"+A.join(".")+o),this.hostname=T.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),x||(this.hostname=Nx.toASCII(this.hostname)),this.host=(this.hostname||"")+(this.port?":"+this.port:""),this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!Gx[d])for(f=0,_=ml.length;f<_;f++){var I=ml[f];if(-1!==o.indexOf(I)){var P=encodeURIComponent(I);P===I&&(P=escape(I)),o=o.split(I).join(P)}}var B=o.indexOf("#");-1!==B&&(this.hash=o.substr(B),o=o.slice(0,B));var U=o.indexOf("?");return-1!==U?(this.search=o.substr(U),this.query=o.substr(U+1),t&&(this.query=yl.parse(this.query)),o=o.slice(0,U)):t&&(this.search="",this.query={}),o&&(this.pathname=o),Ii[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),(this.pathname||this.search)&&(this.path=(this.pathname||"")+(this.search||"")),this.href=this.format(),this},rs.prototype.format=function(){var r=this.auth||"";r&&(r=(r=encodeURIComponent(r)).replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",i=!1,n="";this.host?i=r+this.host:this.hostname&&(i=r+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(n=yl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var l=this.search||n&&"?"+n||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||Ii[t])&&!1!==i?(i="//"+(i||""),e&&"/"!==e.charAt(0)&&(e="/"+e)):i||(i=""),s&&"#"!==s.charAt(0)&&(s="#"+s),l&&"?"!==l.charAt(0)&&(l="?"+l),t+i+(e=e.replace(/[?#]/g,function(o){return encodeURIComponent(o)}))+(l=l.replace("#","%23"))+s},rs.prototype.resolve=function(r){return this.resolveObject(function Hx(r,t,e){if(r&&"object"==typeof r&&r instanceof rs)return r;var s=new rs;return s.parse(r,t,e),s}(r,!1,!0)).format()},rs.prototype.resolveObject=function(r){if("string"==typeof r){var t=new rs;t.parse(r,!1,!0),r=t}for(var e=new rs,s=Object.keys(this),i=0;i0)&&e.host.split("@"))&&(e.auth=v.shift(),e.hostname=v.shift(),e.host=e.hostname)),e.search=r.search,e.query=r.query,(null!==e.pathname||null!==e.search)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e;if(!y.length)return e.pathname=null,e.path=e.search?"/"+e.search:null,e.href=e.format(),e;for(var w=y.slice(-1)[0],E=(e.host||r.host||y.length>1)&&("."===w||".."===w)||""===w,T=0,A=y.length;A>=0;A--)"."===(w=y[A])?y.splice(A,1):".."===w?(y.splice(A,1),T++):T&&(y.splice(A,1),T--);if(!g&&!x)for(;T--;T)y.unshift("..");g&&""!==y[0]&&(!y[0]||"/"!==y[0].charAt(0))&&y.unshift(""),E&&"/"!==y.join("/").substr(-1)&&y.push("");var v,D=""===y[0]||y[0]&&"/"===y[0].charAt(0);return b&&(e.hostname=D?"":y.length?y.shift():"",e.host=e.hostname,(v=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@"))&&(e.auth=v.shift(),e.hostname=v.shift(),e.host=e.hostname)),(g=g||e.host&&y.length)&&!D&&y.unshift(""),y.length>0?e.pathname=y.join("/"):(e.pathname=null,e.path=null),(null!==e.pathname||null!==e.search)&&(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},rs.prototype.parseHost=function(){var r=this.host,t=Bx.exec(r);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Od={};function xt(r,t,e=3){if(Od[t])return;let s=(new Error).stack;typeof s>"u"||(s=s.split("\n").splice(e).join("\n")),Od[t]=!0}function cr(r){if("string"!=typeof r)throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function xn(r){return r.split("?")[0].split("#")[0]}const Ot={toPosix:r=>function jx(r,t,e){return r.replace(new RegExp(function Wx(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),e)}(r,"\\","/"),isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl:r=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r),isBlobUrl:r=>r.startsWith("blob:"),hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){cr(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(cr(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=xn(this.toPosix(t??Z.ADAPTER.getBaseUrl())),i=xn(this.toPosix(e??this.rootname(s)));return(r=this.toPosix(r)).startsWith("/")?Ot.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(cr(r),0===r.length)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;let t="";const e=(r=this.toPosix(r)).startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=function $x(r,t){let e="",s=0,i=-1,n=0,l=-1;for(let o=0;o<=r.length;++o){if(o2){const a=e.lastIndexOf("/");if(a!==e.length-1){-1===a?(e="",s=0):(e=e.slice(0,a),s=e.length-1-e.lastIndexOf("/")),i=o,n=0;continue}}else if(2===e.length||1===e.length){e="",s=0,i=o,n=0;continue}}else e.length>0?e+=`/${r.slice(i+1,o)}`:e=r.slice(i+1,o),s=o-i-1;i=o,n=0}else 46===l&&-1!==n?++n:n=-1}return e}(r),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return cr(r),r=this.toPosix(r),!!this.hasProtocol(r)||r.startsWith("/")},join(...r){var t;if(0===r.length)return".";let e;for(let s=0;s0)if(void 0===e)e=i;else{const n=null!=(t=r[s-1])?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return void 0===e?".":this.normalize(e)},dirname(r){if(cr(r),0===r.length)return".";let t=(r=this.toPosix(r)).charCodeAt(0);const e=47===t;let s=-1,i=!0;const n=this.getProtocol(r),l=r;for(let o=(r=r.slice(n.length)).length-1;o>=1;--o)if(t=r.charCodeAt(o),47===t){if(!i){s=o;break}}else i=!1;return-1===s?e?"/":this.isUrl(l)?n+r:n:e&&1===s?"//":n+r.slice(0,s)},rootname(r){cr(r);let t="";if(t=(r=this.toPosix(r)).startsWith("/")?"/":this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);t=-1!==e?r.slice(0,e):r,t.endsWith("/")||(t+="/")}return t},basename(r,t){cr(r),t&&cr(t),r=xn(this.toPosix(r));let n,e=0,s=-1,i=!0;if(void 0!==t&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let l=t.length-1,o=-1;for(n=r.length-1;n>=0;--n){const a=r.charCodeAt(n);if(47===a){if(!i){e=n+1;break}}else-1===o&&(i=!1,o=n+1),l>=0&&(a===t.charCodeAt(l)?-1==--l&&(s=n):(l=-1,s=o))}return e===s?s=o:-1===s&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(47===r.charCodeAt(n)){if(!i){e=n+1;break}}else-1===s&&(i=!1,s=n+1);return-1===s?"":r.slice(e,s)},extname(r){cr(r);let t=-1,e=0,s=-1,i=!0,n=0;for(let l=(r=xn(this.toPosix(r))).length-1;l>=0;--l){const o=r.charCodeAt(l);if(47!==o)-1===s&&(i=!1,s=l+1),46===o?-1===t?t=l:1!==n&&(n=1):-1!==t&&(n=-1);else if(!i){e=l+1;break}}return-1===t||-1===s||0===n||1===n&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){cr(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(0===r.length)return t;let e=(r=xn(this.toPosix(r))).charCodeAt(0);const s=this.isAbsolute(r);let i;t.root=this.rootname(r),i=s||this.hasProtocol(r)?1:0;let n=-1,l=0,o=-1,a=!0,h=r.length-1,d=0;for(;h>=i;--h)if(e=r.charCodeAt(h),47!==e)-1===o&&(a=!1,o=h+1),46===e?-1===n?n=h:1!==d&&(d=1):-1!==n&&(d=-1);else if(!a){l=h+1;break}return-1===n||-1===o||0===d||1===d&&n===o-1&&n===l+1?-1!==o&&(t.base=t.name=r.slice(0===l&&s?1:l,o)):(0===l&&s?(t.name=r.slice(1,n),t.base=r.slice(1,o)):(t.name=r.slice(l,n),t.base=r.slice(l,o)),t.ext=r.slice(n,o)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let xl,_l;function zx(){return $(this,null,function*(){return null!=xl||(xl=$(this,null,function*(){var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return Te.UNPACK;const e=yield new Promise(l=>{const o=document.createElement("video");o.onloadeddata=()=>l(o),o.onerror=()=>l(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return Te.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(s),null==(r=t.getExtension("WEBGL_lose_context"))||r.loseContext(),n[0]<=n[3]?Te.PMA:Te.UNPACK})),xl})}var Zx={grad:.9,turn:360,rad:360/(2*Math.PI)},ss=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},de=function(r,t,e){return void 0===t&&(t=0),void 0===e&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},ir=function(r,t,e){return void 0===t&&(t=0),void 0===e&&(e=1),r>e?e:r>t?r:t},Bd=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Ld=function(r){return{r:ir(r.r,0,255),g:ir(r.g,0,255),b:ir(r.b,0,255),a:ir(r.a)}},bl=function(r){return{r:de(r.r),g:de(r.g),b:de(r.b),a:de(r.a,3)}},Kx=/^#([0-9a-f]{3,8})$/i,la=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Vd=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),l=n-Math.min(t,e,s),o=l?n===t?(e-s)/l:n===e?2+(s-t)/l:4+(t-e)/l:0;return{h:60*(o<0?o+6:o),s:n?l/n*100:0,v:n/255*100,a:i}},Ud=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),l=s*(1-e),o=s*(1-(t-n)*e),a=s*(1-(1-t+n)*e),h=n%6;return{r:255*[s,o,l,l,a,s][h],g:255*[a,s,s,o,l,l][h],b:255*[l,l,a,s,s,o][h],a:i}},Xd=function(r){return{h:Bd(r.h),s:ir(r.s,0,100),l:ir(r.l,0,100),a:ir(r.a)}},Yd=function(r){return{h:de(r.h),s:de(r.s),l:de(r.l),a:de(r.a,3)}},Gd=function(r){return Ud((e=(t=r).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},_n=function(r){return{h:(t=Vd(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},Qx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,t_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,e_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vl={string:[[function(r){var t=Kx.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:4===r.length?de(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?de(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=t_.exec(r)||e_.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ld({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:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=Qx.exec(r)||Jx.exec(r);if(!t)return null;var e,s,i=Xd({h:(e=t[1],s=t[2],void 0===s&&(s="deg"),Number(e)*(Zx[s]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return Gd(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=void 0===i?1:i;return ss(t)&&ss(e)&&ss(s)?Ld({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=void 0===i?1:i;if(!ss(t)||!ss(e)||!ss(s))return null;var l=Xd({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Gd(l)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=void 0===i?1:i;if(!ss(t)||!ss(e)||!ss(s))return null;var o,l=(o={h:Number(t),s:Number(e),v:Number(s),a:Number(n)},{h:Bd(o.h),s:ir(o.s,0,100),v:ir(o.v,0,100),a:ir(o.a)});return Ud(l)},"hsv"]]},Hd=function(r,t){for(var e=0;e=.5},r.prototype.toHex=function(){return e=(t=bl(this.rgba)).r,s=t.g,i=t.b,l=(n=t.a)<1?la(de(255*n)):"","#"+la(e)+la(s)+la(i)+l;var t,e,s,i,n,l},r.prototype.toRgb=function(){return bl(this.rgba)},r.prototype.toRgbString=function(){return e=(t=bl(this.rgba)).r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return Yd(_n(this.rgba))},r.prototype.toHslString=function(){return e=(t=Yd(_n(this.rgba))).h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=Vd(this.rgba),{h:de(t.h),s:de(t.s),v:de(t.v),a:de(t.a,3)};var t},r.prototype.invert=function(){return Lr({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 void 0===t&&(t=.1),Lr(wl(this.rgba,t))},r.prototype.desaturate=function(t){return void 0===t&&(t=.1),Lr(wl(this.rgba,-t))},r.prototype.grayscale=function(){return Lr(wl(this.rgba,-1))},r.prototype.lighten=function(t){return void 0===t&&(t=.1),Lr(Wd(this.rgba,t))},r.prototype.darken=function(t){return void 0===t&&(t=.1),Lr(Wd(this.rgba,-t))},r.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return"number"==typeof t?Lr({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):de(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=_n(this.rgba);return"number"==typeof t?Lr({h:t,s:e.s,l:e.l,a:e.a}):de(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Lr(t).toHex()},r}(),Lr=function(r){return r instanceof Al?r:new Al(r)},jd=[];!function(r){r.forEach(function(t){jd.indexOf(t)<0&&(t(Al,vl),jd.push(t))})}([function i_(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"},s={};for(var i in e)s[e[i]]=i;var n={};r.prototype.toName=function(l){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,a,h=s[this.toHex()];if(h)return h;if(null!=l&&l.closest){var d=this.toRgb(),c=1/0,u="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(o=d,a=n[p],Math.pow(o.r-a.r,2)+Math.pow(o.g-a.g,2)+Math.pow(o.b-a.b,2));mi===e[n]);if(null!==t&&null!==e){const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every(l=>t[l]===e[l])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return(t=t??[])[0]=Math.round(255*e),t[1]=Math.round(255*s),t[2]=Math.round(255*i),t}toRgbArray(t){t=t??[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(t){const[e,s,i,n]=Mo.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,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(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,n=255&this._int;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(255*t<<24)+(s<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).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,s,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}normalize(t){let e,s,i,n;if(("number"==typeof t||t instanceof Number)&&t>=0&&t<=16777215)e=(t>>16&255)/255,s=(t>>8&255)/255,i=(255&t)/255,n=1;else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if("string"==typeof t||"object"==typeof t){if("string"==typeof t){const o=Mo.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const l=Lr(t);l.isValid()&&(({r:e,g:s,b:i,a:n}=l.rgba),e/=255,s/=255,i/=255)}if(void 0===e)throw new Error(`Unable to convert color ${t}`);this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=n,this.refreshInt()}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*s|0)}_clamp(t,e=0,s=1){return"number"==typeof t?Math.min(Math.max(t,e),s):(t.forEach((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}};Ri.shared=new Ri,Ri.temp=new Ri,Ri.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Nt=Ri;function ha(r){return xt(0,"utils.rgb2hex is deprecated, use Color#toNumber instead"),Nt.shared.setValue(r).toNumber()}const $d=function o_(){const r=[],t=[];for(let s=0;s<32;s++)r[s]=s,t[s]=s;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}();function zd(r,t){return $d[t?1:0][r]}function qd(r){if(4===r.BYTES_PER_ELEMENT)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===r.BYTES_PER_ELEMENT){if(r instanceof Uint16Array)return"Uint16Array"}else if(1===r.BYTES_PER_ELEMENT&&r instanceof Uint8Array)return"Uint8Array";return null}function ca(r){return r+=0===r?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,1+(r|=r>>>16)}function Zd(r){return!(r&r-1||!r)}function Kd(r){let t=(r>65535?1:0)<<4,e=((r>>>=t)>255?1:0)<<3;return t|=e,e=((r>>>=e)>15?1:0)<<2,t|=e,e=((r>>>=e)>3?1:0)<<1,t|=e,t|(r>>>=e)>>1}function Mi(r,t,e){const s=r.length;let i;if(t>=s||0===e)return;const n=s-(e=t+e>s?s-t:e);for(i=t;i(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(q||{});const Sl=r=>{if("function"==typeof r||"object"==typeof r&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r=Qr(pt({},"object"!=typeof r.extension?{type:r.extension}:r.extension),{ref:r})}if("object"!=typeof r)throw new Error("Invalid extension type");return"string"==typeof(r=pt({},r)).type&&(r.type=[r.type]),r},rf=(r,t)=>{var e;return null!=(e=Sl(r).priority)?e:t},tt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Sl).forEach(t=>{t.type.forEach(e=>{var s,i;return null==(i=(s=this._removeHandlers)[e])?void 0:i.call(s,t)})}),this},add(...r){return r.map(Sl).forEach(t=>{t.type.forEach(e=>{var s,i;const n=this._addHandlers,l=this._queue;n[e]?null==(s=n[e])||s.call(n,t):(l[e]=l[e]||[],null==(i=l[e])||i.push(t))})}),this},handle(r,t,e){var s;const i=this._addHandlers,n=this._removeHandlers;if(i[r]||n[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,n[r]=e;const l=this._queue;return l[r]&&(null==(s=l[r])||s.forEach(o=>t(o)),delete l[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>rf(n,e)-rf(i,e)))},s=>{const i=t.indexOf(s.ref);-1!==i&&t.splice(i,1)})}};class Il{constructor(t){this.rawBinaryData="number"==typeof t?new ArrayBuffer(t):t instanceof Uint8Array?t.buffer: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 p_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function m_(r){let t="";for(let e=0;e0&&(t+="\nelse "),e=0;--s){const i=Dl[s];if(i.test&&i.test(r,e))return new i(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ur{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,n,l,o,a){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:d}=this;this._aliasCount++;for(let c=0,u=d.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(ur.prototype,{dispatch:{value:ur.prototype.emit},run:{value:ur.prototype.emit}});class bn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ur("setRealSize"),this.onUpdate=new ur("update"),this.onError=new ur("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class ua extends bn{constructor(t,e){var s;const{width:i,height:n}=e||{};if(!i||!n)throw new Error("BufferResource width or height invalid");super(i,n),this.data=t,this.unpackAlignment=null!=(s=e.unpackAlignment)?s:4}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Te.UNPACK);const n=e.realWidth,l=e.realHeight;return s.width===n&&s.height===l?i.texSubImage2D(e.target,0,0,0,n,l,e.format,s.type,this.data):(s.width=n,s.height=l,i.texImage2D(e.target,0,s.internalFormat,n,l,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return null===t||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 y_={scaleMode:Ge.NEAREST,alphaMode:Te.NPM},Nl=class Qi extends nn{constructor(t=null,e=null){super(),e=Object.assign({},Qi.defaultOptions,e);const{alphaMode:s,mipmap:i,anisotropicLevel:n,scaleMode:l,width:o,height:a,wrapMode:h,format:d,type:c,target:u,resolution:f,resourceOptions:p}=e;t&&!(t instanceof bn)&&((t=sf(t,p)).internal=!0),this.resolution=f||Z.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((a||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=n,this._wrapMode=h,this._scaleMode=l,this.format=d,this.type=c,this.target=u,this.alphaMode=s,this.uid=$s(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&a>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return this.setRealSize(t*(s=s||this.resolution),e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Zd(this.realWidth)&&Zd(this.realHeight)}setResolution(t){const e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Es[this.cacheId],delete Vr[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Qi.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,s=Z.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let n=null;i?n=t:(t._pixiId||(t._pixiId=`${e?.pixiIdPrefix||"pixiid"}_${$s()}`),n=t._pixiId);let l=Es[n];if(i&&s&&!l)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return l||(l=new Qi(t,e),l.cacheId=n,Qi.addToCache(l,n)),l}static fromBuffer(t,e,s,i){t=t||new Float32Array(e*s*4);const n=new ua(t,pt({width:e,height:s},i?.resourceOptions));let l,o;return t instanceof Float32Array?(l=j.RGBA,o=st.FLOAT):t instanceof Int32Array?(l=j.RGBA_INTEGER,o=st.INT):t instanceof Uint32Array?(l=j.RGBA_INTEGER,o=st.UNSIGNED_INT):t instanceof Int16Array?(l=j.RGBA_INTEGER,o=st.SHORT):t instanceof Uint16Array?(l=j.RGBA_INTEGER,o=st.UNSIGNED_SHORT):t instanceof Int8Array?(l=j.RGBA,o=st.BYTE):(l=j.RGBA,o=st.UNSIGNED_BYTE),n.internal=!0,new Qi(n,Object.assign({},y_,{type:o,format:l},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Es[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=Es[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Es[t],e}}else if(null!=t&&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))(ye||{});class St{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new St(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}}St.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const pa=[new St,new St,new St,new St];class ot{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=ye.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 ot(0,0,0,0)}clone(){return new ot(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return!(this.width<=0||this.height<=0)&&t>=this.x&&t=this.y&&et.right?t.right:this.right)<=(this.xt.bottom?t.bottom:this.bottom)>(this.y=i||Math.max(o.y,a.y,h.y,d.y)<=n||Math.min(o.y,a.y,h.y,d.y)>=l))return!1;const u=c*(a.y-o.y),f=c*(o.x-a.x),p=u*s+f*n,m=u*i+f*n,g=u*s+f*l,x=u*i+f*l;if(Math.max(p,m,g,x)<=u*o.x+f*o.y||Math.min(p,m,g,x)>=u*d.x+f*d.y)return!1;const y=c*(o.y-h.y),_=c*(h.x-o.x),b=y*s+_*n,v=y*i+_*n,w=y*s+_*l,E=y*i+_*l;return!(Math.max(b,v,w,E)<=y*o.x+_*o.y||Math.min(b,v,w,E)>=y*d.x+_*d.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}}ot.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ma{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=ye.CIRC}clone(){return new ma(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=this.radius*this.radius}getBounds(){return new ot(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}ma.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ga{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=ye.ELIP}clone(){return new ga(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new ot(this.x-this.width,this.y-this.height,this.width,this.height)}}ga.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ts{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const s=[];for(let i=0,n=e.length;ie!=d>e&&t<(e-a)/(d-a)*(this.points[2*l]-o)+o&&(s=!s)}return s}}Ts.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class ya{constructor(t=0,e=0,s=0,i=0,n=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n,this.type=ye.RREC}clone(){return new ya(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const l=s*s;if(i*i+n*n<=l||(i=t-(this.x+this.width-s),i*i+n*n<=l)||(n=e-(this.y+this.height-s),i*i+n*n<=l)||(i=t-(this.x+s),i*i+n*n<=l))return!0}return!1}}ya.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class kt{constructor(t=1,e=0,s=0,i=1,n=0,l=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=l}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,n,l){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=l,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new St;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new St;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*s*i+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,l=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=l*e-this.ty*s,this.ty=l*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,i,n,l,o,a,h){return this.a=Math.cos(o+h)*n,this.b=Math.sin(o+h)*n,this.c=-Math.sin(o-a)*l,this.d=Math.cos(o-a)*l,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,l=t.pivot,o=-Math.atan2(-i,n),a=Math.atan2(s,e),h=Math.abs(o+a);return h<1e-5||Math.abs(fa-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(l.x*e+l.y*i),t.position.y=this.ty+(l.x*s+l.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,l=t*i-e*s;return this.a=i/l,this.b=-e/l,this.c=-s/l,this.d=t/l,this.tx=(s*this.ty-i*n)/l,this.ty=-(t*this.ty-e*n)/l,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 kt;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 kt}static get TEMP_MATRIX(){return new kt}}kt.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 zs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],qs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ks=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Bl=[],of=[],xa=Math.sign;!function T_(){for(let r=0;r<16;r++){const t=[];Bl.push(t);for(let e=0;e<16;e++){const s=xa(zs[r]*zs[e]+Zs[r]*qs[e]),i=xa(qs[r]*zs[e]+Ks[r]*qs[e]),n=xa(zs[r]*Zs[e]+Zs[r]*Ks[e]),l=xa(qs[r]*Zs[e]+Ks[r]*Ks[e]);for(let o=0;o<16;o++)if(zs[o]===s&&qs[o]===i&&Zs[o]===n&&Ks[o]===l){t.push(o);break}}}for(let r=0;r<16;r++){const t=new kt;t.set(zs[r],qs[r],Zs[r],Ks[r],0,0),of.push(t)}}();const Lt={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=>zs[r],uY:r=>qs[r],vX:r=>Zs[r],vY:r=>Ks[r],inv:r=>8&r?15&r:7&-r,add:(r,t)=>Bl[r][t],sub:(r,t)=>Bl[r][Lt.inv(t)],rotate180:r=>4^r,isVertical:r=>2==(3&r),byDirection:(r,t)=>2*Math.abs(r)<=Math.abs(t)?t>=0?Lt.S:Lt.N:2*Math.abs(t)<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=of[Lt.inv(t)];i.tx=e,i.ty=s,r.append(i)}};class ns{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ns(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))}}ns.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Ll=class{constructor(){this.worldTransform=new kt,this.localTransform=new kt,this.position=new ns(this.onChange,this,0,0),this.scale=new ns(this.onChange,this,1,1),this.pivot=new ns(this.onChange,this,0,0),this.skew=new ns(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,s=this.worldTransform;s.a=t.a*e.a+t.b*e.c,s.b=t.a*e.b+t.b*e.d,s.c=t.c*e.a+t.d*e.c,s.d=t.c*e.b+t.d*e.d,s.tx=t.tx*e.a+t.ty*e.c+e.tx,s.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())}};Ll.IDENTITY=new Ll;let _a=Ll;function lf(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function Vl(r){const t=new Array(r);for(let e=0;e"float"===r.type&&1===r.size&&!r.isArray,code:r=>`\n if(uv["${r}"] !== ud["${r}"].value)\n {\n ud["${r}"].value = uv["${r}"]\n gl.uniform1f(ud["${r}"].location, uv["${r}"])\n }\n `},{test:(r,t)=>!("sampler2D"!==r.type&&"samplerCube"!==r.type&&"sampler2DArray"!==r.type||1!==r.size||r.isArray||null!=t&&void 0===t.castToBaseTexture),code:r=>`t = syncData.textureCount++;\n\n renderer.texture.bind(uv["${r}"], t);\n\n if(ud["${r}"].value !== t)\n {\n ud["${r}"].value = t;\n gl.uniform1i(ud["${r}"].location, t);\n; // eslint-disable-line max-len\n }`},{test:(r,t)=>"mat3"===r.type&&1===r.size&&!r.isArray&&void 0!==t.a,code:r=>`\n gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true));\n `,codeUbo:r=>`\n var ${r}_matrix = uv.${r}.toArray(true);\n\n data[offset] = ${r}_matrix[0];\n data[offset+1] = ${r}_matrix[1];\n data[offset+2] = ${r}_matrix[2];\n \n data[offset + 4] = ${r}_matrix[3];\n data[offset + 5] = ${r}_matrix[4];\n data[offset + 6] = ${r}_matrix[5];\n \n data[offset + 8] = ${r}_matrix[6];\n data[offset + 9] = ${r}_matrix[7];\n data[offset + 10] = ${r}_matrix[8];\n `},{test:(r,t)=>"vec2"===r.type&&1===r.size&&!r.isArray&&void 0!==t.x,code:r=>`\n cv = ud["${r}"].value;\n v = uv["${r}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["${r}"].location, v.x, v.y);\n }`,codeUbo:r=>`\n v = uv.${r};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `},{test:r=>"vec2"===r.type&&1===r.size&&!r.isArray,code:r=>`\n cv = ud["${r}"].value;\n v = uv["${r}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["${r}"].location, v[0], v[1]);\n }\n `},{test:(r,t)=>"vec4"===r.type&&1===r.size&&!r.isArray&&void 0!==t.width,code:r=>`\n cv = ud["${r}"].value;\n v = uv["${r}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height)\n }`,codeUbo:r=>`\n v = uv.${r};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `},{test:(r,t)=>"vec4"===r.type&&1===r.size&&!r.isArray&&void 0!==t.red,code:r=>`\n cv = ud["${r}"].value;\n v = uv["${r}"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha)\n }`,codeUbo:r=>`\n v = uv.${r};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n data[offset+3] = v.alpha;\n `},{test:(r,t)=>"vec3"===r.type&&1===r.size&&!r.isArray&&void 0!==t.red,code:r=>`\n cv = ud["${r}"].value;\n v = uv["${r}"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n \n gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue)\n }`,codeUbo:r=>`\n v = uv.${r};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n `},{test:r=>"vec4"===r.type&&1===r.size&&!r.isArray,code:r=>`\n cv = ud["${r}"].value;\n v = uv["${r}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])\n }`}],R_={float:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",vec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",int:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",ivec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",ivec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",ivec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",uint:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",uvec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",uvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",uvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",bvec2:"\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",bvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",bvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",samplerCube:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",sampler2DArray:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }"},M_={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)"},cf={};let ba,vn=cf;function uf(r,t){const e=r.getShaderSource(t).split("\n").map((h,d)=>`${d}: ${h}`),i=r.getShaderInfoLog(t).split("\n"),n={},l=i.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>!(!h||n[h]||(n[h]=!0,0))),o=[""];l.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const a=e.join("\n");o[0]=a}const D_={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 df(r){return D_[r]}let va=null;const ff={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 pf(r,t){if(!va){const e=Object.keys(ff);va={};for(let s=0;s=Xs.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),vn=t}return vn}();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(ba=t.precision?sr.HIGH:sr.MEDIUM)}}return ba}())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"}static from(t,e,s){const i=t+e;let n=Jd[i];return n||(Jd[i]=n=new Ji(t,e,s)),n}};Ul.defaultVertexPrecision=sr.HIGH,Ul.defaultFragmentPrecision=ts.apple.device?sr.HIGH:sr.MEDIUM;let as=Ul,B_=0;class dr{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=B_++,this.static=!!e,this.ubo=!!s,t instanceof Kt?(this.buffer=t,this.buffer.type=Fr.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Kt(new Float32Array(1)),this.buffer.type=Fr.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,s){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[t]=new dr(e,s)}static from(t,e,s){return new dr(t,e,s)}static uboFrom(t,e){return new dr(t,e??!0,!0)}}class Xr{constructor(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof dr?e:new dr(e):new dr({}),this.disposeRunner=new ur("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const i=e.uniforms[s];if(!0===i.group&&this.checkUniformExists(t,i))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,s){const i=as.from(t,e);return new Xr(i,s)}}class L_{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const s=new Int32Array(t);for(let n=0;n0&&(e+="\nelse "),sthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=Ir._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,l=this.renderer.textureGC.count;let o=++it._globalBatch,a=0,h=s[0],d=0;i.copyBoundTextures(n,e);for(let c=0;c=e&&(i.boundArray(h,n,o,e),this.buildDrawCalls(h,d,c),d=c,h=s[++a],++o),u._batchEnabled=o,u.touched=l,h.elements[h.count++]=u)}h.count>0&&(i.boundArray(h,n,o,e),this.buildDrawCalls(h,d,this._bufferSize),++a,++o);for(let c=0;c0);for(let m=0;m=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:n,ids:l,count:o}=t;let a=0;for(let h=0;h=0&&c=Xs.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={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"),bptc:t.getExtension("EXT_texture_compression_bptc")};1===this.webGLVersion?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")}):2===this.webGLVersion&&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,void 0!==t.removeEventListener&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){t.getContextAttributes();const s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2);const i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i}}Ta.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ta.extension={type:q.RendererSystem,name:"context"},tt.add(Ta);class Gl{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 ur("disposeFramebuffer"),this.multisample=$t.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new it(null,{scaleMode:Ge.NEAREST,resolution:1,mipmap:rr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new it(null,{scaleMode:Ge.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:rr.OFF,format:j.DEPTH_COMPONENT,type:st.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 s=0;s{const i=this.source;this.url=i.src;const n=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,e(this.createBitmap?this.process():this))};i.complete&&i.src?n():(i.onload=n,i.onerror=l=>{s(l),this.onError.emit(l)})})),this._load}process(){const t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap;return this._process=fetch(t.src,{mode:t.crossOrigin&&"anonymous"!==t.crossOrigin?"no-cors":"cors"}).then(i=>i.blob()).then(i=>e(i,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===Te.UNPACK?"premultiply":"none"})).then(i=>this.destroyed?Promise.reject():(this.bitmap=i,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let i=!0;const n=e._glTextures;for(const l in n){const o=n[l];if(o!==s&&o.dirtyId!==e.dirtyId){i=!1;break}}i&&(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"&&("string"==typeof t||t instanceof HTMLImageElement)}}class Hl{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,s){const i=e.width,n=e.height;if(s){const l=t.width/2/i,o=t.height/2/n,a=t.x/i+l,h=t.y/n+o;s=Lt.add(s,Lt.NW),this.x0=a+l*Lt.uX(s),this.y0=h+o*Lt.uY(s),s=Lt.add(s,2),this.x1=a+l*Lt.uX(s),this.y1=h+o*Lt.uY(s),s=Lt.add(s,2),this.x2=a+l*Lt.uX(s),this.y2=h+o*Lt.uY(s),s=Lt.add(s,2),this.x3=a+l*Lt.uX(s),this.y3=h+o*Lt.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,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}}Hl.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 bf=new Hl;function Sa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class et extends nn{constructor(t,e,s,i,n,l,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new ot(0,0,1,1)),t instanceof et&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=bf,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),!0===n)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=l?new St(l.x,l.y):new St(0,0),this.defaultBorders=o,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;null!=e&&e.url&&Vr[e.url]&&et.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,et.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),i=new et(this.baseTexture,!this.noFrame&&e,s,null==(t=this.trim)?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===bf&&(this._uvs=new Hl),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=Z.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let n=null;i?n=t:t instanceof it?(t.cacheId||(t.cacheId=`${e?.pixiIdPrefix||"pixiid"}-${$s()}`,it.addToCache(t,t.cacheId)),n=t.cacheId):(t._pixiId||(t._pixiId=`${e?.pixiIdPrefix||"pixiid"}_${$s()}`),n=t._pixiId);let l=Vr[n];if(i&&s&&!l)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return l||t instanceof it?!l&&t instanceof it&&(l=new et(t),et.addToCache(l,n)):(e.resolution||(e.resolution=is(t)),l=new et(new it(t,e)),l.baseTexture.cacheId=n,it.addToCache(l.baseTexture,n),et.addToCache(l,n)),l}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e?.resourceOptions),i=et.from(t,Object.assign({resourceOptions:s},e),!1),n=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):n.load().then(()=>Promise.resolve(i))}static fromBuffer(t,e,s,i){return new et(it.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const n=new it(t,Object.assign({scaleMode:it.defaultOptions.scaleMode,resolution:is(e)},i)),{resource:l}=n;l instanceof _f&&(l.url=e);const o=new et(n);return s||(s=e),it.addToCache(o.baseTexture,s),et.addToCache(o,s),s!==e&&(it.addToCache(o.baseTexture,e),et.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(a=>{o.baseTexture.once("loaded",()=>a(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Vr[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=Vr[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Vr[t],e}}else if(null!=t&&t.textureCacheIds){for(let e=0;ethis.baseTexture.width,o=s+n>this.baseTexture.height;if(l||o)throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width} ${l&&o?"and":"or"} Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`);this.valid=i&&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 et._EMPTY||(et._EMPTY=new et(new it),Sa(et._EMPTY),Sa(et._EMPTY.baseTexture)),et._EMPTY}static get WHITE(){if(!et._WHITE){const t=Z.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),et._WHITE=new et(it.from(t)),Sa(et._WHITE),Sa(et._WHITE.baseTexture)}return et._WHITE}}class Js extends et{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const i=this.baseTexture.resolution,n=Math.round(t*i)/i,l=Math.round(e*i)/i;this.valid=n>0&&l>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=l,s&&this.baseTexture.resize(n,l),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 Js(new xf(t))}}class vf{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=$t.NONE){const i=new xf(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Js(i)}getOptimalTexture(t,e,s=1,i=$t.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?n=i>1?-i:-1:(n=((65535&(t=ca(t)))<<16|65535&(e=ca(e)))>>>0,i>1&&(n+=4294967296*i)),this.texturePool[n]||(this.texturePool[n]=[]);let l=this.texturePool[n].pop();return l||(l=this.createTexture(t,e,i)),l.filterPoolKey=n,l.setResolution(s),l}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||$t.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!1!==t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let i=0;i0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let i=0;i1&&(d=this.getOptimalFilterTexture(h.width,h.height,e.resolution),d.filterFrame=h.filterFrame),s[c].apply(this,h,d,kr.CLEAR,e);const u=h;h=d,d=u}s[c].apply(this,h,a.renderTexture,kr.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(d)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=kr.CLEAR){const{renderTexture:s,state:i}=this.renderer;if(this.renderer.projection.transform=t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.activeState.transform:null,t?.filterFrame){const l=this.tempRect;l.x=0,l.y=0,l.width=t.filterFrame.width,l.height=t.filterFrame.height,s.bind(t,t.filterFrame,l)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);(e===kr.CLEAR||e===kr.BLIT&&(1&i.stateId||this.forceClear))&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,i),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(hr.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(hr.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:i}=this.activeState,{orig:n}=e._texture,l=t.set(i.width,0,0,i.height,s.x,s.y),o=e.worldTransform.copyTo(kt.TEMP_MATRIX);return o.invert(),l.prepend(o),l.scale(1/n.width,1/n.height),l.translate(e.anchor.x,e.anchor.y),l}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,i=$t.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if("number"==typeof t){const n=t;t=e,e=n}const i=this.texturePool.getOptimalTexture((t=t||this.activeState.renderTexture).width,t.height,e||t.resolution,s||$t.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Ia[0],i=Ia[1],n=Ia[2],l=Ia[3];s.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),l.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(n,n),t.apply(l,l);const o=Math.min(s.x,i.x,n.x,l.x),a=Math.min(s.y,i.y,n.y,l.y),h=Math.max(s.x,i.x,n.x,l.x),d=Math.max(s.y,i.y,n.y,l.y);e.x=o,e.y=a,e.width=h-o,e.height=d-a}roundFrame(t,e,s,i,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a:l,b:o,c:a,d:h}=n;if((Math.abs(o)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(l)>1e-4||Math.abs(h)>1e-4))return}(n=n?Wl.copyFrom(n):Wl.identity()).translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Ef.extension={type:q.RendererSystem,name:"filter"},tt.add(Ef);class $_{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=$t.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const z_=new ot;class Af{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Gl(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 ot,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;Z.PREFER_ENV===Xs.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=i=>e.drawBuffersWEBGL(i):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:i}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let l=0;l>s,a=l/e.width;this.setViewport(e.x*a,e.y*a,l,e.height>>s)}else this.setViewport(0,0,t.width>>s,t.height>>s)}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,i){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(n.width!==s||n.height!==i||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=i,this.gl.viewport(t,e,s,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,i,n=Do.COLOR|Do.DEPTH){const{gl:l}=this;l.clearColor(t,e,s,i),l.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new $_(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){let l;e.bindRenderbuffer(e.RENDERBUFFER,s.stencil),l=1===this.renderer.context.webGLVersion?e.DEPTH_STENCIL:t.depth&&t.stencil?e.DEPTH24_STENCIL8:t.depth?e.DEPTH_COMPONENT24:e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,l,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,l,t.width,t.height)}const i=t.colorTextures;let n=i.length;e.drawBuffers||(n=Math.min(n,1));for(let l=0;l1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const o=[];for(let a=0;a1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const a=t.depthTexture;this.renderer.texture.bind(a,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,a._glTextures[this.CONTEXT_UID].texture,e)}if(!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture)i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null);else{let a,h;i.stencil=i.stencil||s.createRenderbuffer(),1===this.renderer.context.webGLVersion?(a=s.DEPTH_STENCIL_ATTACHMENT,h=s.DEPTH_STENCIL):t.depth&&t.stencil?(a=s.DEPTH_STENCIL_ATTACHMENT,h=s.DEPTH24_STENCIL8):t.depth?(a=s.DEPTH_ATTACHMENT,h=s.DEPTH_COMPONENT24):(a=s.STENCIL_ATTACHMENT,h=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,h,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,h,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,a,s.RENDERBUFFER,i.stencil)}}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=$t.NONE;if(t<=1||null===e)return s;for(let i=0;i=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;ss.createVertexArrayOES(),t.bindVertexArray=i=>s.bindVertexArrayOES(i),t.deleteVertexArray=i=>s.deleteVertexArrayOES(i)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(i,n)=>s.vertexAttribDivisorANGLE(i,n),t.drawElementsInstanced=(i,n,l,o,a)=>s.drawElementsInstancedANGLE(i,n,l,o,a),t.drawArraysInstanced=(i,n,l,o)=>s.drawArraysInstancedANGLE(i,n,l,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let i=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},n=!0);const l=i[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==l&&(this._activeVao=l,this.hasVao?s.bindVertexArray(l):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);const s=this.mapCoord;for(let i=0;i0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==t._colorMask&&this.renderer.gl.colorMask(!!(1&s),!!(2&s),!!(4&s),!!(8&s))}destroy(){this.renderer=null}}Rf.extension={type:q.RendererSystem,name:"mask"},tt.add(Rf);class Mf{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==s&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Cf=new kt,Pf=[],kf=class Co extends Mf{constructor(t){super(t),this.glConst=Z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:i}=t,{renderer:n}=this,l=n.renderTexture,o=i.getBounds(!0,null!=(e=Pf.pop())?e:new ot);this.roundFrameToPixels(o,l.current?l.current.resolution:n.resolution,l.sourceFrame,l.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Co.isMatrixRotated(e.worldTransform)||Co.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,i,n){Co.isMatrixRotated(n)||((n=n?Cf.copyFrom(n):Cf.identity()).translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.renderer.filter.transformAABB(n,t),t.fit(i),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Pf.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};kf.extension={type:q.RendererSystem,name:"scissor"},tt.add(kf);class Ff extends Mf{constructor(t){super(t),this.glConst=Z.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;0!==n&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,i,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==n&&(t._colorMask=n,s.colorMask(!!(1&n),!!(2&n),!!(4&n),!!(8&n))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const s=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=s?s._colorMask:15;0!==i&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==i&&(s._colorMask=i,e.colorMask(!!(1&i),!!(2&i),!!(4&i),!!(8&i))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Ff.extension={type:q.RendererSystem,name:"stencil"},tt.add(Ff);class Df{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(xt(0,"renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(xt(0,"renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(xt(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}}Df.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"_plugin"},tt.add(Df);class Nf{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new kt,this.transform=null}update(t,e,s,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,i){const n=this.projectionMatrix,l=i?-1:1;n.identity(),n.a=1/e.width*2,n.d=l*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-l-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Nf.extension={type:q.RendererSystem,name:"projection"},tt.add(Nf);const tb=new _a,Of=new ot;class Bf{constructor(t){this.renderer=t,this._tempMatrix=new kt}generateTexture(t,e){const i=e||{},{region:n}=i,l=xs(i,["region"]),o=n?.copyTo(Of)||t.getLocalBounds(Of,!0),a=l.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/a),o.height=Math.max(o.height,1/a),l.width=o.width,l.height=o.height,l.resolution=a,null!=l.multisample||(l.multisample=this.renderer.multisample);const h=Js.create(l);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const d=t.transform;return t.transform=tb,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=d,h}destroy(){}}Bf.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"textureGenerator"},tt.add(Bf);const ti=new ot,An=new ot;class Lf{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ot,this.destinationFrame=new ot,this.viewportFrame=new ot}contextChange(){var t;const e=null==(t=this.renderer)?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const i=this.renderer;let n,l,o;this.current=t,t?(n=t.baseTexture,o=n.resolution,e||(ti.width=t.frame.width,ti.height=t.frame.height,e=ti),s||(An.x=t.frame.x,An.y=t.frame.y,An.width=e.width,An.height=e.height,s=An),l=n.framebuffer):(o=i.resolution,e||(ti.width=i._view.screen.width,ti.height=i._view.screen.height,e=ti),s||((s=ti).width=e.width,s.height=e.height));const a=this.viewportFrame;a.x=s.x*o,a.y=s.y*o,a.width=s.width*o,a.height=s.height*o,t||(a.y=i.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(l,a),this.renderer.projection.update(s,e,o,!l),this.renderer.mask.setMaskStack(t?n.maskStack:this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const i=Nt.shared.setValue(t||(this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor));(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const n=this.destinationFrame,l=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==l.width||n.height!==l.height;if(o){let{x:a,y:h,width:d,height:c}=this.viewportFrame;a=Math.round(a),h=Math.round(h),d=Math.round(d),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(a,h,d,c)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Lf.extension={type:q.RendererSystem,name:"renderTexture"},tt.add(Lf);class eb{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 nb(r,t,e,s,i){e.buffer.update(i)}const ab={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},Vf={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};let cb=0;const Ra={textureCount:0,uboCount:0};class Uf{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=cb++}systemCheck(){if(!function N_(){if("boolean"==typeof wn)return wn;try{wn=!0===new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")}catch{wn=!1}return wn}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(Ra.textureCount=0,Ra.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ra)),i}setUniforms(t){const e=this.shader.program;e.syncUniforms(e.glPrograms[this.renderer.CONTEXT_UID].uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function C_(r,t){var e;const s=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];for(const i in r.uniforms){const n=t[i];if(!n){!0===(null==(e=r.uniforms[i])?void 0:e.group)&&s.push(r.uniforms[i].ubo?`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `:`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);continue}const l=r.uniforms[i];let o=!1;for(let a=0;as.index-i.index),e}(r.uniforms,t),{uboElements:s,size:i}=function ob(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,i=0;for(let n=0;n1&&(e=Math.max(e,16)*l.data.size),l.dataLen=e,s%e!=0&&s<16){const o=s%e%16;s+=o,i+=o}s+e>16?(i=16*Math.ceil(i/16),l.offset=i,i+=e,s=e):(l.offset=i,s+=e,i+=e)}return i=16*Math.ceil(i/16),{uboElements:t,size:i}}(e),n=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "];for(let l=0;l1){const c=df(o.data.type),u=Math.max(Vf[o.data.type]/16,1),f=c/u;n.push(`\n cv = ud.${h}.value;\n v = uv.${h};\n offset = ${o.offset/4};\n\n t = 0;\n\n for(var i=0; i < ${o.data.size*u}; i++)\n {\n for(var j = 0; j < ${f}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${(4-f%4)%4};\n }\n\n `)}else n.push(`\n cv = ud.${h}.value;\n v = uv.${h};\n offset = ${o.offset/4};\n ${ab[o.data.type]};\n `)}return n.push("\n renderer.buffer.update(buffer);\n "),{size:i,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join("\n"))}}(t,this.shader.program.uniformData)),t.autoManage){const a=new Float32Array(o.size/4);t.buffer.update(a)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const l in i)n.push(l),e[l]&&n.push(e[l].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const s=t.program,i=function ib(r,t){var e;const s=lf(r,r.VERTEX_SHADER,t.vertexSrc),i=lf(r,r.FRAGMENT_SHADER,t.fragmentSrc),n=r.createProgram();r.attachShader(n,s),r.attachShader(n,i);const l=null==(e=t.extra)?void 0:e.transformFeedbackVaryings;if(l&&("function"!=typeof r.transformFeedbackVaryings||r.transformFeedbackVaryings(n,l.names,"separate"===l.bufferMode?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(n),r.getProgramParameter(n,r.LINK_STATUS)||function F_(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||uf(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||uf(r,s),r.getProgramInfoLog(t))}(r,n,s,i),t.attributeData=function rb(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let i=0;ih>d?1:-1);for(let h=0;h>=1,s++;this.stateId=t.data}for(let e=0;et.systems[n]),i=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of i)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ur(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(i=>{const n=s.find(l=>this._systemsHash[l]===i);i[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Tn=class Po{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Po.defaultMaxIdle,this.checkCountMax=Po.defaultCheckCountMax,this.mode=Po.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==No.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,s=!0)}if(s){let i=0;for(let n=0;n=0;i--)this.unload(t.children[i])}destroy(){this.renderer=null}};Tn.defaultMode=No.AUTO,Tn.defaultMaxIdle=3600,Tn.defaultCheckCountMax=600,Tn.extension={type:q.RendererSystem,name:"textureGC"};let ei=Tn;tt.add(ei);class $l{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=st.UNSIGNED_BYTE,this.internalFormat=j.RGBA,this.samplerType=0}}class Yf{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new it,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function vb(r){let t;return t="WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?{[st.UNSIGNED_BYTE]:{[j.RGBA]:r.RGBA8,[j.RGB]:r.RGB8,[j.RG]:r.RG8,[j.RED]:r.R8,[j.RGBA_INTEGER]:r.RGBA8UI,[j.RGB_INTEGER]:r.RGB8UI,[j.RG_INTEGER]:r.RG8UI,[j.RED_INTEGER]:r.R8UI,[j.ALPHA]:r.ALPHA,[j.LUMINANCE]:r.LUMINANCE,[j.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[st.BYTE]:{[j.RGBA]:r.RGBA8_SNORM,[j.RGB]:r.RGB8_SNORM,[j.RG]:r.RG8_SNORM,[j.RED]:r.R8_SNORM,[j.RGBA_INTEGER]:r.RGBA8I,[j.RGB_INTEGER]:r.RGB8I,[j.RG_INTEGER]:r.RG8I,[j.RED_INTEGER]:r.R8I},[st.UNSIGNED_SHORT]:{[j.RGBA_INTEGER]:r.RGBA16UI,[j.RGB_INTEGER]:r.RGB16UI,[j.RG_INTEGER]:r.RG16UI,[j.RED_INTEGER]:r.R16UI,[j.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[st.SHORT]:{[j.RGBA_INTEGER]:r.RGBA16I,[j.RGB_INTEGER]:r.RGB16I,[j.RG_INTEGER]:r.RG16I,[j.RED_INTEGER]:r.R16I},[st.UNSIGNED_INT]:{[j.RGBA_INTEGER]:r.RGBA32UI,[j.RGB_INTEGER]:r.RGB32UI,[j.RG_INTEGER]:r.RG32UI,[j.RED_INTEGER]:r.R32UI,[j.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[st.INT]:{[j.RGBA_INTEGER]:r.RGBA32I,[j.RGB_INTEGER]:r.RGB32I,[j.RG_INTEGER]:r.RG32I,[j.RED_INTEGER]:r.R32I},[st.FLOAT]:{[j.RGBA]:r.RGBA32F,[j.RGB]:r.RGB32F,[j.RG]:r.RG32F,[j.RED]:r.R32F,[j.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[st.HALF_FLOAT]:{[j.RGBA]:r.RGBA16F,[j.RGB]:r.RGB16F,[j.RG]:r.RG16F,[j.RED]:r.R16F},[st.UNSIGNED_SHORT_5_6_5]:{[j.RGB]:r.RGB565},[st.UNSIGNED_SHORT_4_4_4_4]:{[j.RGBA]:r.RGBA4},[st.UNSIGNED_SHORT_5_5_5_1]:{[j.RGBA]:r.RGB5_A1},[st.UNSIGNED_INT_2_10_10_10_REV]:{[j.RGBA]:r.RGB10_A2,[j.RGBA_INTEGER]:r.RGB10_A2UI},[st.UNSIGNED_INT_10F_11F_11F_REV]:{[j.RGB]:r.R11F_G11F_B10F},[st.UNSIGNED_INT_5_9_9_9_REV]:{[j.RGB]:r.RGB9_E5},[st.UNSIGNED_INT_24_8]:{[j.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[st.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[j.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:{[st.UNSIGNED_BYTE]:{[j.RGBA]:r.RGBA,[j.RGB]:r.RGB,[j.ALPHA]:r.ALPHA,[j.LUMINANCE]:r.LUMINANCE,[j.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[st.UNSIGNED_SHORT_5_6_5]:{[j.RGB]:r.RGB},[st.UNSIGNED_SHORT_4_4_4_4]:{[j.RGBA]:r.RGBA},[st.UNSIGNED_SHORT_5_5_5_1]:{[j.RGBA]:r.RGBA}},t}(t),this.samplerTypes=function bb(r){let t;return t="WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?{[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.R8]:J.FLOAT,[r.R8_SNORM]:J.FLOAT,[r.RG8]:J.FLOAT,[r.RG8_SNORM]:J.FLOAT,[r.RGB8]:J.FLOAT,[r.RGB8_SNORM]:J.FLOAT,[r.RGB565]:J.FLOAT,[r.RGBA4]:J.FLOAT,[r.RGB5_A1]:J.FLOAT,[r.RGBA8]:J.FLOAT,[r.RGBA8_SNORM]:J.FLOAT,[r.RGB10_A2]:J.FLOAT,[r.RGB10_A2UI]:J.FLOAT,[r.SRGB8]:J.FLOAT,[r.SRGB8_ALPHA8]:J.FLOAT,[r.R16F]:J.FLOAT,[r.RG16F]:J.FLOAT,[r.RGB16F]:J.FLOAT,[r.RGBA16F]:J.FLOAT,[r.R32F]:J.FLOAT,[r.RG32F]:J.FLOAT,[r.RGB32F]:J.FLOAT,[r.RGBA32F]:J.FLOAT,[r.R11F_G11F_B10F]:J.FLOAT,[r.RGB9_E5]:J.FLOAT,[r.R8I]:J.INT,[r.R8UI]:J.UINT,[r.R16I]:J.INT,[r.R16UI]:J.UINT,[r.R32I]:J.INT,[r.R32UI]:J.UINT,[r.RG8I]:J.INT,[r.RG8UI]:J.UINT,[r.RG16I]:J.INT,[r.RG16UI]:J.UINT,[r.RG32I]:J.INT,[r.RG32UI]:J.UINT,[r.RGB8I]:J.INT,[r.RGB8UI]:J.UINT,[r.RGB16I]:J.INT,[r.RGB16UI]:J.UINT,[r.RGB32I]:J.INT,[r.RGB32UI]:J.UINT,[r.RGBA8I]:J.INT,[r.RGBA8UI]:J.UINT,[r.RGBA16I]:J.INT,[r.RGBA16UI]:J.UINT,[r.RGBA32I]:J.INT,[r.RGBA32UI]:J.UINT,[r.DEPTH_COMPONENT16]:J.FLOAT,[r.DEPTH_COMPONENT24]:J.FLOAT,[r.DEPTH_COMPONENT32F]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT,[r.DEPTH24_STENCIL8]:J.FLOAT,[r.DEPTH32F_STENCIL8]:J.FLOAT}:{[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT},t}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let i=0;i=0;--n){const l=e[n];l&&l._glTextures[i].samplerType!==J.FLOAT&&this.renderer.texture.unbind(l)}}initTexture(t){const e=new $l(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 s,i,n;e.internalFormat=null!=(i=null==(s=this.internalFormats[t.type])?void 0:s[t.format])?i:t.format,e.samplerType=null!=(n=this.samplerTypes[e.internalFormat])?n:J.FLOAT,e.type=2===this.webGLVersion&&t.type===st.HALF_FLOAT?this.gl.HALF_FLOAT:t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const i=this.renderer;if(this.initTextureType(t,s),null==(e=t.resource)?void 0:e.upload(i,t,s))s.samplerType!==J.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,l=t.realHeight,o=i.gl;(s.width!==n||s.height!==l||s.dirtyId<0)&&(s.width=n,s.height=l,o.texImage2D(t.target,0,s.internalFormat,n,l,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const i=this.managedTextures.indexOf(t);-1!==i&&Mi(this.managedTextures,i,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&(s.mipmap=!!(t.mipmap!==rr.POW2&&2===this.webGLVersion||t.isPowerOfTwo)&&t.mipmap>=1,s.wrapMode=2===this.webGLVersion||t.isPowerOfTwo?t.wrapMode:_s.CLAMP,null!=(e=t.resource)&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==rr.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Ge.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const i=this.renderer.context.extensions.anisotropicFiltering;if(i&&t.anisotropicLevel>0&&t.scaleMode===Ge.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,i.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Ge.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===Ge.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Yf.extension={type:q.RendererSystem,name:"texture"},tt.add(Yf);class Gf{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[i]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let l=0;lit.defaultOptions.wrapMode,set(r){xt(0,"settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),it.defaultOptions.wrapMode=r}},SCALE_MODE:{get:()=>it.defaultOptions.scaleMode,set(r){xt(0,"settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),it.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get:()=>it.defaultOptions.mipmap,set(r){xt(0,"settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),it.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get:()=>it.defaultOptions.anisotropicLevel,set(r){xt(0,"settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),it.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get:()=>(xt(0,"settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Se.defaultResolution),set(r){Se.defaultResolution=r}},FILTER_MULTISAMPLE:{get:()=>(xt(0,"settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Se.defaultMultisample),set(r){Se.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get:()=>Qs.defaultMaxTextures,set(r){xt(0,"settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Qs.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get:()=>Qs.defaultBatchSize,set(r){xt(0,"settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Qs.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get:()=>Qs.canUploadSameBuffer,set(r){xt(0,"settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Qs.canUploadSameBuffer=r}},GC_MODE:{get:()=>ei.defaultMode,set(r){xt(0,"settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ei.defaultMode=r}},GC_MAX_IDLE:{get:()=>ei.defaultMaxIdle,set(r){xt(0,"settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ei.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get:()=>ei.defaultCheckCountMax,set(r){xt(0,"settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ei.defaultCheckCountMax=r}},PRECISION_VERTEX:{get:()=>as.defaultVertexPrecision,set(r){xt(0,"settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),as.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get:()=>as.defaultFragmentPrecision,set(r){xt(0,"settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),as.defaultFragmentPrecision=r}}});var ri=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ri||{});class zl{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Hf=class tr{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 zl(null,null,1/0),this.deltaMS=1/tr.targetFPMS,this.elapsedMS=1/tr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=ri.NORMAL){return this._addListener(new zl(t,e,s))}addOnce(t,e,s=ri.NORMAL){return this._addListener(new zl(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}else t.connect(s);return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s=s.match(t,e)?s.destroy():s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(nHe.targetFPMS,set(r){xt(0,"settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),He.targetFPMS=r}}});class Wf{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,ri.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?He.shared:new He,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Wf.extension=q.Application,tt.add(Wf);const jf=[];tt.handleByList(q.Renderer,jf);const $f="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";class zf{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}this.multisample=e>=$t.HIGH?$t.HIGH:e>=$t.MEDIUM?$t.MEDIUM:e>=$t.LOW?$t.LOW:$t.NONE}destroy(){}}zf.extension={type:q.RendererSystem,name:"_multisample"},tt.add(zf);class Sb{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class qf{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:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:n}=this;s=s||0;const l=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,l.buffer,256*s,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.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 s=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s"u"&&(_l=function(){var r;const t={stencil:!0,failIfMajorPerformanceCaveat:Z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Z.ADAPTER.getWebGLRenderingContext())return!1;const e=Z.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const i=!(null==(r=s?.getContextAttributes())||!r.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch{return!1}}()),_l}()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return xt(0,"renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return xt(0,"renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return xt(0,"renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return xt(0,"renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){xt(0,"renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return xt(0,"renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){xt(0,"renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return xt(0,"renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Pa.extension={type:q.Renderer,priority:1},Pa.__plugins={},Pa.__systems={};let ql=Pa;tt.handleByMap(q.RendererPlugin,ql.__plugins),tt.handleByMap(q.RendererSystem,ql.__systems),tt.add(ql);class Kf extends bn{constructor(t,e){const{width:s,height:i}=e||{};super(s,i),this.items=[],this.itemDirtyIds=[];for(let n=0;ne.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}const Qf=class Vn extends Kf{constructor(t,e){const{width:s,height:i,autoLoad:n,linkBaseTexture:l}=e||{};if(t&&t.length!==Vn.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:i});for(let o=0;o0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=yi.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const i=this.itemDirtyIds;for(let n=0;n$(this,null,function*(){if(null!==this.url)try{const s=yield Z.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const i=yield s.blob();if(this.destroyed)return;const n=yield createImageBitmap(i,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===Te.UNPACK?"premultiply":"none"});if(this.destroyed)return void n.close();this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}else t(this)}))),this._load}upload(t,e,s){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){var t;return Pi._EMPTY=null!=(t=Pi._EMPTY)?t:Z.ADAPTER.createCanvas(0,0),Pi._EMPTY}}const Zl=class ko extends os{constructor(t,e){e=e||{},super(Z.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},ko.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;os.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),n=Math.round(n);const l=this.source;l.width=i,l.height=n,l._pixiId=`canvas_${$s()}`,l.getContext("2d").drawImage(t,0,0,e,s,0,0,i,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ko.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return"svg"===e||"string"==typeof t&&t.startsWith("data:image/svg+xml")||"string"==typeof t&&ko.SVG_XML.test(t)}};Zl.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Kl=Zl;const Ql=class lu extends os{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");!1!==e.autoLoad&&s.setAttribute("preload","auto"),!1!==e.playsinline&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),!0===e.muted&&(s.setAttribute("muted",""),s.muted=!0),!0===e.loop&&s.setAttribute("loop",""),!1!==e.autoPlay&&s.setAttribute("autoplay",""),"string"==typeof t&&(t=[t]),os.crossOrigin(s,t[0].src||t[0],e.crossorigin);for(let n=0;n{this.valid?e(this):(this._resolve=e,this._reject=s,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&&(He.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(He.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(He.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||lu.TYPES.includes(e)}};Ql.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ql.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Jf=Ql;Dl.push(Pi,_f,class Rb extends os{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}},Jf,class Cb extends os{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}},Kl,ua,Mb,class Ib extends Kf{constructor(t,e){const{width:s,height:i}=e||{};let n,l;Array.isArray(t)?(n=t,l=t.length):l=t,super(l,{width:s,height:i}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this}bind(t){super.bind(t),t.target=yi.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:n,items:l}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let a=0;athis.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?ot.EMPTY:((t=t||new ot(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:i,c:n,d:l,tx:o,ty:a}=t,h=s*e.x+n*e.y+o,d=i*e.x+l*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,d),this.maxY=Math.max(this.maxY,d)}addQuad(t){let e=this.minX,s=this.minY,i=this.maxX,n=this.maxY,l=t[0],o=t[1];e=li?l:i,n=o>n?o:n,l=t[2],o=t[3],e=li?l:i,n=o>n?o:n,l=t[4],o=t[5],e=li?l:i,n=o>n?o:n,l=t[6],o=t[7],e=li?l:i,n=o>n?o:n,this.minX=e,this.minY=s,this.maxX=i,this.maxY=n}addFrame(t,e,s,i,n){this.addFrameMatrix(t.worldTransform,e,s,i,n)}addFrameMatrix(t,e,s,i,n){const l=t.a,o=t.b,a=t.c,h=t.d,d=t.tx,c=t.ty;let u=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=l*e+a*s+d,x=o*e+h*s+c;u=gp?g:p,m=x>m?x:m,g=l*i+a*s+d,x=o*i+h*s+c,u=gp?g:p,m=x>m?x:m,g=l*e+a*n+d,x=o*e+h*n+c,u=gp?g:p,m=x>m?x:m,g=l*i+a*n+d,x=o*i+h*n+c,u=gp?g:p,m=x>m?x:m,this.minX=u,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let i=this.minX,n=this.minY,l=this.maxX,o=this.maxY;for(let a=e;al?h:l,o=d>o?d:o}this.minX=i,this.minY=n,this.maxX=l,this.maxY=o}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,n=0,l=n){const o=t.a,a=t.b,h=t.c,d=t.d,c=t.tx,u=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let x=s;xi?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxXh?n:h,this.maxY=l>d?l:d}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxXh?n:h,this.maxY=l>d?l:d}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,i,n,l){e-=l,s+=n,i+=l,this.minX=this.minX<(t-=n)?this.minX:t,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minYi?this.maxY:i}}class Vt extends nn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new _a,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 ka,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s1)for(let e=0;ethis.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);Mi(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e0&&n<=e){l=this.children.splice(t,n);for(let o=0;o1&&this.children.sort(Fb),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t0&&e.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==hu.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(i?(i=kb.copyFrom(i),i.prepend(n)):i=n),s&&e.intersects(s,i))this._render(t);else if(this.cullArea)return;for(let l=0,o=this.children.length;lAe.defaultSortableChildren,set(r){xt(0,"settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Ae.defaultSortableChildren=r}}});const Sn=new St,Db=new Uint16Array([0,1,2,0,2,3]);class si extends Ae{constructor(t){super(),this._anchor=new ns(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Nt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=Q.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||et.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Db,this.pluginName="batch",this.isSprite=!0,this._roundPixels=Z.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=ws(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=ws(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,i=e.b,n=e.c,l=e.d,o=e.tx,a=e.ty,h=this.vertexData,d=t.trim,c=t.orig,u=this._anchor;let f=0,p=0,m=0,g=0;if(d?(p=d.x-u._x*c.width,f=p+d.width,g=d.y-u._y*c.height,m=g+d.height):(p=-u._x*c.width,f=p+c.width,g=-u._y*c.height,m=g+c.height),h[0]=s*p+n*g+o,h[1]=l*g+i*p+a,h[2]=s*f+n*g+o,h[3]=l*g+i*f+a,h[4]=s*f+n*m+o,h[5]=l*m+i*f+a,h[6]=s*p+n*m+o,h[7]=l*m+i*p+a,this._roundPixels){const x=Z.RESOLUTION;for(let y=0;y=i&&Sn.x=n&&Sn.y=e&&(l=r-o-1),a=a.replace("%value%",t[l].toString()),i+=a,i+="\n"}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}(n);super(l,o),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,i){if(this.uniforms.strength=s?this.horizontal?1/s.width*(s.width/e.width):1/s.height*(s.height/e.height):this.horizontal?1/t.renderer.width*(t.renderer.width/e.width):1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,s,i);else{const n=t.getFilterTexture(),l=t.renderer;let o=e,a=n;this.state.blend=!1,t.applyFilter(this,o,a,kr.CLEAR);for(let h=1;h 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){this._loadMatrix([t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0],e)}tint(t,e){const[s,i,n]=Nt.shared.setValue(t).toArray();this._loadMatrix([s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0],e)}greyscale(t,e){this._loadMatrix([t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0],e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),l=1/3,o=(0,Math.sqrt)(l);this._loadMatrix([s+(1-s)*l,l*(1-s)-o*i,l*(1-s)+o*i,0,0,l*(1-s)+o*i,s+l*(1-s),l*(1-s)-o*i,0,0,l*(1-s)-o*i,l*(1-s)+o*i,s+l*(1-s),0,0,0,0,0,1,0],e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1);this._loadMatrix([s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0],e)}saturate(t=0,e){const s=2*t/3+1,i=-.5*(s-1);this._loadMatrix([s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0],e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,s,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const l=Nt.shared,[o,a,h]=l.setValue(s).toArray(),[d,c,u]=l.setValue(i).toArray();this._loadMatrix([.3,.59,.11,0,0,o,a,h,t,0,d,c,u,e,0,o-d,a-c,h-u,0,0],n)}night(t,e){this._loadMatrix([-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0],e)}predator(t,e){this._loadMatrix([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],e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}th.prototype.grayscale=th.prototype.greyscale;const sp={AlphaFilter:rp,BlurFilter:class Yb extends Se{constructor(t=8,e=4,s=Se.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Jl(!0,t,e,s,i),this.blurYFilter=new Jl(!1,t,e,s,i),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),l=Math.abs(this.blurYFilter.strength);if(n&&l){const o=t.getFilterTexture();this.blurXFilter.apply(t,e,o,kr.CLEAR),this.blurYFilter.apply(t,o,s,i),t.returnFilterTexture(o)}else l?this.blurYFilter.apply(t,e,s,i):this.blurXFilter.apply(t,e,s,i)}updatePadding(){this.padding=this._repeatEdgePixels?0:2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}},BlurFilterPass:Jl,ColorMatrixFilter:th,DisplacementFilter:class jb extends Se{constructor(t,e){const s=new kt;t.renderable=!1,super("attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,null==e&&(e=20),this.scale=new St(e,e)}apply(t,e,s,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,l=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);0!==l&&0!==o&&(this.uniforms.rotation[0]=n.a/l,this.uniforms.rotation[1]=n.b/l,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}},FXAAFilter:class qb extends Se{constructor(){super("\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')}},NoiseFilter:class Kb extends Se{constructor(t=.5,e=Math.random()){super($f,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}};Object.entries(sp).forEach(([r,t])=>{Object.defineProperty(sp,r,{get:()=>(xt(0,`filters.${r} has moved to ${r}`),t)})});const Ss=new class Qb{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||(He.system.add(this.tickerUpdate,this,ri.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(He.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove)return void(this._didMove=!1);const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTimes.priority-i.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,i=e.length;s=0;i--)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(0===s.length)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)i.forEach(l=>{t.currentTarget=s[n],this.notifyTarget(t,l)})}propagationPath(t){const e=[t];for(let s=0;s<2048&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,i,n,l=!1){let o=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(Ss.pauseUpdate=!1),t.interactiveChildren&&t.children){const d=t.children;for(let c=d.length-1;c>=0;c--){const u=d[c],f=this.hitTestMoveRecursive(u,this._isInteractive(e)?e:u.eventMode,s,i,n,l||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),0===this._hitElements.length&&(this._hitElements=f),o=!0}}}const a=this._isInteractive(e),h=t.isInteractive();return a&&h&&this._allInteractiveElements.push(t),l||this._hitElements.length>0?null:o?this._hitElements:a&&!n(t,s)&&i(t,s)?h?[t]:[]:null}hitTestRecursive(t,e,s,i,n){if(this._interactivePrune(t)||n(t,s))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(Ss.pauseUpdate=!1),t.interactiveChildren&&t.children){const a=t.children;for(let h=a.length-1;h>=0;h--){const d=a[h],c=this.hitTestRecursive(d,this._isInteractive(e)?e:d.eventMode,s,i,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const u=t.isInteractive();return(c.length>0||u)&&c.push(t),c}}}const l=this._isInteractive(e),o=t.isInteractive();return l&&i(t,s)?o?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!(t&&!t.isMask&&t.visible&&t.renderable&&"none"!==t.eventMode&&("passive"!==t.eventMode||t.interactiveChildren)&&!t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,eh),!t.hitArea.contains(eh.x,eh.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&(null==(s=i.containsPoint)||!s.call(i,e)))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){var s,i;null==(i=(s=t.currentTarget)[`on${e=e??t.type}`])||i.call(s,t),this.notifyListeners(t,t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof fr))return;const e=this.createPointerEvent(t);this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType?this.dispatchEvent(e,"touchstart"):"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.dispatchEvent(e,2===e.button?"rightdown":"mousedown"),this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,i;if(!(t instanceof fr))return;this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const l="mouse"===n.pointerType||"pen"===n.pointerType,o=this.trackingData(t.pointerId),a=this.findMountedTarget(o.overTargets);if((null==(e=o.overTargets)?void 0:e.length)>0&&a!==n.target){const u=this.createPointerEvent(t,"mousemove"===t.type?"mouseout":"pointerout",a);if(this.dispatchEvent(u,"pointerout"),l&&this.dispatchEvent(u,"mouseout"),!n.composedPath().includes(a)){const f=this.createPointerEvent(t,"pointerleave",a);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),l&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}if(a!==n.target){const u=this.clonePointerEvent(n,"mousemove"===t.type?"mouseover":"pointerover");this.dispatchEvent(u,"pointerover"),l&&this.dispatchEvent(u,"mouseover");let f=a?.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(n,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==a&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),l&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(u)}const h=[],d=null==(s=this.enableGlobalMoveEvents)||s;this.moveOnAll?h.push("pointermove"):this.dispatchEvent(n,"pointermove"),d&&h.push("globalpointermove"),"touch"===n.pointerType&&(this.moveOnAll?h.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),d&&h.push("globaltouchmove")),l&&(this.moveOnAll?h.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),d&&h.push("globalmousemove"),this.cursor=null==(i=n.target)?void 0:i.cursor),h.length>0&&this.all(n,h),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof fr))return;const s=this.trackingData(t.pointerId),i=this.createPointerEvent(t),n="mouse"===i.pointerType||"pen"===i.pointerType;this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),"mouse"===i.pointerType&&(this.cursor=null==(e=i.target)?void 0:e.cursor);const l=this.clonePointerEvent(i,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==this.rootTarget.parent;)l.currentTarget=l.target,this.notifyTarget(l),n&&this.notifyTarget(l,"mouseenter"),l.target=l.target.parent;s.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(l)}mapPointerOut(t){if(!(t instanceof fr))return;const e=this.trackingData(t.pointerId);if(e.overTargets){const s="mouse"===t.pointerType||"pen"===t.pointerType,i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const l=this.createPointerEvent(t,"pointerleave",i);for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==this.rootTarget.parent;)l.currentTarget=l.target,this.notifyTarget(l),s&&this.notifyTarget(l,"mouseleave"),l.target=l.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(l)}this.cursor=null}mapPointerUp(t){if(!(t instanceof fr))return;const e=performance.now(),s=this.createPointerEvent(t);this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType?this.dispatchEvent(s,"touchend"):"mouse"!==s.pointerType&&"pen"!==s.pointerType||this.dispatchEvent(s,2===s.button?"rightup":"mouseup");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]);let l=n;if(n&&!s.composedPath().includes(n)){let o=n;for(;o&&!s.composedPath().includes(o);)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):"mouse"!==s.pointerType&&"pen"!==s.pointerType||this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),o=o.parent;delete i.pressTargetsByButton[t.button],l=o}if(l){const o=this.clonePointerEvent(s,"click");o.target=l,o.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const a=i.clicksByButton[t.button];a.target===o.target&&e-a.timeStamp<200?++a.clickCount:a.clickCount=1,a.target=o.target,a.timeStamp=e,o.detail=a.clickCount,"mouse"===o.pointerType?this.dispatchEvent(o,2===o.button?"rightclick":"click"):"touch"===o.pointerType&&this.dispatchEvent(o,"tap"),this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof fr))return;const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(s){let n=s;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?this.notifyTarget(i,"touchendoutside"):("mouse"===i.pointerType||"pen"===i.pointerType)&&this.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof ki))return;const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s("globalMove"===s&&(this.rootBoundary.enableGlobalMoveEvents=i),e[s]=i,!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){var e,s;const{view:i,resolution:n}=this.renderer;this.setTargetElement(i),this.resolution=n,cu._defaultEventMode=null!=(e=t.eventMode)?e:"auto",Object.assign(this.features,null!=(s=t.eventFeatures)?s:{}),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 s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s)}else e&&"string"==typeof t&&!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 s=0,i=e.length;s0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let n=0,l=i.length;n"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),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 s=t;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=1),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}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,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=s1[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}};rh.extension={name:"events",type:[q.RendererSystem,q.CanvasRendererSystem]},rh.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let sh=rh;function ip(r){return"dynamic"===r||"static"===r}tt.add(sh);const i1={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(){var r;return null!=(r=this._internalInteractive)?r:ip(sh.defaultEventMode)},set interactive(r){xt(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(){var r;return null!=(r=this._internalEventMode)?r:sh.defaultEventMode},set eventMode(r){this._internalInteractive=ip(r),this._internalEventMode=r},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i="object"==typeof e?e.signal:void 0,n="object"==typeof e&&!0===e.once,l="function"==typeof t?void 0:t;r="boolean"==typeof e&&e||"object"==typeof e&&e.capture?`${r}capture`:r;const o="function"==typeof t?t:t.handleEvent,a=this;i&&i.addEventListener("abort",()=>{a.off(r,o,l)}),n?a.once(r,o,l):a.on(r,o,l)},removeEventListener(r,t,e){const i="function"==typeof t?void 0:t;this.off(r="boolean"==typeof e&&e||"object"==typeof e&&e.capture?`${r}capture`:r,t="function"==typeof t?t:t.handleEvent,i)},dispatchEvent(r){if(!(r instanceof In))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}};Vt.mixin(i1),Vt.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});class op{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,(ts.tablet||ts.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..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="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..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),null==(t=this.renderer.view.parentNode)||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),null==(t=this.div.parentNode)||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 s=0;s title : ${t.title}
tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:(!t.accessibleHint||null===t.accessibleHint)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,i=this.renderer.events.rootBoundary,n=Object.assign(new In(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach(l=>i.dispatchEvent(n,l))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}op.extension={name:"accessibility",type:[q.RendererPlugin,q.CanvasRendererPlugin]},tt.add(op);const lp=class uu{constructor(t){this.stage=new Ae,t=Object.assign({forceCanvas:!1},t),this.renderer=function wb(r){for(const t of jf)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}(t),uu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return null==(t=this.renderer)?void 0:t.view}get screen(){var t;return null==(t=this.renderer)?void 0:t.screen}destroy(t,e){const s=uu._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};lp._plugins=[];let hp=lp;tt.handleByList(q.Application,hp._plugins);class cp{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;let e,s;if(this.cancelResize(),this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,s=n}this.renderer.resize(e,s),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}}cp.extension=q.Application,tt.add(cp);const up={loader:q.LoadParser,resolver:q.ResolveParser,cache:q.CacheParser,detection:q.DetectionParser};tt.handle(q.Asset,r=>{const t=r.ref;Object.entries(up).filter(([e])=>!!t[e]).forEach(([e,s])=>{var i;return tt.add(Object.assign(t[e],{extension:null!=(i=t[e].extension)?i:s}))})},r=>{const t=r.ref;Object.keys(up).filter(e=>!!t[e]).forEach(e=>tt.remove(t[e]))});class d1{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._isActive&&!this._isLoading&&this._next()}_next(){return $(this,null,function*(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s(Array.isArray(r)||(r=[r]),t?r.map(s=>"string"==typeof s||e?t(s):s):r),ih=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function dp(r,t,e,s,i){const n=t[e];for(let l=0;l{const l=n.substring(1,n.length-1).split(",");i.push(l)}),dp(r,i,0,e,s)}else s.push(r);return s}const Na=r=>!Array.isArray(r),ii=new class p1{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const s=pr(t);let i;for(let o=0;o{i[o]=e}));const n=Object.keys(i),l={cacheKeys:n,keys:s};if(s.forEach(o=>{this._cacheMap.set(o,l)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o),this._cache.set(o,i[o])}),e instanceof et){const o=e;s.forEach(a=>{o.baseTexture!==et.EMPTY.baseTexture&&it.addToCache(o.baseTexture,a),et.addToCache(o,a)})}}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};class m1{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=$(this,null,function*(){var i,n;let l=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let a=0;a({alias:[h],src:h})),o=l.length,a=l.map(h=>$(this,null,function*(){const d=Ot.toAbsolute(h.src);if(!i[h.src])try{this.promiseCache[d]||(this.promiseCache[d]=this._getLoadPromiseAndParser(d,h)),i[h.src]=yield this.promiseCache[d].promise,e&&e(++s/o)}catch(c){throw delete this.promiseCache[d],delete i[h.src],new Error(`[Loader.load] Failed to load ${d}.\n${c}`)}}));return yield Promise.all(a),n?i[l[0].src]:i})}unload(t){return $(this,null,function*(){const e=pr(t,s=>({alias:[s],src:s})).map(s=>$(this,null,function*(){var i,n;const l=Ot.toAbsolute(s.src),o=this.promiseCache[l];if(o){const a=yield o.promise;delete this.promiseCache[l],null==(n=null==(i=o.parser)?void 0:i.unload)||n.call(i,a,s,this)}}));yield Promise.all(e)})}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>Qr(pt({},t),{[e.name]:e}),{})}}var We=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(We||{});const x1={extension:{type:q.LoadParser,priority:We.Low},name:"loadJson",test:r=>Fi(r,"application/json")||De(r,".json"),load(r){return $(this,null,function*(){return yield(yield Z.ADAPTER.fetch(r)).json()})}};tt.add(x1);const v1={name:"loadTxt",extension:{type:q.LoadParser,priority:We.Low},test:r=>Fi(r,"text/plain")||De(r,".txt"),load(r){return $(this,null,function*(){return yield(yield Z.ADAPTER.fetch(r)).text()})}};tt.add(v1);const w1=["normal","bold","100","200","300","400","500","600","700","800","900"],E1=[".ttf",".otf",".woff",".woff2"],A1=["font/ttf","font/otf","font/woff","font/woff2"],T1=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i,I1=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function R1(r){return I1.test(r)?r:encodeURI(r)}const M1={extension:{type:q.LoadParser,priority:We.Low},name:"loadWebFont",test:r=>Fi(r,A1)||De(r,E1),load(r,t){return $(this,null,function*(){var e,s,i,n,l,o;const a=Z.ADAPTER.getFontFaceSet();if(a){const h=[],d=null!=(s=null==(e=t.data)?void 0:e.family)?s:function S1(r){const t=Ot.extname(r),e=Ot.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(T1)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}(r),c=null!=(l=null==(n=null==(i=t.data)?void 0:i.weights)?void 0:n.filter(f=>w1.includes(f)))?l:["normal"],u=null!=(o=t.data)?o:{};for(let f=0;fZ.ADAPTER.getFontFaceSet().delete(t))}};tt.add(M1);let Di=null,nh=class{constructor(){Di||(Di=URL.createObjectURL(new Blob(['(function() {\n "use strict";\n const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";\n async function checkImageBitmap() {\n try {\n if (typeof createImageBitmap != "function")\n return !1;\n const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);\n return imageBitmap.width === 1 && imageBitmap.height === 1;\n } catch {\n return !1;\n }\n }\n checkImageBitmap().then((result) => {\n self.postMessage(result);\n });\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(Di)}};nh.revokeObjectURL=function(){Di&&(URL.revokeObjectURL(Di),Di=null)};let Ni=null;class fp{constructor(){Ni||(Ni=URL.createObjectURL(new Blob(['(function() {\n "use strict";\n async function loadImageBitmap(url) {\n const response = await fetch(url);\n if (!response.ok)\n throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);\n const imageBlob = await response.blob();\n return await createImageBitmap(imageBlob);\n }\n self.onmessage = async (event) => {\n try {\n const imageBitmap = await loadImageBitmap(event.data.data[0]);\n self.postMessage({\n data: imageBitmap,\n uuid: event.data.uuid,\n id: event.data.id\n }, [imageBitmap]);\n } catch (e) {\n self.postMessage({\n error: e,\n uuid: event.data.uuid,\n id: event.data.id\n });\n }\n };\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(Ni)}}fp.revokeObjectURL=function(){Ni&&(URL.revokeObjectURL(Ni),Ni=null)};let ah,pp=0;const mp=new class k1{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new nh;e.addEventListener("message",s=>{e.terminate(),nh.revokeObjectURL(),t(s.data)})})),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}_initWorkers(){return $(this,null,function*(){this._initialized||(this._initialized=!0)})}getWorker(){void 0===ah&&(ah=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){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}_run(t,e){return $(this,null,function*(){yield this._initWorkers();const s=new Promise((i,n)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:n})});return this.next(),s})}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[pp]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:pp++,id:s})}};function Rn(r,t,e){r.resource.internal=!0;const s=new et(r),i=()=>{delete t.promiseCache[e],ii.has(e)&&ii.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&i()}),s.once("destroyed",()=>{r.destroyed||i()}),s}const F1=[".jpeg",".jpg",".png",".webp",".avif"],D1=["image/jpeg","image/png","image/webp","image/avif"],Oa={name:"loadTextures",extension:{type:q.LoadParser,priority:We.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:r=>Fi(r,D1)||De(r,F1),load(r,t,e){return $(this,null,function*(){var i;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let l;l=n?this.config.preferWorkers&&(yield mp.isImageBitmapSupported())?yield mp.loadImageBitmap(r):yield function N1(r){return $(this,null,function*(){const t=yield Z.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=yield t.blob();return yield createImageBitmap(e)})}(r):yield new Promise((h,d)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>d(u))});const o=pt({},t.data);null!=o.resolution||(o.resolution=is(r)),n&&void 0===(null==(i=o.resourceOptions)?void 0:i.ownsImageBitmap)&&(o.resourceOptions=pt({},o.resourceOptions),o.resourceOptions.ownsImageBitmap=!0);const a=new it(l,o);return a.resource.src=r,Rn(a,e,r)})},unload(r){r.destroy(!0)}};tt.add(Oa);const L1={extension:{type:q.LoadParser,priority:We.High},name:"loadSVG",test:r=>Fi(r,"image/svg+xml")||De(r,".svg"),testParse(r){return $(this,null,function*(){return Kl.test(r)})},parse(r,t,e){return $(this,null,function*(){var s;const i=new Kl(r,null==(s=t?.data)?void 0:s.resourceOptions);yield i.load();const n=new it(i,pt({resolution:is(r)},t?.data));return n.resource.src=t.src,Rn(n,e,t.src)})},load(r,t){return $(this,null,function*(){return(yield Z.ADAPTER.fetch(r)).text()})},unload:Oa.unload};tt.add(L1);const V1=[".mp4",".m4v",".webm",".ogv"],U1=["video/mp4","video/webm","video/ogg"],X1={name:"loadVideo",extension:{type:q.LoadParser,priority:We.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test:r=>Fi(r,U1)||De(r,V1),load(r,t,e){return $(this,null,function*(){var s;let i;const n=yield(yield Z.ADAPTER.fetch(r)).blob(),l=URL.createObjectURL(n);try{const o=Qr(pt({autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline},null==(s=t?.data)?void 0:s.resourceOptions),{autoLoad:!0}),a=new Jf(l,o);yield a.load();const h=new it(a,pt({alphaMode:yield zx(),resolution:is(r)},t?.data));h.resource.src=r,i=Rn(h,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(l)})}catch(o){throw URL.revokeObjectURL(l),o}return i})},unload(r){r.destroy(!0)}};tt.add(X1);class Y1{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){var e,s,i;if(this._bundleIdConnector=null!=(e=t.connector)?e:this._bundleIdConnector,this._createBundleAssetId=null!=(s=t.createBundleAssetId)?s:this._createBundleAssetId,this._extractAssetIdFromBundle=null!=(i=t.extractAssetIdFromBundle)?i:this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","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("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,name:s,src:i,srcs:n}=t;return pr(e||s||i||n,l=>{var o;return"string"==typeof l?l:Array.isArray(l)?l.map(a=>{var h,d;return null!=(d=null!=(h=a?.src)?h:a?.srcs)?d:a}):null!=l&&l.src||null!=l&&l.srcs?null!=(o=l.src)?o:l.srcs:l},!0)}addManifest(t){this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(i=>{var n,l;const o=null!=(n=i.src)?n:i.srcs,a=null!=(l=i.alias)?l:i.name;let h;if("string"==typeof a){const d=this._createBundleAssetId(t,a);s.push(d),h=[a,d]}else{const d=a.map(c=>this._createBundleAssetId(t,c));s.push(...d),h=[...a,...d]}this.add(Qr(pt({},i),{alias:h,src:o}))}):Object.keys(e).forEach(i=>{var n;const l=[i,this._createBundleAssetId(t,i)];if("string"==typeof e[i])this.add({alias:l,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:l,src:e[i]});else{const o=e[i],a=null!=(n=o.src)?n:o.srcs;this.add(Qr(pt({},o),{alias:l,src:Array.isArray(a)?a:[a]}))}s.push(...l)}),this._bundles[t]=s}add(t,e,s,i,n){const l=[];let o;"string"==typeof t||Array.isArray(t)&&"string"==typeof t[0]?(xt(0,"Assets.add now uses an object instead of individual parameters.\nPlease use Assets.add({ alias, src, data, format, loadParser }) instead."),l.push({alias:t,src:e,data:s,format:i,loadParser:n})):Array.isArray(t)?l.push(...t):l.push(t),o=a=>{this.hasKey(a)},pr(l).forEach(a=>{const{src:h,srcs:d}=a;let{data:c,format:u,loadParser:f}=a;const p=pr(h||d).map(x=>"string"==typeof x?f1(x):Array.isArray(x)?x:[x]),m=this.getAlias(a);Array.isArray(m)?m.forEach(o):o(m);const g=[];p.forEach(x=>{x.forEach(y=>{var _,b,v;let w={};if("object"!=typeof y){w.src=y;for(let E=0;E{this._assetMap[x]=g})})}resolveBundle(t){const e=Na(t);t=pr(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const l=this.resolve(n),o={};for(const a in l){const h=l[a];o[this._extractAssetIdFromBundle(i,a)]=h}s[i]=o}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Na(t);t=pr(t);const s={};return t.forEach(i=>{var n;if(!this._resolverHash[i])if(this._assetMap[i]){let l=this._assetMap[i];const o=l[0],a=this._getPreferredOrder(l);a?.priority.forEach(h=>{a.params[h].forEach(d=>{const c=l.filter(u=>!!u[h]&&u[h]===d);c.length&&(l=c)})}),this._resolverHash[i]=null!=(n=l[0])?n:o}else this._resolverHash[i]=this.buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){return this._defaultSearchParams?`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`:t}buildResolvedAsset(t,e){var s,i;const{aliases:n,data:l,loadParser:o,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=Ot.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=null!=(s=n??t.alias)?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=pt(pt({},l||{}),t.data),t.loadParser=o??t.loadParser,t.format=null!=(i=a??t.format)?i:Ot.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}const Yr=new class G1{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Y1,this.loader=new m1,this.cache=ii,this._backgroundLoader=new d1(this.loader),this._backgroundLoader.active=!0,this.reset()}init(){return $(this,arguments,function*(t={}){var e,s,i;if(this._initialized)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;"string"==typeof a&&(a=yield this.load(a)),this.resolver.addManifest(a)}const n=null!=(s=null==(e=t.texturePreference)?void 0:e.resolution)?s:1,l="number"==typeof n?[n]:n,o=yield this._detectFormats({preferredFormats:null==(i=t.texturePreference)?void 0:i.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:l}}),t.preferences&&this.setPreferences(t.preferences)})}add(t,e,s,i,n){this.resolver.add(t,e,s,i,n)}load(t,e){return $(this,null,function*(){this._initialized||(yield this.init());const s=Na(t),i=pr(t).map(o=>{if("string"!=typeof o){const a=this.resolver.getAlias(o);return a.some(h=>!this.resolver.hasKey(h))&&this.add(o),Array.isArray(a)?a[0]:a}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(i),l=yield this._mapLoadToResolve(n,e);return s?l[i[0]]:l})}addBundle(t,e){this.resolver.addBundle(t,e)}loadBundle(t,e){return $(this,null,function*(){this._initialized||(yield this.init());let s=!1;"string"==typeof t&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),n={},l=Object.keys(i);let o=0,a=0;const h=()=>{e?.(++o/a)},d=l.map(c=>{const u=i[c];return a+=Object.keys(u).length,this._mapLoadToResolve(u,h).then(f=>{n[c]=f})});return yield Promise.all(d),s?n[t[0]]:n})}backgroundLoad(t){return $(this,null,function*(){this._initialized||(yield this.init()),"string"==typeof t&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))})}backgroundLoadBundle(t){return $(this,null,function*(){this._initialized||(yield this.init()),"string"==typeof t&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return ii.get(t);const e={};for(let s=0;s{const h=n[o.src],d=[o.src];o.alias&&d.push(...o.alias),l[i[a]]=h,ii.set(d,h)}),l})}unload(t){return $(this,null,function*(){this._initialized||(yield this.init());const e=pr(t).map(i=>"string"!=typeof i?i.src:i),s=this.resolver.resolve(e);yield this._unloadFromResolved(s)})}unloadBundle(t){return $(this,null,function*(){this._initialized||(yield this.init()),t=pr(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));yield Promise.all(s)})}_unloadFromResolved(t){return $(this,null,function*(){const e=Object.values(t);e.forEach(s=>{ii.remove(s.src)}),yield this.loader.unload(e)})}_detectFormats(t){return $(this,null,function*(){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||(yield s.test())?e=yield s.add(e):t.skipDetections||(e=yield s.remove(e));return e=e.filter((s,i)=>e.indexOf(s)===i),e})}get detections(){return this._detections}get preferWorkers(){return Oa.config.preferWorkers}set preferWorkers(t){xt(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(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}};tt.handleByList(q.LoadParser,Yr.loader.parsers).handleByList(q.ResolveParser,Yr.resolver.parsers).handleByList(q.CacheParser,Yr.cache.parsers).handleByList(q.DetectionParser,Yr.detections);const H1={extension:q.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof et),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(0===n?"":n+1)]=i})}),e}};function gp(r){return $(this,null,function*(){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=yield(yield fetch(r)).blob();yield createImageBitmap(t)}catch{return!1}return!0}return!1})}tt.add(H1);const W1={extension:{type:q.DetectionParser,priority:1},test:()=>$(this,null,function*(){return gp("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=")}),add:r=>$(this,null,function*(){return[...r,"avif"]}),remove:r=>$(this,null,function*(){return r.filter(t=>"avif"!==t)})};tt.add(W1);const j1={extension:{type:q.DetectionParser,priority:0},test:()=>$(this,null,function*(){return gp("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=")}),add:r=>$(this,null,function*(){return[...r,"webp"]}),remove:r=>$(this,null,function*(){return r.filter(t=>"webp"!==t)})};tt.add(j1);const yp=["png","jpg","jpeg"],$1={extension:{type:q.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:r=>$(this,null,function*(){return[...r,...yp]}),remove:r=>$(this,null,function*(){return r.filter(t=>!yp.includes(t))})};tt.add($1);const z1="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function oh(r){return!z1&&""!==document.createElement("video").canPlayType(r)}const q1={extension:{type:q.DetectionParser,priority:0},test:()=>$(this,null,function*(){return oh("video/webm")}),add:r=>$(this,null,function*(){return[...r,"webm"]}),remove:r=>$(this,null,function*(){return r.filter(t=>"webm"!==t)})};tt.add(q1);const Z1={extension:{type:q.DetectionParser,priority:0},test:()=>$(this,null,function*(){return oh("video/mp4")}),add:r=>$(this,null,function*(){return[...r,"mp4","m4v"]}),remove:r=>$(this,null,function*(){return r.filter(t=>"mp4"!==t&&"m4v"!==t)})};tt.add(Z1);const K1={extension:{type:q.DetectionParser,priority:0},test:()=>$(this,null,function*(){return oh("video/ogg")}),add:r=>$(this,null,function*(){return[...r,"ogv"]}),remove:r=>$(this,null,function*(){return r.filter(t=>"ogv"!==t)})};tt.add(K1);const Q1={extension:q.ResolveParser,test:Oa.test,parse:r=>{var t,e;return{resolution:parseFloat(null!=(e=null==(t=Z.RETINA_PREFIX.exec(r))?void 0:t[1])?e:"1"),format:Ot.extname(r).slice(1),src:r}}};tt.add(Q1);var xe=(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=35987]="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[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(xe||{});const Ba={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,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Gr,Oi;function xp(){Oi={bptc:Gr.getExtension("EXT_texture_compression_bptc"),astc:Gr.getExtension("WEBGL_compressed_texture_astc"),etc:Gr.getExtension("WEBGL_compressed_texture_etc"),s3tc:Gr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Gr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Gr.getExtension("WEBGL_compressed_texture_pvrtc")||Gr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Gr.getExtension("WEBGL_compressed_texture_etc1"),atc:Gr.getExtension("WEBGL_compressed_texture_atc")}}const J1={extension:{type:q.DetectionParser,priority:2},test:()=>$(this,null,function*(){const r=Z.ADAPTER.createCanvas().getContext("webgl");return!!r&&(Gr=r,!0)}),add:r=>$(this,null,function*(){Oi||xp();const t=[];for(const e in Oi)Oi[e]&&t.push(e);return[...t,...r]}),remove:r=>$(this,null,function*(){return Oi||xp(),r.filter(t=>!(t in Oi))})};tt.add(J1);class tv extends ua{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;"string"==typeof t?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new Il(i):null,this._load=null,this.loaded=!1,null!==this.origin&&!1!==e.autoLoad&&this.load(),null===this.origin&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return 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 Il(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this))),this._load}}class ni extends tv{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=ni._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||ni._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let n=0,l=this.levels;n=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(36196===t)return"etc1";if(35986===t||35987===t||34798===t)return"atc";if(t>=36492&&t<=36495)return"bptc";if(37808===t)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,i,n,l,o){const a=new Array(s);let h=t.byteOffset,d=l,c=o,u=d+i-1&~(i-1),f=c+n-1&~(n-1),p=u*f*Ba[e];for(let m=0;m1?d:u,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,d=d>>1||1,c=c>>1||1,u=d+i-1&~(i-1),f=c+n-1&~(n-1),p=u*f*Ba[e];return a}}const mv={827611204:xe.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:xe.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:xe.COMPRESSED_RGBA_S3TC_DXT5_EXT},gv={70:xe.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:xe.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:xe.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:xe.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:xe.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:xe.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:xe.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:xe.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:xe.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:xe.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:xe.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:xe.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:xe.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT},bp=[171,75,84,88,32,49,49,187,13,10,26,10],vp={[st.UNSIGNED_BYTE]:1,[st.UNSIGNED_SHORT]:2,[st.INT]:4,[st.UNSIGNED_INT]:4,[st.FLOAT]:4,[st.HALF_FLOAT]:8},_v={[j.RGBA]:4,[j.RGB]:3,[j.RG]:2,[j.RED]:1,[j.LUMINANCE]:1,[j.LUMINANCE_ALPHA]:2,[j.ALPHA]:1},bv={[st.UNSIGNED_SHORT_4_4_4_4]:2,[st.UNSIGNED_SHORT_5_5_5_1]:2,[st.UNSIGNED_SHORT_5_6_5]:2};function Ev(r){switch(r){case j.RGBA:return j.RGBA_INTEGER;case j.RGB:return j.RGB_INTEGER;case j.RG:return j.RG_INTEGER;case j.RED:return j.RED_INTEGER;default:return r}}const Tv={extension:{type:q.LoadParser,priority:We.High},name:"loadDDS",test:r=>De(r,".dds"),load(r,t,e){return $(this,null,function*(){const i=function yv(r){const t=new Uint32Array(r);if(542327876!==t[0])throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,124/Uint32Array.BYTES_PER_ELEMENT),s=e[3],i=e[4],n=e[7],l=new Uint32Array(r,19*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=l[1];if(4&o){const a=l[2];if(808540228!==a){const y=mv[a],b=new Uint8Array(r,128);return[new ni(b,{format:y,width:i,height:s,levels:n})]}const d=new Uint32Array(t.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),c=d[0],u=d[1],f=d[2],p=d[3],m=gv[c];if(void 0===m)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(4===f)throw new Error("DDSParser does not support cubemap textures");if(6===u)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,x=148;if(1===p)g.push(new Uint8Array(r,x));else{const y=Ba[m];let _=0,b=i,v=s;for(let E=0;E>>=1,v>>>=1;let w=x;for(let E=0;Enew ni(y,{format:m,width:i,height:s,levels:n}))}throw 64&o?new Error("DDSParser does not support uncompressed texture data."):512&o?new Error("DDSParser does not supported YUV uncompressed texture data."):131072&o?new Error("DDSParser does not support single-channel (lumninance) texture data!"):2&o?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!")}(yield(yield Z.ADAPTER.fetch(r)).arrayBuffer()).map(n=>Rn(new it(n,pt({mipmap:rr.OFF,alphaMode:Te.NO_PREMULTIPLIED_ALPHA,resolution:is(r)},t.data)),e,r));return 1===i.length?i[0]:i})},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};tt.add(Tv);const Sv={extension:{type:q.LoadParser,priority:We.High},name:"loadKTX",test:r=>De(r,".ktx"),load(r,t,e){return $(this,null,function*(){const s=yield(yield Z.ADAPTER.fetch(r)).arrayBuffer(),{compressed:i,uncompressed:n,kvData:l}=function vv(r,t,e=!1){const s=new DataView(t);if(!function wv(r,t){for(let e=0;et-i)break;let a=0;for(;a1||0!==n?T:D,levelHeight:f>1||0!==n?A:C,levelBuffer:new Uint8Array(t,B,E)},B+=E}M+=P+4,M=M%4!=0?M+4-M%4:M,T=T>>1||1,A=A>>1||1,D=T+4-1&-4,C=A+4-1&-4,E=D*C*v}return 0!==n?{uncompressed:_.map(I=>{let P=I[0].levelBuffer,B=!1;return n===st.FLOAT?P=new Float32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4):n===st.UNSIGNED_INT?(B=!0,P=new Uint32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4)):n===st.INT&&(B=!0,P=new Int32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4)),{resource:new ua(P,{width:I[0].levelWidth,height:I[0].levelHeight}),type:n,format:B?Ev(l):l}}),kvData:w}:{compressed:_.map(I=>new ni(null,{format:o,width:a,height:h,levels:f,levelBuffers:I})),kvData:w}}(0,s),o=i??n,a=pt({mipmap:rr.OFF,alphaMode:Te.NO_PREMULTIPLIED_ALPHA,resolution:is(r)},t.data),h=o.map(d=>{var c;o===n&&Object.assign(a,{type:d.type,format:d.format});const u=null!=(c=d.resource)?c:d,f=new it(u,a);return f.ktxKeyValueData=l,Rn(f,e,r)});return 1===h.length?h[0]:h})},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};tt.add(Sv);const Iv=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],Rv={extension:q.ResolveParser,test:r=>{const t=Ot.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var t,e,s,i;const n=r.split("."),l=n.pop();if(["ktx","dds"].includes(l)){const o=n.pop();if(Iv.includes(o))return{resolution:parseFloat(null!=(e=null==(t=Z.RETINA_PREFIX.exec(r))?void 0:t[1])?e:"1"),format:o,src:r}}return{resolution:parseFloat(null!=(i=null==(s=Z.RETINA_PREFIX.exec(r))?void 0:s[1])?i:"1"),format:l,src:r}}};tt.add(Rv);const Xa=new ot,wp=class Un{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=null==(t=this.renderer)?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}image(t,e,s,i){return $(this,null,function*(){const n=new Image;return n.src=yield this.base64(t,e,s,i),n})}base64(t,e,s,i){return $(this,null,function*(){const n=this.canvas(t,i);if(void 0!==n.toBlob)return new Promise((l,o)=>{n.toBlob(a=>{if(!a)return void o(new Error("ICanvas.toBlob failed!"));const h=new FileReader;h.onload=()=>l(h.result),h.onerror=o,h.readAsDataURL(a)},e,s)});if(void 0!==n.toDataURL)return n.toDataURL(e,s);if(void 0!==n.convertToBlob){const l=yield n.convertToBlob({type:e,quality:s});return new Promise((o,a)=>{const h=new FileReader;h.onload=()=>o(h.result),h.onerror=a,h.readAsDataURL(l)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")})}canvas(t,e){const{pixels:s,width:i,height:n,flipY:l,premultipliedAlpha:o}=this._rawPixels(t,e);l&&Un._flipY(s,i,n),o&&Un._unpremultiplyAlpha(s);const a=new c_(i,n,1),h=new ImageData(new Uint8ClampedArray(s.buffer),i,n);return a.context.putImageData(h,0,0),a.canvas}pixels(t,e){const{pixels:s,width:i,height:n,flipY:l,premultipliedAlpha:o}=this._rawPixels(t,e);return l&&Un._flipY(s,i,n),o&&Un._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,o,n=!1,l=!1,a=!1;t&&(t instanceof Js?o=t:(o=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),a=!0,e&&(Xa.width=e.width,Xa.height=e.height,e=Xa)));const h=s.gl;if(o){if(i=o.baseTexture.resolution,e=e??o.frame,n=!1,l=o.baseTexture.alphaMode>0&&o.baseTexture.format===j.RGBA,!a){s.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else i=s.resolution,e||((e=Xa).width=s.width/i,e.height=s.height/i),n=!0,l=this._rendererPremultipliedAlpha,s.renderTexture.bind();const d=Math.max(Math.round(e.width*i),1),c=Math.max(Math.round(e.height*i),1),u=new Uint8Array(4*d*c);return h.readPixels(Math.round(e.x*i),Math.round(e.y*i),d,c,h.RGBA,h.UNSIGNED_BYTE,u),a&&o?.destroy(!0),{pixels:u,width:d,height:c,flipY:n,premultipliedAlpha:l}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,n=s>>1,l=new Uint8Array(i);for(let o=0;o=0&&o>=0&&i>=0&&n>=0))return void(t.length=0);const a=Math.ceil(2.3*Math.sqrt(l+o)),h=8*a+(i?4:0)+(n?4:0);if(t.length=h,0===h)return;if(0===a)return t.length=8,t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,void(t[5]=t[7]=s-n);let d=0,c=4*a+(i?2:0)+2,u=c,f=h;{const p=i+l,m=n,g=e+p,x=e-p,y=s+m;if(t[d++]=g,t[d++]=y,t[--c]=y,t[--c]=x,n){const _=s-m;t[u++]=x,t[u++]=_,t[--f]=_,t[--f]=g}}for(let p=1;p0||t&&s<=0){const i=e/2;for(let n=i+i%2;n=6){Ep(e,!1);const l=[];for(let h=0;h=0&&n>=0&&l.push(e,s,e+i,s,e+i,s+n,e,s+n)},triangulate(r,t){const e=r.points,s=t.points;if(0===e.length)return;const i=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}},kv={build(r){Ya.build(r)},triangulate(r,t){Ya.triangulate(r,t)}};var nr=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(nr||{}),Is=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Is||{});const Bi={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}};class Tp{static curveTo(t,e,s,i,n,l){const a=l[l.length-1]-e,h=l[l.length-2]-t,d=i-e,c=s-t,u=Math.abs(a*c-h*d);if(u<1e-8||0===n)return(l[l.length-2]!==t||l[l.length-1]!==e)&&l.push(t,e),null;const f=a*a+h*h,p=d*d+c*c,m=a*d+h*c,g=n*Math.sqrt(f)/u,x=n*Math.sqrt(p)/u,y=g*m/f,_=x*m/p,b=g*c+x*h,v=g*d+x*a,T=c*(g+_),A=d*(g+_);return{cx:b+t,cy:v+e,radius:n,startAngle:Math.atan2(a*(x+y)-v,h*(x+y)-b),endAngle:Math.atan2(A-v,T-b),anticlockwise:h*d>c*a}}static arc(t,e,s,i,n,l,o,a,h){const d=o-l,c=Bi._segmentsCount(Math.abs(d)*n,40*Math.ceil(Math.abs(d)/fa)),u=d/(2*c),f=2*u,p=Math.cos(u),m=Math.sin(u),g=c-1,x=g%1/g;for(let y=0;y<=g;++y){const b=u+l+f*(y+x*y),v=Math.cos(b),w=-Math.sin(b);h.push((p*v+m*w)*n+s,(p*-w+m*v)*n+i)}}}class Fv{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class ch{static curveLength(t,e,s,i,n,l,o,a){let h=0,d=0,c=0,u=0,f=0,p=0,m=0,g=0,x=0,y=0,_=0,b=t,v=e;for(let w=1;w<=10;++w)d=w/10,c=d*d,u=c*d,f=1-d,p=f*f,m=p*f,g=m*t+3*p*d*s+3*f*c*n+u*o,x=m*e+3*p*d*i+3*f*c*l+u*a,y=b-g,_=v-x,b=g,v=x,h+=Math.sqrt(y*y+_*_);return h}static curveTo(t,e,s,i,n,l,o){const a=o[o.length-2],h=o[o.length-1];o.length-=2;const d=Bi._segmentsCount(ch.curveLength(a,h,t,e,s,i,n,l));let c=0,u=0,f=0,p=0,m=0;o.push(a,h);for(let g=1,x=0;g<=d;++g)x=g/d,c=1-x,u=c*c,f=u*c,p=x*x,m=p*x,o.push(f*a+3*u*x*t+3*c*p*s+m*n,f*h+3*u*x*e+3*c*p*i+m*l)}}function Sp(r,t,e,s,i,n,l,o){let u,f;return l?(u=s,f=-e):(u=-s,f=e),o.push(r-e*i+u,t-s*i+f,r+e*n+u,t+s*n+f),2}function ai(r,t,e,s,i,n,l,o){const a=e-r,h=s-t;let d=Math.atan2(a,h),c=Math.atan2(i-r,n-t);o&&dc&&(c+=2*Math.PI);let u=d;const f=c-d,p=Math.abs(f),m=Math.sqrt(a*a+h*h),g=1+(15*p*Math.sqrt(m)/Math.PI|0),x=f/g;if(u+=x,o){l.push(r,t,e,s);for(let y=1,_=u;y=0&&(u+=n.join===nr.ROUND?ai(_,b,_-E*I,b-T*I,_-A*I,b-D*I,d,!1)+4:2,d.push(_-A*P,b-D*P,_+A*I,b+D*I));continue}const z=(-E+x)*(-T+b)-(-E+_)*(-T+y),K=(-A+v)*(-D+b)-(-A+_)*(-D+w),lt=(k*K-F*z)/H,ht=(L*z-N*K)/H,ft=(lt-_)*(lt-_)+(ht-b)*(ht-b),yt=_+(lt-_)*I,at=b+(ht-b)*I,ct=_-(lt-_)*P,Mt=b-(ht-b)*P,ce=Math.min(k*k+N*N,F*F+L*L),jt=G?I:P;let we=n.join;if(we===nr.MITER&&ft/m>g&&(we=nr.BEVEL),ft<=ce+jt*jt*m)switch(we){case nr.MITER:d.push(yt,at,ct,Mt);break;case nr.BEVEL:G?d.push(yt,at,_+E*P,b+T*P,yt,at,_+A*P,b+D*P):d.push(_-E*I,b-T*I,ct,Mt,_-A*I,b-D*I,ct,Mt),u+=2;break;case nr.ROUND:G?(d.push(yt,at,_+E*P,b+T*P),u+=ai(_,b,_+E*P,b+T*P,_+A*P,b+D*P,d,!0)+4,d.push(yt,at,_+A*P,b+D*P)):(d.push(_-E*I,b-T*I,ct,Mt),u+=ai(_,b,_-E*I,b-T*I,_-A*I,b-D*I,d,!1)+4,d.push(_-A*I,b-D*I,ct,Mt))}else{switch(d.push(_-E*I,b-T*I,_+E*P,b+T*P),we){case nr.MITER:G?d.push(ct,Mt,ct,Mt):d.push(yt,at,yt,at),u+=2;break;case nr.ROUND:u+=G?ai(_,b,_+E*P,b+T*P,_+A*P,b+D*P,d,!0)+2:ai(_,b,_-E*I,b-T*I,_-A*I,b-D*I,d,!1)+2}d.push(_-A*I,b-D*I,_+A*P,b+D*P),u+=2}}x=s[2*(c-2)],y=s[2*(c-2)+1],_=s[2*(c-1)],b=s[2*(c-1)+1],E=-(y-b),T=x-_,C=Math.sqrt(E*E+T*T),E/=C,T/=C,E*=p,T*=p,d.push(_-E*I,b-T*I,_+E*P,b+T*P),a||(n.cap===Is.ROUND?u+=ai(_-E*(I-P)*.5,b-T*(I-P)*.5,_-E*I,b-T*I,_+E*P,b+T*P,d,!1)+2:n.cap===Is.SQUARE&&(u+=Sp(_,b,E,T,I,P,!1,d)));const B=t.indices,U=Bi.epsilon*Bi.epsilon;for(let O=f;O0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,i=null){const n=new Ha(t,e,s,i);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ha(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(s=this.batches[this.batches.length-1],i=s.style);for(let a=this.shapeIndex;a65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t131070)return!1;const t=this.batches;for(let e=0;e0&&(i=Ga.pop(),i||(i=new Ol,i.texArray=new Xl),this.drawCalls.push(i)),i.start=d,i.size=0,i.texArray.count=0,i.type=h),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=_s.REPEAT,i.texArray.elements[i.texArray.count++]=m,n++)),i.size+=u.size,d+=u.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,u.attribSize,u.attribStart),this.addTextureIds(s,o,u.attribSize,u.attribStart)}it._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,n=new ArrayBuffer(3*t.length*4),l=new Float32Array(n),o=new Uint32Array(n);let a=0;for(let h=0;h0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},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 Ts,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ts,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points;return(s[s.length-2]!==t||s[s.length-1]!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,i){this._initCurve();const n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),uh.curveTo(t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,l){return this._initCurve(),ch.curveTo(t,e,s,i,n,l,this.currentPath.points),this}arcTo(t,e,s,i,n){this._initCurve(t,e);const o=Tp.curveTo(t,e,s,i,n,this.currentPath.points);if(o){const{cx:a,cy:h,radius:d,startAngle:c,endAngle:u,anticlockwise:f}=o;this.arc(a,h,d,c,u,f)}return this}arc(t,e,s,i,n,l=!1){if(i===n)return this;if(!l&&n<=i?n+=fa:l&&i<=n&&(i+=fa),n-i==0)return this;const o=t+Math.cos(i)*s,a=e+Math.sin(i)*s,h=this._geometry.closePointEps;let d=this.currentPath?this.currentPath.points:null;if(d){const c=Math.abs(d[d.length-2]-o),u=Math.abs(d[d.length-1]-a);c0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,i){return this.drawShape(new ot(t,e,s,i))}drawRoundedRect(t,e,s,i,n){return this.drawShape(new ya(t,e,s,i,n))}drawCircle(t,e,s){return this.drawShape(new ma(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new ga(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):e=Array.isArray(t[0])?t[0]:t;const n=new Ts(e);return n.closeStroke=s,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==ye.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let i=0;is&&!t.autoResize&&(l=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const a=e[0]._texture.baseTexture,h=a.alphaMode>0;this.state.blendMode=zd(t.blendMode,h),n.state.set(this.state);const d=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,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);let u=!1;for(let f=0,p=0;fi&&(m=i),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[p];g.uploadDynamic(e,f,m),u=u||g._updateID<(t._bufferUpdateIDs[p]||0),u&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),d.drawElements(d.TRIANGLES,6*m,d.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,n=t._properties;for(let l=0;l0);i[l]=h,i[l+n]=h,i[l+2*n]=h,i[l+3*n]=h,l+=4*n}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Dp.extension={name:"particle",type:q.RendererPlugin},tt.add(Dp);var ja=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(ja||{});const $a={willReadFrequently:!0},Hr=class rt{static get experimentalLetterSpacingSupported(){let t=rt._experimentalLetterSpacingSupported;if(void 0!==t){const e=Z.ADAPTER.getCanvasRenderingContext2D().prototype;t=rt._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,n,l,o,a,h){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=l,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=h}static measureText(t,e,s,i=rt._canvas){s=s??e.wordWrap;const n=e.toFontString(),l=rt.measureFont(n);0===l.fontSize&&(l.fontSize=e.fontSize,l.ascent=e.fontSize);const o=i.getContext("2d",$a);o.font=n;const a=(s?rt.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(a.length);let d=0;for(let p=0;p0&&(i?n-=e:n+=(rt.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=rt._canvas){const i=s.getContext("2d",$a);let n=0,l="",o="";const a=Object.create(null),{letterSpacing:h,whiteSpace:d}=e,c=rt.collapseSpaces(d),u=rt.collapseNewlines(d);let f=!c;const p=e.wordWrapWidth+h,m=rt.tokenize(t);for(let g=0;gp)if(""!==l&&(o+=rt.addLine(l),l="",n=0),rt.canBreakWords(x,e.breakWords)){const _=rt.wordWrapSplit(x);for(let b=0;b<_.length;b++){let v=_[b],w=v,E=1;for(;_[b+E];){const A=_[b+E];if(rt.canBreakChars(w,A,x,b,e.breakWords))break;v+=A,w=A,E++}b+=E-1;const T=rt.getFromCache(v,h,a,i);T+n>p&&(o+=rt.addLine(l),f=!1,l="",n=0),l+=v,n+=T}}else l.length>0&&(o+=rt.addLine(l),l="",n=0),o+=rt.addLine(x,!(g===m.length-1)),f=!1,l="",n=0;else y+n>p&&(f=!1,o+=rt.addLine(l),l="",n=0),(l.length>0||!rt.isBreakingSpace(x)||f)&&(l+=x,n+=y)}return o+=rt.addLine(l,!1),o}static addLine(t,e=!0){return t=rt.trimRight(t),e?`${t}\n`:t}static getFromCache(t,e,s,i){let n=s[t];return"number"!=typeof n&&(n=rt._measureText(t,e,i)+e,s[t]=n),n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(t){if("string"!=typeof t)return"";for(let e=t.length-1;e>=0&&rt.isBreakingSpace(t[e]);e--)t=t.slice(0,-1);return t}static isNewline(t){return"string"==typeof t&&rt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return"string"==typeof t&&rt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if("string"!=typeof t)return e;for(let i=0;io;--u){for(let m=0;m{if("function"==typeof Intl?.Segmenter){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Hr.experimentalLetterSpacing=!1,Hr._fonts={},Hr._newlines=[10,13],Hr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Rs=Hr;const Gv=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Np=class Xn{constructor(t){this.styleID=0,this.reset(),vh(this,t,t)}clone(){const t={};return vh(t,this,Xn.defaultStyle),new Xn(t)}reset(){vh(this,Xn.defaultStyle,Xn.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=bh(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=bh(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function Hv(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e=0;s--){let i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!Gv.includes(i)&&(i=`"${i}"`),e[s]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Np.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ja.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 Ms=Np;function bh(r){const t=Nt.shared,e=s=>{const i=t.setValue(s);return 1===i.alpha?i.toHex():i.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function vh(r,t,e){for(const s in e)r[s]=Array.isArray(t[s])?t[s].slice():t[s]}const Wv={texture:!0,children:!1,baseTexture:!0},Op=class du extends si{constructor(t,e,s){var i;let n=!1;s||(s=Z.ADAPTER.createCanvas(),n=!0),s.width=3,s.height=3;const l=et.from(s);l.orig=new ot,l.trim=new ot,super(l),this._ownCanvas=n,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=null!=(i=du.defaultResolution)?i:Z.RESOLUTION,this._autoResolution=du.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return Rs.experimentalLetterSpacing}static set experimentalLetterSpacing(t){xt(0,"Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Rs.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,i=Rs.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),l=i.height,o=i.lines,a=i.lineHeight,h=i.lineWidths,d=i.maxLineWidth,c=i.fontProperties;let u,f;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,i.width)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,l)+2*e.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;const p=e.dropShadow?2:1;for(let m=0;m0&&p>m&&(g=(m+p)/2);const x=m+u,y=s.lineHeight*(f+1);let _=x;f+10}}function $v(r,t){var e;let s=!1;if(null!=(e=r?._textures)&&e.length)for(let i=0;i{this.queue&&this.prepareItems()},this.registerFindHook(Qv),this.registerFindHook(Jv),this.registerFindHook($v),this.registerFindHook(zv),this.registerFindHook(qv),this.registerUploadHook(Zv),this.registerUploadHook(Kv)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,He.system.addOnce(this.tick,this,ri.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed)for(let s=0,i=this.uploadHooks.length;s=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&He.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}};Bp.uploadsPerFrame=4;let Eh=Bp;function Lp(r,t){return t instanceof it&&(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0)}function tw(r,t){if(!(t instanceof gh))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let i=0;iEh.uploadsPerFrame,set(r){xt(0,"settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Eh.uploadsPerFrame=r}}});class Vp extends Eh{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(ew),this.registerUploadHook(Lp),this.registerUploadHook(tw)}}Vp.extension={name:"prepare",type:q.RendererSystem},tt.add(Vp);var Up="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";const za=new kt;class Xp extends Ea{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new wf,this.state=Ur.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Xr.from(Up,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",e),this.shader=t.context.webGLVersion>1?Xr.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",e):Xr.from(Up,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",e)}render(t){const e=this.renderer,s=this.quad;let i=s.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,l=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-n,i[1]=i[3]=-l,i[2]=i[4]=1-n,i[5]=i[7]=1-l,s.invalidate();const o=t._texture,a=o.baseTexture,h=a.alphaMode>0,d=t.tileTransform.localTransform,c=t.uvMatrix;let u=a.isPowerOfTwo&&o.frame.width===a.width&&o.frame.height===a.height;u&&(a._glTextures[e.CONTEXT_UID]?u=a.wrapMode!==_s.CLAMP:a.wrapMode===_s.CLAMP&&(a.wrapMode=_s.REPEAT));const f=u?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,x=t._height;za.set(d.a*p/g,d.b*p/x,d.c*m/g,d.d*m/x,d.tx/g,d.ty/x),za.invert(),u?za.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=za.toArray(!0),f.uniforms.uColor=Nt.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=zd(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Xp.extension={name:"tilingSprite",type:q.RendererPlugin},tt.add(Xp);const Yp=class Yn{constructor(t,e,s){this.linkedSheets=[],(t instanceof it||t instanceof et)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:i,data:n,resolutionFilename:l=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=i instanceof et?i:null,this.baseTexture=i instanceof it?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const a=this.baseTexture.resource;this.resolution=this._updateResolution(l||(a?a.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 s=is(t,null);return null===s&&(s="number"==typeof e?e:parseFloat(e??"1")),1!==s&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Yn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Yn.BATCH_SIZE;for(;e-t{this._batchIndex*Yn.BATCH_SIZE{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=Ot.dirname(r[0]);t.linkedSheets.forEach((n,l)=>{Object.assign(s,Hp([`${i}/${t.data.meta.related_multi_packs[l]}`],n,!0))})}return s}const ow={extension:q.Asset,cache:{test:r=>r instanceof Gp,getCacheableAssets:(r,t)=>Hp(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return"json"===e&&aw.includes(s)},parse:r=>{var t,e;const s=r.split(".");return{resolution:parseFloat(null!=(e=null==(t=Z.RETINA_PREFIX.exec(r))?void 0:t[1])?e:"1"),format:s[s.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:q.LoadParser,priority:We.Normal},testParse(r,t){return $(this,null,function*(){return".json"===Ot.extname(t.src).toLowerCase()&&!!r.frames})},parse(r,t,e){return $(this,null,function*(){var s,i,n;const{texture:l,imageFilename:o,cachePrefix:a}=null!=(s=t?.data)?s:{};let d,h=Ot.dirname(t.src);if(h&&h.lastIndexOf("/")!==h.length-1&&(h+="/"),l&&l.baseTexture)d=l;else{const f=ih(h+(o??r.meta.image),t.src);d=(yield e.load([f]))[f]}const c=new Gp({texture:d.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:a});yield c.parse();const u=null==(i=r?.meta)?void 0:i.related_multi_packs;if(Array.isArray(u)){const f=[];for(const m of u){if("string"!=typeof m)continue;let g=h+m;null!=(n=t.data)&&n.ignoreMultiPack||(g=ih(g,t.src),f.push(e.load({src:g,data:{ignoreMultiPack:!0}})))}const p=yield Promise.all(f);c.linkedSheets=p,p.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==m))})}return c})},unload(r){r.destroy(!0)}}};tt.add(ow);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const l=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(const h in o){const d=o[h].split("="),c=d[0],u=d[1].replace(/"/gm,""),f=parseFloat(u),p=isNaN(f)?u:f;a[c]=p}s[l].push(a)}const i=new qa;return s.info.forEach(n=>i.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>i.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>i.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>i.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)})),s.kerning.forEach(n=>i.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>i.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),i}}class Ah{static test(t){const e=t;return"string"!=typeof t&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new qa,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),l=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),a=t.getElementsByTagName("distanceField");for(let h=0;h"))&&Ah.test(Z.ADAPTER.parseXML(t))}static parse(t){return Ah.parse(Z.ADAPTER.parseXML(t))}}const Sh=[Za,Ah,Th];function cw(r,t,e,s,i,n,l){const o=e.text,a=e.fontProperties;t.translate(s,i),t.scale(n,n);const h=l.strokeThickness/2,d=-l.strokeThickness/2;if(t.font=l.toFontString(),t.lineWidth=l.strokeThickness,t.textBaseline=l.textBaseline,t.lineJoin=l.lineJoin,t.miterLimit=l.miterLimit,t.fillStyle=function hw(r,t,e,s,i,n){const l=e.fill;if(!Array.isArray(l))return l;if(1===l.length)return l[0];let o;const a=e.dropShadow?e.dropShadowDistance:0,h=e.padding||0,d=r.width/s-a-2*h,c=r.height/s-a-2*h,u=l.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=u.length+1;for(let m=1;m=h-C*o){if(0===g)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--E,x=null,y=null,_=null,g=0,m=0,b=0;continue}if(b=Math.max(C+A.fontProperties.descent,b),M*o+m>=f){if(0===m)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--E,g+=b*o,g=Math.ceil(g),m=0,b=0;continue}cw(x,y,A,m,g,o,u);const I=Ka(A.text);p.char.push({id:I,page:v.length-1,x:m/o,y:g/o,width:M,height:C,xoffset:0,yoffset:0,xadvance:D-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(M+2*l)*o,m=Math.ceil(m)}if(null==s||!s.skipKerning)for(let E=0,T=c.length;E{this.dirty=!0},this,0,0),this._roundPixels=Z.ROUND_PIXELS,this.dirty=!0,this._resolution=Z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=Ps.available[this._fontName],s=this.fontSize,i=s/e.size,n=new St,l=[],o=[],a=[],d=Wp(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),c=this._maxWidth*e.size/s,u="none"===e.distanceFieldType?jp:$p;let f=null,p=0,m=0,g=0,x=-1,y=0,_=0,b=0,v=0;for(let M=0;M0&&n.x>c&&(++_,Mi(l,1+x-_,1+M-x),M=x,x=-1,o.push(y),a.push(l.length>0?l[l.length-1].prevSpaces:0),m=Math.max(m,y),g++,n.x=0,n.y+=e.lineHeight,f=null,v=0)}const w=d[d.length-1];"\r"!==w&&"\n"!==w&&(/(?:\s)/.test(w)&&(p=y),o.push(p),m=Math.max(m,p),a.push(-1));const E=[];for(let M=0;M<=g;M++){let I=0;"right"===this._align?I=m-o[M]:"center"===this._align?I=(m-o[M])/2:"justify"===this._align&&(I=a[M]<0?0:(m-o[M])/a[M]),E.push(I)}const T=l.length,A={},D=[],C=this._activePagesMeshData;u.push(...C);for(let M=0;M 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // Gamma correction for coverage-like alpha\r\n float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r\n float gamma = mix(1.0, 1.0 / 2.2, luma);\r\n float coverage = pow(uColor.a * alpha, gamma); \r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, coverage);\r\n}\r\n"),uniforms:{uFWidth:0}}),N=Q.NORMAL_NPM);const F=new xh(O,k);F.blendMode=N,B={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:F,vertices:null,uvs:null,indices:null}}B.index=0,B.indexCount=0,B.vertexCount=0,B.uvsCount=0,B.total=0;const{_textureCache:U}=this;U[P]=U[P]||new et(I.baseTexture),B.mesh.texture=U[P],B.mesh.tint=this._tintColor.value,D.push(B),A[P]=B}A[P].total++}for(let M=0;M6*P)||I.vertices.length<2*xh.BATCHABLE_SIZE)I.vertices=new Float32Array(8*P),I.uvs=new Float32Array(8*P),I.indices=new Uint16Array(6*P);else{const U=I.vertices;for(let O=4*I.total*2;Oe[i.mesh.texture.baseTexture.uid]).forEach(i=>{i.mesh.texture=et.EMPTY});for(const i in e)e[i].destroy(),delete e[i];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}}).styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const mw=[".xml",".fnt"],gw={extension:{type:q.LoadParser,priority:We.Normal},name:"loadBitmapFont",test:r=>mw.includes(Ot.extname(r).toLowerCase()),testParse(r){return $(this,null,function*(){return Za.test(r)||Th.test(r)})},parse(r,t,e){return $(this,null,function*(){const s=Za.test(r)?Za.parse(r):Th.parse(r),{src:i}=t,{page:n}=s,l=[];for(let h=0;ho[h]);return Ps.install(s,a,!0)})},load(r,t){return $(this,null,function*(){return(yield Z.ADAPTER.fetch(r)).text()})},unload(r){r.destroy()}};tt.add(gw);const Ih=class tn extends Ms{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new tn(Object.keys(tn.defaultOptions).reduce((e,s)=>Qr(pt({},e),{[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,0===t.refs&&(t.fontFace&&document.fonts.delete(t.fontFace),delete tn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=tn;if(s[t]){const i=s[t];return this._fonts.push(i),i.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return Z.ADAPTER.fetch(t).then(i=>i.blob()).then(i=>$(this,null,function*(){return new Promise((n,l)=>{const o=URL.createObjectURL(i),a=new FileReader;a.onload=()=>n([o,a.result]),a.onerror=l,a.readAsDataURL(i)})})).then(i=>$(this,[i],function*([n,l]){const o=Object.assign({family:Ot.basename(t,Ot.extname(t)),weight:"normal",style:"normal",display:"auto",src:n,dataSrc:l,refs:1,originalUrl:t,fontFace:null},e);s[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,yield a.load(),document.fonts.add(a),yield document.fonts.ready,this.styleID++,this.fontsDirty=!0}))}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),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}\n @font-face {\n font-family: "${e.family}";\n src: url('${e.dataSrc}');\n font-weight: ${e.weight};\n font-style: ${e.style};\n font-display: ${e.display};\n }`,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=ha(t)),"number"==typeof t?function a_(r){return xt(0,"utils.hex2string is deprecated, use Color#toHex instead"),Nt.shared.setValue(r).toHex()}(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));const n=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,tn.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}=Z.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){}get fillGradientType(){return super.fillGradientType}set miterLimit(t){}get miterLimit(){return super.miterLimit}set trim(t){}get trim(){return super.trim}set textBaseline(t){}get textBaseline(){return super.textBaseline}set leading(t){}get leading(){return super.leading}set lineJoin(t){}get lineJoin(){return super.lineJoin}};Ih.availableFonts={},Ih.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 Rh=Ih;const Qa=class en extends si{constructor(t="",e={}){var s;super(et.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,n=et.from(i,{scaleMode:Z.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new ot,n.trim=new ot,this.texture=n;const l="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(l,"svg"),h=document.createElementNS(l,"foreignObject"),d=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=en.defaultMaxWidth,this.maxHeight=en.defaultMaxHeight,this._domElement=d,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(d),this._image=i,this._loadImage=new Image,this._autoResolution=en.defaultAutoResolution,this._resolution=null!=(s=en.defaultResolution)?s:Z.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:i,style:n,resolution:l}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:i,style:n.toCSS(l)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:h}=o,d=Math.min(this.maxWidth,Math.ceil(a)),c=Math.min(this.maxHeight,Math.ceil(h));return this._svgRoot.setAttribute("width",d.toString()),this._svgRoot.setAttribute("height",c.toString()),i!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:null==(e=this._style)?void 0:e.toCSS(l)}),this._styleElement.textContent=null==(s=this._style)?void 0:s.toGlobalCSS()),{width:d+2*n.padding,height:c+2*n.padding}}updateText(t=!0){return $(this,null,function*(){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:l}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,n)),s.height=i.height=Math.ceil(Math.max(1,l)),this._updateID++;const o=this._updateID;yield new Promise(a=>{i.onload=()=>$(this,null,function*(){o/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;var gt=(r=>(r[r.Region=0]="Region",r[r.BoundingBox=1]="BoundingBox",r[r.Mesh=2]="Mesh",r[r.LinkedMesh=3]="LinkedMesh",r[r.Path=4]="Path",r[r.Point=5]="Point",r[r.Clipping=6]="Clipping",r))(gt||{});class Ja{constructor(t,e=new Array,s=0,i=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){const t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s>4){case 12:case 13:e+=String.fromCharCode((31&i)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&i)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}var S=(r=>(r[r.setup=0]="setup",r[r.first=1]="first",r[r.replace=2]="replace",r[r.add=3]="add",r))(S||{}),mt=(r=>(r[r.mixIn=0]="mixIn",r[r.mixOut=1]="mixOut",r))(mt||{}),Ut=(r=>(r[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",r))(Ut||{}),Qt=(r=>(r[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale",r))(Qt||{}),nt=(r=>(r[r.Normal=0]="Normal",r[r.OnlyTranslation=1]="OnlyTranslation",r[r.NoRotationOrReflection=2]="NoRotationOrReflection",r[r.NoScale=3]="NoScale",r[r.NoScaleOrReflection=4]="NoScaleOrReflection",r))(nt||{});function qp(r){switch(r.toLowerCase()){case"nearest":return Ne.Nearest;case"linear":return Ne.Linear;case"mipmap":return Ne.MipMap;case"mipmapnearestnearest":return Ne.MipMapNearestNearest;case"mipmaplinearnearest":return Ne.MipMapLinearNearest;case"mipmapnearestlinear":return Ne.MipMapNearestLinear;case"mipmaplinearlinear":return Ne.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${r}`)}}var Ne=(r=>(r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.MipMap=9987]="MipMap",r[r.MipMapNearestNearest=9984]="MipMapNearestNearest",r[r.MipMapLinearNearest=9985]="MipMapLinearNearest",r[r.MipMapNearestLinear=9986]="MipMapNearestLinear",r[r.MipMapLinearLinear=9987]="MipMapLinearLinear",r))(Ne||{}),oi=(r=>(r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.ClampToEdge=33071]="ClampToEdge",r[r.Repeat=10497]="Repeat",r))(oi||{});class Mh{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return 0!==this.texture.rotate}get degrees(){return(360-45*this.texture.rotate)%360}}class yw{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Ch{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let i=null;for(let l=0;l{l.width=parseInt(n[1]),l.height=parseInt(n[2])},o.format=()=>{},o.filter=()=>{l.minFilter=qp(n[1]),l.magFilter=qp(n[2])},o.repeat=()=>{-1!=n[1].indexOf("x")&&(l.uWrap=oi.Repeat),-1!=n[1].indexOf("y")&&(l.vWrap=oi.Repeat)},o.pma=()=>{l.pma="true"==n[1]};const h={xy:()=>{a.x=parseInt(n[1]),a.y=parseInt(n[2])},size:()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},bounds:()=>{a.x=parseInt(n[1]),a.y=parseInt(n[2]),a.width=parseInt(n[3]),a.height=parseInt(n[4])},offset:()=>{a.offsetX=parseInt(n[1]),a.offsetY=parseInt(n[2])},orig:()=>{a.originalWidth=parseInt(n[1]),a.originalHeight=parseInt(n[2])},offsets:()=>{a.offsetX=parseInt(n[1]),a.offsetY=parseInt(n[2]),a.originalWidth=parseInt(n[3]),a.originalHeight=parseInt(n[4])},rotate:()=>{const u=n[1];let f=0;f="true"==u.toLocaleLowerCase()?6:"false"==u.toLocaleLowerCase()?0:(720-parseFloat(u))%360/45,a.rotate=f},index:()=>{a.index=parseInt(n[1])}};let d=i.readLine();for(;null!=d&&0==d.trim().length;)d=i.readLine();for(;null!=d&&0!=d.trim().length&&0!=i.readEntry(n,d);)d=i.readLine();const c=()=>{for(;;){if(null==d)return s&&s(this);if(0==d.trim().length)l=null,d=i.readLine();else{if(null===l){for(l=new Zp,l.name=d.trim();0!=i.readEntry(n,d=i.readLine());){const u=o[n[0]];u&&u()}this.pages.push(l),e(l.name,u=>{if(null===u)return this.pages.splice(this.pages.indexOf(l),1),s&&s(null);l.baseTexture=u,l.pma&&(u.alphaMode=Te.PMA),u.valid||u.setSize(l.width,l.height),l.setFilters(),(!l.width||!l.height)&&(l.width=u.realWidth,l.height=u.realHeight),c()});break}{a=new yw;const u=new Kp;u.name=d,u.page=l;let f=null,p=null;for(;;){const b=i.readEntry(n,d=i.readLine());if(0==b)break;const v=h[n[0]];if(v)v();else{null==f&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(null==e||0==(e=e.trim()).length)return 0;const s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){const l=e.indexOf(",",n);if(-1==l)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,l-n).trim(),n=l+1,4==i)return 4}}}class Zp{constructor(){this.minFilter=Ne.Nearest,this.magFilter=Ne.Nearest,this.uWrap=oi.ClampToEdge,this.vWrap=oi.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ne.Linear?t.scaleMode=Ge.LINEAR:this.minFilter==Ne.Nearest?t.scaleMode=Ge.NEAREST:(t.mipmap=rr.POW2,t.scaleMode=e==Ne.MipMapNearestNearest?Ge.NEAREST:Ge.LINEAR)}}class Kp extends Mh{}class Qp{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class Jp{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,i=t.length;s1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(r,t){r.r=((4278190080&t)>>>24)/255,r.g=((16711680&t)>>>16)/255,r.b=((65280&t)>>>8)/255,r.a=(255&t)/255}static rgb888ToColor(r,t){r.r=((16711680&t)>>>16)/255,r.g=((65280&t)>>>8)/255,r.b=(255&t)/255}static fromString(r){return(new li).setFromString(r)}};let W=li;W.WHITE=new li(1,1,1,1),W.RED=new li(1,0,0,1),W.GREEN=new li(0,1,0,1),W.BLUE=new li(0,0,1,1),W.MAGENTA=new li(1,0,1,1);const ls=class{static clamp(r,t,e){return re?e:r}static cosDeg(r){return Math.cos(r*ls.degRad)}static sinDeg(r){return Math.sin(r*ls.degRad)}static signum(r){return Math.sign(r)}static toInt(r){return r>0?Math.floor(r):Math.ceil(r)}static cbrt(r){const t=Math.pow(Math.abs(r),.3333333333333333);return r<0?-t:t}static randomTriangular(r,t){return ls.randomTriangularWith(r,t,.5*(r+t))}static randomTriangularWith(r,t,e){const s=Math.random(),i=t-r;return s<=(e-r)/i?r+Math.sqrt(s*i*(e-r)):t-Math.sqrt((1-s)*i*(t-e))}static isPowerOfTwo(r){return r&&!(r&r-1)}};let R=ls;R.PI=3.1415927,R.PI2=2*ls.PI,R.radiansToDegrees=180/ls.PI,R.radDeg=ls.radiansToDegrees,R.degreesToRadians=ls.PI/180,R.degRad=ls.degreesToRadians;class _w{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class bw extends _w{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class tm extends bw{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Vi=class{static arrayCopy(r,t,e,s,i){for(let n=t,l=s;n=t?r:Vi.setArraySize(r,t,e)}static newArray(r,t){const e=new Array(r);for(let s=0;s0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;eV.newFloatArray(16))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,l=t.slots,o=l.length;s.length=0,n.freeAll(i),i.length=0;for(let a=0;a=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){const n=this.minX,l=this.minY,o=this.maxX,a=this.maxY;if(t<=n&&s<=n||e<=l&&i<=l||t>=o&&s>=o||e>=a&&i>=a)return!1;const h=(i-e)/(s-t);let d=h*(n-t)+e;if(d>l&&dl&&dn&&cn&&ct.minX&&this.minYt.minY}containsPoint(t,e){const s=this.polygons;for(let i=0,n=s.length;i=s||d=s){const c=i[a];c+(s-h)/(d-h)*(i[l]-c)=c&&b<=p||b>=p&&b<=c)&&(b>=e&&b<=i||b>=i&&b<=e)){const v=(d*y-h*g)/_;if((v>=u&&v<=m||v>=m&&v<=u)&&(v>=s&&v<=n||v>=n&&v<=s))return!0}c=p,u=m}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}const ks=[0,0,0];class ww extends si{constructor(){super(...arguments),this.region=null,this.attachment=null}}class Ew extends Uv{constructor(t,e,s,i,n){super(t,e,s,i,n),this.region=null,this.attachment=null}}const em=class extends Ae{constructor(r){if(super(),!r)throw new Error("The spineData param is required.");if("string"==typeof r)throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=r,this.createSkeleton(r),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;te&&(r=e),this.state.update(r),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const s=this.skeleton.slots,i=this.color;let n=null,l=null;i?(n=i.light,l=i.dark):n=this.tintRgb;for(let d=0,c=s.length;dDe(r,".atlas"),load(r){return $(this,null,function*(){return yield(yield Z.ADAPTER.fetch(r)).text()})},testParse(r,t){const e=De(t.src,".atlas");return Promise.resolve(e&&"string"==typeof r)},parse(r,t,e){return $(this,null,function*(){const s=t.data;let i=Ot.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let n=null,l=null;const o=new Promise((d,c)=>{n=d,l=c});let a;const h=d=>{d||l("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),n(a)};if(s.image||s.images){const d=Object.assign(s.image?{default:s.image}:{},s.images);a=new Ch(r,(c,u)=>{const f=d[c]||d.default;u(f&&f.baseTexture?f.baseTexture:f)},h)}else a=new Ch(r,rm(e,i,s.imageMetadata),h);return yield o})},unload(r){r.dispose()}}},rm=(r,t,e)=>(s,i)=>$(this,null,function*(){const n=Ot.normalize([...t.split(Ot.sep),s].join(Ot.sep)),l=yield r.load({src:n,data:e});i(l.baseTexture)});function sm(r){return r.hasOwnProperty("bones")}tt.add(Aw);class Sw{constructor(){}installLoader(){const t=this,e={extension:q.Asset,loader:{extension:{type:q.LoadParser,priority:We.Normal},test:s=>De(s,".skel"),load(s){return $(this,null,function*(){return yield(yield Z.ADAPTER.fetch(s)).arrayBuffer()})},testParse(s,i){var n;const l=De(i.src,".json")&&sm(s),o=De(i.src,".skel")&&function Tw(r){return r instanceof ArrayBuffer}(s),a=!1===(null==(n=i.data)?void 0:n.spineAtlas);return Promise.resolve(l&&!a||o)},parse(s,i,n){return $(this,null,function*(){var l;const o=Ot.extname(i.src).toLowerCase(),a=Ot.basename(i.src,o);let h=Ot.dirname(i.src);h&&h.lastIndexOf("/")!==h.length-1&&(h+="/");const d=De(i.src,".json")&&sm(s);let c=null,u=s;d?c=t.createJsonParser():(c=t.createBinaryParser(),u=new Uint8Array(s));const f=i.data||{},p=null!=(l=f?.spineSkeletonScale)?l:null;p&&(c.scale=p);const m=f.spineAtlas;if(m&&m.pages)return t.parseData(c,m,u);const g=f.atlasRawData;if(g){let _=null,b=null;const v=new Promise((T,A)=>{_=T,b=A}),w=new Ch(g,rm(n,h,f.imageMetadata),T=>{T||b("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),_(w)}),E=yield v;return t.parseData(c,E,u)}let x=f.spineAtlasFile;x||(x=`${h+a}.atlas`);const y=yield n.load({src:x,data:f,alias:f.spineAtlasAlias});return t.parseData(c,y,u)})}}};return tt.add(e),e}}let kh=class{constructor(r){if(null==r)throw new Error("name cannot be null.");this.name=r}};const im=class extends kh{constructor(r){super(r),this.id=(65535&im.nextID++)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(r,t){this.computeWorldVertices(r,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(r,t,e,s,i,n){e=i+(e>>1)*n;const l=r.bone.skeleton,o=r.deform;let a=this.vertices;const h=this.bones;if(null==h){o.length>0&&(a=o);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,x=f.c,y=f.b,_=f.d;for(let b=t,v=i;v0&&(t%=this.duration));const a=this.timelines;for(let h=0,d=a.length;h>>1;for(;;){if(r[(n+1)*e]<=t?s=n+1:i=n,s==i)return(s+1)*e;n=s+i>>>1}}static linearSearch(r,t,e){for(let s=0,i=r.length-e;s<=i;s+=e)if(r[s]>t)return s;return-1}};var cm=(r=>(r[r.rotate=0]="rotate",r[r.translate=1]="translate",r[r.scale=2]="scale",r[r.shear=3]="shear",r[r.attachment=4]="attachment",r[r.color=5]="color",r[r.deform=6]="deform",r[r.event=7]="event",r[r.drawOrder=8]="drawOrder",r[r.ikConstraint=9]="ikConstraint",r[r.transformConstraint=10]="transformConstraint",r[r.pathConstraintPosition=11]="pathConstraintPosition",r[r.pathConstraintSpacing=12]="pathConstraintSpacing",r[r.pathConstraintMix=13]="pathConstraintMix",r[r.twoColor=14]="twoColor",r))(cm||{});const te=class{constructor(r){if(r<=0)throw new Error(`frameCount must be > 0: ${r}`);this.curves=V.newFloatArray((r-1)*te.BEZIER_SIZE)}getFrameCount(){return this.curves.length/te.BEZIER_SIZE+1}setLinear(r){this.curves[r*te.BEZIER_SIZE]=te.LINEAR}setStepped(r){this.curves[r*te.BEZIER_SIZE]=te.STEPPED}getCurveType(r){const t=r*te.BEZIER_SIZE;if(t==this.curves.length)return te.LINEAR;const e=this.curves[t];return e==te.LINEAR?te.LINEAR:e==te.STEPPED?te.STEPPED:te.BEZIER}setCurve(r,t,e,s,i){const n=.03*(2*-t+s),l=.03*(2*-e+i),o=.006*(3*(t-s)+1),a=.006*(3*(e-i)+1);let h=2*n+o,d=2*l+a,c=.3*t+n+.16666667*o,u=.3*e+l+.16666667*a,f=r*te.BEZIER_SIZE;const p=this.curves;p[f++]=te.BEZIER;let m=c,g=u;for(let x=f+te.BEZIER_SIZE-1;f=t){let h,d;return s==o?(h=0,d=0):(h=e[s-2],d=e[s-1]),d+(e[s+1]-d)*(t-h)/(n-h)}const l=e[s-1];return l+(1-l)*(t-n)/(1-n)}};let Oe=te;Oe.LINEAR=0,Oe.STEPPED=1,Oe.BEZIER=2,Oe.BEZIER_SIZE=19;const Ds=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(r,t,e){this.frames[r<<=1]=t,this.frames[r+Ds.ROTATION]=e}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.bones[this.boneIndex];if(!a.active)return;if(e=o[o.length-Ds.ENTRIES]){let p=o[o.length+Ds.PREV_ROTATION];switch(n){case S.setup:a.rotation=a.data.rotation+p*i;break;case S.first:case S.replace:p+=a.data.rotation-a.rotation,p-=360*(16384-(16384.499999999996-p/360|0));case S.add:a.rotation+=p*i}return}const h=Jt.binarySearch(o,e,Ds.ENTRIES),d=o[h+Ds.PREV_ROTATION],c=o[h],u=this.getCurvePercent((h>>1)-1,1-(e-c)/(o[h+Ds.PREV_TIME]-c));let f=o[h+Ds.ROTATION]-d;switch(f=d+(f-360*(16384-(16384.499999999996-f/360|0)))*u,n){case S.setup:a.rotation=a.data.rotation+(f-360*(16384-(16384.499999999996-f/360|0)))*i;break;case S.first:case S.replace:f+=a.data.rotation-a.rotation;case S.add:a.rotation+=(f-360*(16384-(16384.499999999996-f/360|0)))*i}}};let _e=Ds;_e.ENTRIES=2,_e.PREV_TIME=-2,_e.PREV_ROTATION=-1,_e.ROTATION=1;const Ie=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r*Ie.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(r,t,e,s){this.frames[r*=Ie.ENTRIES]=t,this.frames[r+Ie.X]=e,this.frames[r+Ie.Y]=s}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.bones[this.boneIndex];if(!a.active)return;if(e=o[o.length-Ie.ENTRIES])h=o[o.length+Ie.PREV_X],d=o[o.length+Ie.PREV_Y];else{const c=Jt.binarySearch(o,e,Ie.ENTRIES);h=o[c+Ie.PREV_X],d=o[c+Ie.PREV_Y];const u=o[c],f=this.getCurvePercent(c/Ie.ENTRIES-1,1-(e-u)/(o[c+Ie.PREV_TIME]-u));h+=(o[c+Ie.X]-h)*f,d+=(o[c+Ie.Y]-d)*f}switch(n){case S.setup:a.x=a.data.x+h*i,a.y=a.data.y+d*i;break;case S.first:case S.replace:a.x+=(a.data.x+h-a.x)*i,a.y+=(a.data.y+d-a.y)*i;break;case S.add:a.x+=h*i,a.y+=d*i}}};let je=Ie;je.ENTRIES=3,je.PREV_TIME=-3,je.PREV_X=-2,je.PREV_Y=-1,je.X=1,je.Y=2;let Dh=class Rr extends je{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,l,o){const a=this.frames,h=t.bones[this.boneIndex];if(!h.active)return;if(s=a[a.length-Rr.ENTRIES])d=a[a.length+Rr.PREV_X]*h.data.scaleX,c=a[a.length+Rr.PREV_Y]*h.data.scaleY;else{const u=Jt.binarySearch(a,s,Rr.ENTRIES);d=a[u+Rr.PREV_X],c=a[u+Rr.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Rr.ENTRIES-1,1-(s-f)/(a[u+Rr.PREV_TIME]-f));d=(d+(a[u+Rr.X]-d)*p)*h.data.scaleX,c=(c+(a[u+Rr.Y]-c)*p)*h.data.scaleY}if(1==n)l==S.add?(h.scaleX+=d-h.data.scaleX,h.scaleY+=c-h.data.scaleY):(h.scaleX=d,h.scaleY=c);else{let u=0,f=0;if(o==mt.mixOut)switch(l){case S.setup:u=h.data.scaleX,f=h.data.scaleY,h.scaleX=u+(Math.abs(d)*R.signum(u)-u)*n,h.scaleY=f+(Math.abs(c)*R.signum(f)-f)*n;break;case S.first:case S.replace:u=h.scaleX,f=h.scaleY,h.scaleX=u+(Math.abs(d)*R.signum(u)-u)*n,h.scaleY=f+(Math.abs(c)*R.signum(f)-f)*n;break;case S.add:u=h.scaleX,f=h.scaleY,h.scaleX=u+(Math.abs(d)*R.signum(u)-h.data.scaleX)*n,h.scaleY=f+(Math.abs(c)*R.signum(f)-h.data.scaleY)*n}else switch(l){case S.setup:u=Math.abs(h.data.scaleX)*R.signum(d),f=Math.abs(h.data.scaleY)*R.signum(c),h.scaleX=u+(d-u)*n,h.scaleY=f+(c-f)*n;break;case S.first:case S.replace:u=Math.abs(h.scaleX)*R.signum(d),f=Math.abs(h.scaleY)*R.signum(c),h.scaleX=u+(d-u)*n,h.scaleY=f+(c-f)*n;break;case S.add:u=R.signum(d),f=R.signum(c),h.scaleX=Math.abs(h.scaleX)*u+(d-Math.abs(h.data.scaleX)*u)*n,h.scaleY=Math.abs(h.scaleY)*f+(c-Math.abs(h.data.scaleY)*f)*n}}}},Nh=class Mr extends je{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,l,o){const a=this.frames,h=t.bones[this.boneIndex];if(!h.active)return;if(s=a[a.length-Mr.ENTRIES])d=a[a.length+Mr.PREV_X],c=a[a.length+Mr.PREV_Y];else{const u=Jt.binarySearch(a,s,Mr.ENTRIES);d=a[u+Mr.PREV_X],c=a[u+Mr.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Mr.ENTRIES-1,1-(s-f)/(a[u+Mr.PREV_TIME]-f));d+=(a[u+Mr.X]-d)*p,c+=(a[u+Mr.Y]-c)*p}switch(l){case S.setup:h.shearX=h.data.shearX+d*n,h.shearY=h.data.shearY+c*n;break;case S.first:case S.replace:h.shearX+=(h.data.shearX+d-h.shearX)*n,h.shearY+=(h.data.shearY+c-h.shearY)*n;break;case S.add:h.shearX+=d*n,h.shearY+=c*n}}};const Xt=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(r,t,e,s,i,n){this.frames[r*=Xt.ENTRIES]=t,this.frames[r+Xt.R]=e,this.frames[r+Xt.G]=s,this.frames[r+Xt.B]=i,this.frames[r+Xt.A]=n}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex];if(!o.bone.active)return;const a=this.frames;if(e=a[a.length-Xt.ENTRIES]){const f=a.length;h=a[f+Xt.PREV_R],d=a[f+Xt.PREV_G],c=a[f+Xt.PREV_B],u=a[f+Xt.PREV_A]}else{const f=Jt.binarySearch(a,e,Xt.ENTRIES);h=a[f+Xt.PREV_R],d=a[f+Xt.PREV_G],c=a[f+Xt.PREV_B],u=a[f+Xt.PREV_A];const p=a[f],m=this.getCurvePercent(f/Xt.ENTRIES-1,1-(e-p)/(a[f+Xt.PREV_TIME]-p));h+=(a[f+Xt.R]-h)*m,d+=(a[f+Xt.G]-d)*m,c+=(a[f+Xt.B]-c)*m,u+=(a[f+Xt.A]-u)*m}if(1==i)o.color.set(h,d,c,u);else{const f=o.color;n==S.setup&&f.setFromColor(o.data.color),f.add((h-f.r)*i,(d-f.g)*i,(c-f.b)*i,(u-f.a)*i)}}};let Re=Xt;Re.ENTRIES=5,Re.PREV_TIME=-5,Re.PREV_R=-4,Re.PREV_G=-3,Re.PREV_B=-2,Re.PREV_A=-1,Re.R=1,Re.G=2,Re.B=3,Re.A=4;const wt=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r*wt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(r,t,e,s,i,n,l,o,a){this.frames[r*=wt.ENTRIES]=t,this.frames[r+wt.R]=e,this.frames[r+wt.G]=s,this.frames[r+wt.B]=i,this.frames[r+wt.A]=n,this.frames[r+wt.R2]=l,this.frames[r+wt.G2]=o,this.frames[r+wt.B2]=a}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex];if(!o.bone.active)return;const a=this.frames;if(e=a[a.length-wt.ENTRIES]){const g=a.length;h=a[g+wt.PREV_R],d=a[g+wt.PREV_G],c=a[g+wt.PREV_B],u=a[g+wt.PREV_A],f=a[g+wt.PREV_R2],p=a[g+wt.PREV_G2],m=a[g+wt.PREV_B2]}else{const g=Jt.binarySearch(a,e,wt.ENTRIES);h=a[g+wt.PREV_R],d=a[g+wt.PREV_G],c=a[g+wt.PREV_B],u=a[g+wt.PREV_A],f=a[g+wt.PREV_R2],p=a[g+wt.PREV_G2],m=a[g+wt.PREV_B2];const x=a[g],y=this.getCurvePercent(g/wt.ENTRIES-1,1-(e-x)/(a[g+wt.PREV_TIME]-x));h+=(a[g+wt.R]-h)*y,d+=(a[g+wt.G]-d)*y,c+=(a[g+wt.B]-c)*y,u+=(a[g+wt.A]-u)*y,f+=(a[g+wt.R2]-f)*y,p+=(a[g+wt.G2]-p)*y,m+=(a[g+wt.B2]-m)*y}if(1==i)o.color.set(h,d,c,u),o.darkColor.set(f,p,m,1);else{const g=o.color,x=o.darkColor;n==S.setup&&(g.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),g.add((h-g.r)*i,(d-g.g)*i,(c-g.b)*i,(u-g.a)*i),x.add((f-x.r)*i,(p-x.g)*i,(m-x.b)*i,0)}}};let ee=wt;ee.ENTRIES=8,ee.PREV_TIME=-8,ee.PREV_R=-7,ee.PREV_G=-6,ee.PREV_B=-5,ee.PREV_A=-4,ee.PREV_R2=-3,ee.PREV_G2=-2,ee.PREV_B2=-1,ee.R=1,ee.G=2,ee.B=3,ee.A=4,ee.R2=5,ee.G2=6,ee.B2=7;let hi=class{constructor(r){this.frames=V.newFloatArray(r),this.attachmentNames=new Array(r)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.attachmentNames[r]=e}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex];if(!o.bone.active)return;if(l==mt.mixOut)return void(n==S.setup&&this.setAttachment(r,o,o.data.attachmentName));const a=this.frames;if(e=a[a.length-1]?a.length-1:Jt.binarySearch(a,e,1)-1;const d=this.attachmentNames[h];r.slots[this.slotIndex].setAttachment(null==d?null:r.getAttachment(this.slotIndex,d))}setAttachment(r,t,e){t.setAttachment(null==e?null:r.getAttachment(this.slotIndex,e))}},um=null,Oh=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r),this.frameVertices=new Array(r),null==um&&(um=V.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(r,t,e){this.frames[r]=t,this.frameVertices[r]=e}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex];if(!o.bone.active)return;const a=o.getAttachment();if(!(a instanceof Fs)||a.deformAttachment!=this.attachment)return;const h=o.deform;0==h.length&&(n=S.setup);const d=this.frameVertices,c=d[0].length,u=this.frames;if(e=u[u.length-1]){const _=d[u.length-1];if(1==i)if(n==S.add)if(null==a.bones){const v=a.vertices;for(let w=0;we)this.apply(r,t,Number.MAX_VALUE,s,i,n,l),t=-1;else if(t>=o[a-1])return;if(e0&&o[h-1]==d;)h--}for(;h=o[h];h++)s.push(this.events[h])}},Xi=class{constructor(r){this.frames=V.newFloatArray(r),this.drawOrders=new Array(r)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.drawOrders[r]=e}apply(r,t,e,s,i,n,l){const o=r.drawOrder,a=r.slots;if(l==mt.mixOut&&n==S.setup)return void V.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);const h=this.frames;if(e=h[h.length-1]?h.length-1:Jt.binarySearch(h,e)-1;const c=this.drawOrders[d];if(null==c)V.arrayCopy(a,0,o,0,a.length);else for(let u=0,f=c.length;u=o[o.length-It.ENTRIES])return void(n==S.setup?(a.mix=a.data.mix+(o[o.length+It.PREV_MIX]-a.data.mix)*i,a.softness=a.data.softness+(o[o.length+It.PREV_SOFTNESS]-a.data.softness)*i,l==mt.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=o[o.length+It.PREV_BEND_DIRECTION],a.compress=0!=o[o.length+It.PREV_COMPRESS],a.stretch=0!=o[o.length+It.PREV_STRETCH])):(a.mix+=(o[o.length+It.PREV_MIX]-a.mix)*i,a.softness+=(o[o.length+It.PREV_SOFTNESS]-a.softness)*i,l==mt.mixIn&&(a.bendDirection=o[o.length+It.PREV_BEND_DIRECTION],a.compress=0!=o[o.length+It.PREV_COMPRESS],a.stretch=0!=o[o.length+It.PREV_STRETCH])));const h=Jt.binarySearch(o,e,It.ENTRIES),d=o[h+It.PREV_MIX],c=o[h+It.PREV_SOFTNESS],u=o[h],f=this.getCurvePercent(h/It.ENTRIES-1,1-(e-u)/(o[h+It.PREV_TIME]-u));n==S.setup?(a.mix=a.data.mix+(d+(o[h+It.MIX]-d)*f-a.data.mix)*i,a.softness=a.data.softness+(c+(o[h+It.SOFTNESS]-c)*f-a.data.softness)*i,l==mt.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=o[h+It.PREV_BEND_DIRECTION],a.compress=0!=o[h+It.PREV_COMPRESS],a.stretch=0!=o[h+It.PREV_STRETCH])):(a.mix+=(d+(o[h+It.MIX]-d)*f-a.mix)*i,a.softness+=(c+(o[h+It.SOFTNESS]-c)*f-a.softness)*i,l==mt.mixIn&&(a.bendDirection=o[h+It.PREV_BEND_DIRECTION],a.compress=0!=o[h+It.PREV_COMPRESS],a.stretch=0!=o[h+It.PREV_STRETCH]))}};let be=It;be.ENTRIES=6,be.PREV_TIME=-6,be.PREV_MIX=-5,be.PREV_SOFTNESS=-4,be.PREV_BEND_DIRECTION=-3,be.PREV_COMPRESS=-2,be.PREV_STRETCH=-1,be.MIX=1,be.SOFTNESS=2,be.BEND_DIRECTION=3,be.COMPRESS=4,be.STRETCH=5;const Yt=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r*Yt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(r,t,e,s,i,n){this.frames[r*=Yt.ENTRIES]=t,this.frames[r+Yt.ROTATE]=e,this.frames[r+Yt.TRANSLATE]=s,this.frames[r+Yt.SCALE]=i,this.frames[r+Yt.SHEAR]=n}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.transformConstraints[this.transformConstraintIndex];if(!a.active)return;if(e=o[o.length-Yt.ENTRIES]){const f=o.length;h=o[f+Yt.PREV_ROTATE],d=o[f+Yt.PREV_TRANSLATE],c=o[f+Yt.PREV_SCALE],u=o[f+Yt.PREV_SHEAR]}else{const f=Jt.binarySearch(o,e,Yt.ENTRIES);h=o[f+Yt.PREV_ROTATE],d=o[f+Yt.PREV_TRANSLATE],c=o[f+Yt.PREV_SCALE],u=o[f+Yt.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/Yt.ENTRIES-1,1-(e-p)/(o[f+Yt.PREV_TIME]-p));h+=(o[f+Yt.ROTATE]-h)*m,d+=(o[f+Yt.TRANSLATE]-d)*m,c+=(o[f+Yt.SCALE]-c)*m,u+=(o[f+Yt.SHEAR]-u)*m}if(n==S.setup){const f=a.data;a.rotateMix=f.rotateMix+(h-f.rotateMix)*i,a.translateMix=f.translateMix+(d-f.translateMix)*i,a.scaleMix=f.scaleMix+(c-f.scaleMix)*i,a.shearMix=f.shearMix+(u-f.shearMix)*i}else a.rotateMix+=(h-a.rotateMix)*i,a.translateMix+=(d-a.translateMix)*i,a.scaleMix+=(c-a.scaleMix)*i,a.shearMix+=(u-a.shearMix)*i}};let Me=Yt;Me.ENTRIES=5,Me.PREV_TIME=-5,Me.PREV_ROTATE=-4,Me.PREV_TRANSLATE=-3,Me.PREV_SCALE=-2,Me.PREV_SHEAR=-1,Me.ROTATE=1,Me.TRANSLATE=2,Me.SCALE=3,Me.SHEAR=4;const gr=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r*gr.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(r,t,e){this.frames[r*=gr.ENTRIES]=t,this.frames[r+gr.VALUE]=e}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(e=o[o.length-gr.ENTRIES])h=o[o.length+gr.PREV_VALUE];else{const d=Jt.binarySearch(o,e,gr.ENTRIES);h=o[d+gr.PREV_VALUE];const c=o[d],u=this.getCurvePercent(d/gr.ENTRIES-1,1-(e-c)/(o[d+gr.PREV_TIME]-c));h+=(o[d+gr.VALUE]-h)*u}n==S.setup?a.position=a.data.position+(h-a.data.position)*i:a.position+=(h-a.position)*i}};let Wr=gr;Wr.ENTRIES=2,Wr.PREV_TIME=-2,Wr.PREV_VALUE=-1,Wr.VALUE=1;let Bh=class Vs extends Wr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,l,o){const a=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(s=a[a.length-Vs.ENTRIES])d=a[a.length+Vs.PREV_VALUE];else{const c=Jt.binarySearch(a,s,Vs.ENTRIES);d=a[c+Vs.PREV_VALUE];const u=a[c],f=this.getCurvePercent(c/Vs.ENTRIES-1,1-(s-u)/(a[c+Vs.PREV_TIME]-u));d+=(a[c+Vs.VALUE]-d)*f}l==S.setup?h.spacing=h.data.spacing+(d-h.data.spacing)*n:h.spacing+=(d-h.spacing)*n}};const Ce=class extends Oe{constructor(r){super(r),this.frames=V.newFloatArray(r*Ce.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(r,t,e,s){this.frames[r*=Ce.ENTRIES]=t,this.frames[r+Ce.ROTATE]=e,this.frames[r+Ce.TRANSLATE]=s}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(e=o[o.length-Ce.ENTRIES])h=o[o.length+Ce.PREV_ROTATE],d=o[o.length+Ce.PREV_TRANSLATE];else{const c=Jt.binarySearch(o,e,Ce.ENTRIES);h=o[c+Ce.PREV_ROTATE],d=o[c+Ce.PREV_TRANSLATE];const u=o[c],f=this.getCurvePercent(c/Ce.ENTRIES-1,1-(e-u)/(o[c+Ce.PREV_TIME]-u));h+=(o[c+Ce.ROTATE]-h)*f,d+=(o[c+Ce.TRANSLATE]-d)*f}n==S.setup?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*i,a.translateMix=a.data.translateMix+(d-a.data.translateMix)*i):(a.rotateMix+=(h-a.rotateMix)*i,a.translateMix+=(d-a.translateMix)*i)}};let yr=Ce;yr.ENTRIES=3,yr.PREV_TIME=-3,yr.PREV_ROTATE=-2,yr.PREV_TRANSLATE=-1,yr.ROTATE=1,yr.TRANSLATE=2;const Gt=class{constructor(r){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Vh(this),this.propertyIDs=new Qp,this.animationsChanged=!1,this.trackEntryPool=new to(()=>new so),this.data=r}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let l=i.next;if(null!=l){const o=i.trackLast-l.delay;if(o>=0){for(l.delay=0,l.trackTime+=0==i.timeScale?0:(o/i.timeScale+r)*l.timeScale,i.trackTime+=n,this.setCurrent(e,l,!0);null!=l.mixingFrom;)l.mixTime+=r,l=l.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&null==i.mixingFrom){t[e]=null,this.queue.end(i),this.disposeNext(i);continue}if(null!=i.mixingFrom&&this.updateMixingFrom(i,r)){let o=i.mixingFrom;for(i.mixingFrom=null,null!=o&&(o.mixingTo=null);null!=o;)this.queue.end(o),o=o.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(null==e)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,r.mixTime>0&&r.mixTime>=r.mixDuration?((0==e.totalAlpha||0==r.mixDuration)&&(r.mixingFrom=e.mixingFrom,null!=e.mixingFrom&&(e.mixingFrom.mixingTo=r),r.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,r.mixTime+=t,!1)}apply(r){if(null==r)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let l=0,o=e.length;l0)continue;s=!0;const h=0==l?S.first:a.mixBlend;let d=a.alpha;null!=a.mixingFrom?d*=this.applyMixingFrom(a,r,h):a.trackTime>=a.trackEnd&&null==a.next&&(d=0);const c=a.animationLast,u=a.getAnimationTime(),f=a.animation.timelines.length,p=a.animation.timelines;if(0==l&&1==d||h==S.add)for(let m=0;m1&&(i=1),e!=S.first&&(e=s.mixBlend));const n=i0&&this.queueEvents(s,h),this.events.length=0,s.nextAnimationLast=h,s.nextTrackLast=s.trackTime,i}applyAttachmentTimeline(r,t,e,s,i){const n=t.slots[r.slotIndex];if(!n.bone.active)return;const l=r.frames;if(e=l[l.length-1]?l.length-1:Jt.binarySearch(l,e)-1,this.setAttachment(t,n,r.attachmentNames[o],i)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Gt.SETUP)}setAttachment(r,t,e,s){t.setAttachment(null==e?null:r.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Gt.CURRENT)}applyRotateTimeline(r,t,e,s,i,n,l,o){if(o&&(n[l]=0),1==s)return void r.apply(t,0,e,null,1,i,mt.mixIn);const a=r,h=a.frames,d=t.bones[a.boneIndex];if(!d.active)return;let c=0,u=0;if(e=h[h.length-_e.ENTRIES])u=d.data.rotation+h[h.length+_e.PREV_ROTATION];else{const m=Jt.binarySearch(h,e,_e.ENTRIES),g=h[m+_e.PREV_ROTATION],x=h[m],y=a.getCurvePercent((m>>1)-1,1-(e-x)/(h[m+_e.PREV_TIME]-x));u=h[m+_e.ROTATION]-g,u-=360*(16384-(16384.499999999996-u/360|0)),u=g+u*y+d.data.rotation,u-=360*(16384-(16384.499999999996-u/360|0))}let f=0,p=u-c;if(p-=360*(16384-(16384.499999999996-p/360|0)),0==p)f=n[l];else{let m=0,g=0;o?(m=0,g=p):(m=n[l],g=n[l+1]);const x=p>0;let y=m>=0;R.signum(g)!=R.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*R.signum(m)),y=x),f=p+m-m%360,y!=x&&(f+=360*R.signum(m)),n[l]=f}n[l+1]=p,c+=f*s,d.rotation=c-360*(16384-(16384.499999999996-c/360|0))}queueEvents(r,t){const e=r.animationStart,s=r.animationEnd,i=s-e,n=r.trackLast%i,l=this.events;let o=0;const a=l.length;for(;os||this.queue.event(r,d)}let h=!1;for(h=r.loop?0==i||n>r.trackTime%i:t>=s&&r.animationLast=this.tracks.length)return;const t=this.tracks[r];if(null==t)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(null==s)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(r,t,e){const s=this.expandToIndex(r);this.tracks[r]=t,null!=s&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,null!=s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(r,t,e){const s=this.data.skeletonData.findAnimation(t);if(null==s)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,s,e)}setAnimationWith(r,t,e){if(null==t)throw new Error("animation cannot be null.");let s=!0,i=this.expandToIndex(r);null!=i&&(-1==i.nextTrackLast?(this.tracks[r]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,s=!1):this.disposeNext(i));const n=this.trackEntry(r,t,e,i);return this.setCurrent(r,n,s),this.queue.drain(),n}addAnimation(r,t,e,s){const i=this.data.skeletonData.findAnimation(t);if(null==i)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,i,e,s)}addAnimationWith(r,t,e,s){if(null==t)throw new Error("animation cannot be null.");let i=this.expandToIndex(r);if(null!=i)for(;null!=i.next;)i=i.next;const n=this.trackEntry(r,t,e,i);if(null==i)this.setCurrent(r,n,!0),this.queue.drain();else if(i.next=n,s<=0){const l=i.animationEnd-i.animationStart;0!=l?(s+=i.loop?l*(1+(i.trackTime/l|0)):Math.max(l,i.trackTime),s-=this.data.getMix(i.animation,t)):s=i.trackTime}return n.delay=s,n}setEmptyAnimation(r,t){const e=this.setAnimationWith(r,Gt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(r,Gt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(r){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){i[o]=Gt.HOLD_MIX,n[o]=d;continue t}break}i[o]=Gt.HOLD_FIRST}else i[o]=Gt.SUBSEQUENT}}getCurrent(r){return r>=this.tracks.length?null:this.tracks[r]}addListener(r){if(null==r)throw new Error("listener cannot be null.");this.listeners.push(r)}removeListener(r){const t=this.listeners.indexOf(r);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(r,t,e){Gt.deprecatedWarning1||(Gt.deprecatedWarning1=!0),this.setAnimation(r,t,e)}addAnimationByName(r,t,e,s){Gt.deprecatedWarning2||(Gt.deprecatedWarning2=!0),this.addAnimation(r,t,e,s)}hasAnimation(r){return null!==this.data.skeletonData.findAnimation(r)}hasAnimationByName(r){return Gt.deprecatedWarning3||(Gt.deprecatedWarning3=!0),this.hasAnimation(r)}};let $e=Gt;$e.emptyAnimation=new Jt("",[],0),$e.SUBSEQUENT=0,$e.FIRST=1,$e.HOLD_SUBSEQUENT=2,$e.HOLD_FIRST=3,$e.HOLD_MIX=4,$e.SETUP=1,$e.CURRENT=2,$e.deprecatedWarning1=!1,$e.deprecatedWarning2=!1,$e.deprecatedWarning3=!1;const hs=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const r=this.animationEnd-this.animationStart;return 0==r?this.animationStart:this.trackTime%r+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(r){this.animationLast=r,this.nextAnimationLast=r}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return hs.deprecatedWarning1||(hs.deprecatedWarning1=!0),this.trackTime}set time(r){hs.deprecatedWarning1||(hs.deprecatedWarning1=!0),this.trackTime=r}get endTime(){return hs.deprecatedWarning2||(hs.deprecatedWarning2=!0),this.trackTime}set endTime(r){hs.deprecatedWarning2||(hs.deprecatedWarning2=!0),this.trackTime=r}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let so=hs;so.deprecatedWarning1=!1,so.deprecatedWarning2=!1;const Lh=class{constructor(r){this.objects=[],this.drainDisabled=!1,this.animState=r}start(r){this.objects.push(Be.start),this.objects.push(r),this.animState.animationsChanged=!0}interrupt(r){this.objects.push(Be.interrupt),this.objects.push(r)}end(r){this.objects.push(Be.end),this.objects.push(r),this.animState.animationsChanged=!0}dispose(r){this.objects.push(Be.dispose),this.objects.push(r)}complete(r){this.objects.push(Be.complete),this.objects.push(r)}event(r,t){this.objects.push(Be.event),this.objects.push(r),this.objects.push(t)}deprecateStuff(){return Lh.deprecatedWarning1||(Lh.deprecatedWarning1=!0),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const r=this.objects,t=this.animState.listeners;for(let e=0;e(r[r.start=0]="start",r[r.interrupt=1]="interrupt",r[r.end=2]="end",r[r.dispose=3]="dispose",r[r.complete=4]="complete",r[r.event=5]="event",r))(Be||{});const Uh=class{constructor(r){if(this.animationToMixTime={},this.defaultMix=0,null==r)throw new Error("skeletonData cannot be null.");this.skeletonData=r}setMix(r,t,e){const s=this.skeletonData.findAnimation(r);if(null==s)throw new Error(`Animation not found: ${r}`);const i=this.skeletonData.findAnimation(t);if(null==i)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,i,e)}setMixByName(r,t,e){Uh.deprecatedWarning1||(Uh.deprecatedWarning1=!0),this.setMix(r,t,e)}setMixWith(r,t,e){if(null==r)throw new Error("from cannot be null.");if(null==t)throw new Error("to cannot be null.");this.animationToMixTime[`${r.name}.${t.name}`]=e}getMix(r,t){const s=this.animationToMixTime[`${r.name}.${t.name}`];return void 0===s?this.defaultMix:s}};let Xh=Uh;Xh.deprecatedWarning1=!1;let Yh=class{constructor(r){this.atlas=r}newRegionAttachment(r,t,e){const s=this.atlas.findRegion(e);if(null==s)throw new Error(`Region not found in atlas: ${e} (region attachment: ${t})`);const i=new ut(t);return i.region=s,i}newMeshAttachment(r,t,e){const s=this.atlas.findRegion(e);if(null==s)throw new Error(`Region not found in atlas: ${e} (mesh attachment: ${t})`);const i=new eo(t);return i.region=s,i}newBoundingBoxAttachment(r,t){return new nm(t)}newPathAttachment(r,t){return new Cn(t)}newPointAttachment(r,t){return new om(t)}newClippingAttachment(r,t){return new am(t)}},Gh=class{constructor(r,t,e){if(this.matrix=new kt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.skeleton=t,this.parent=e,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(r,t,e,s,i,n,l){this.ax=r,this.ay=t,this.arotation=e,this.ascaleX=s,this.ascaleY=i,this.ashearX=n,this.ashearY=l,this.appliedValid=!0;const o=this.parent,a=this.matrix,h=this.skeleton.scaleX,d=-this.skeleton.scaleY;if(null==o){const m=this.skeleton,g=e+90+l;return a.a=R.cosDeg(e+n)*s*h,a.c=R.cosDeg(g)*i*h,a.b=R.sinDeg(e+n)*s*d,a.d=R.sinDeg(g)*i*d,a.tx=r*h+m.x,void(a.ty=t*d+m.y)}let c=o.matrix.a,u=o.matrix.c,f=o.matrix.b,p=o.matrix.d;switch(a.tx=c*r+u*t+o.matrix.tx,a.ty=f*r+p*t+o.matrix.ty,this.data.transformMode){case nt.Normal:{const m=e+90+l,g=R.cosDeg(e+n)*s,x=R.cosDeg(m)*i,y=R.sinDeg(e+n)*s,_=R.sinDeg(m)*i;return a.a=c*g+u*y,a.c=c*x+u*_,a.b=f*g+p*y,void(a.d=f*x+p*_)}case nt.OnlyTranslation:{const m=e+90+l;a.a=R.cosDeg(e+n)*s,a.c=R.cosDeg(m)*i,a.b=R.sinDeg(e+n)*s,a.d=R.sinDeg(m)*i;break}case nt.NoRotationOrReflection:{let m=c*c+f*f,g=0;m>1e-4?(m=Math.abs(c*p-u*f)/m,c/=this.skeleton.scaleX,f/=this.skeleton.scaleY,u=f*m,p=c*m,g=Math.atan2(f,c)*R.radDeg):(c=0,f=0,g=90-Math.atan2(p,u)*R.radDeg);const x=e+n-g,y=e+l-g+90,_=R.cosDeg(x)*s,b=R.cosDeg(y)*i,v=R.sinDeg(x)*s,w=R.sinDeg(y)*i;a.a=c*_-u*v,a.c=c*b-u*w,a.b=f*_+p*v,a.d=f*b+p*w;break}case nt.NoScale:case nt.NoScaleOrReflection:{const m=R.cosDeg(e),g=R.sinDeg(e);let x=(c*m+u*g)/h,y=(f*m+p*g)/d,_=Math.sqrt(x*x+y*y);_>1e-5&&(_=1/_),x*=_,y*=_,_=Math.sqrt(x*x+y*y),this.data.transformMode==nt.NoScale&&c*p-u*f<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(_=-_);const b=Math.PI/2+Math.atan2(y,x),v=Math.cos(b)*_,w=Math.sin(b)*_,E=R.cosDeg(n)*s,T=R.cosDeg(90+l)*i,A=R.sinDeg(n)*s,D=R.sinDeg(90+l)*i;a.a=x*E+v*A,a.c=x*T+v*D,a.b=y*E+w*A,a.d=y*T+w*D;break}}a.a*=h,a.c*=h,a.b*=d,a.d*=d}setToSetupPose(){const r=this.data;this.x=r.x,this.y=r.y,this.rotation=r.rotation,this.scaleX=r.scaleX,this.scaleY=r.scaleY,this.shearX=r.shearX,this.shearY=r.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*R.radDeg}getWorldScaleX(){const r=this.matrix;return Math.sqrt(r.a*r.a+r.c*r.c)}getWorldScaleY(){const r=this.matrix;return Math.sqrt(r.b*r.b+r.d*r.d)}updateAppliedTransform(){this.appliedValid=!0;const r=this.parent,t=this.matrix;if(null==r)return this.ax=t.tx,this.ay=t.ty,this.arotation=Math.atan2(t.b,t.a)*R.radDeg,this.ascaleX=Math.sqrt(t.a*t.a+t.b*t.b),this.ascaleY=Math.sqrt(t.c*t.c+t.d*t.d),this.ashearX=0,void(this.ashearY=Math.atan2(t.a*t.c+t.b*t.d,t.a*t.d-t.b*t.c)*R.radDeg);const e=r.matrix,s=1/(e.a*e.d-e.b*e.c),i=t.tx-e.tx,n=t.ty-e.ty;this.ax=i*e.d*s-n*e.c*s,this.ay=n*e.a*s-i*e.b*s;const l=s*e.d,o=s*e.a,a=s*e.c,h=s*e.b,d=l*t.a-a*t.b,c=l*t.c-a*t.d,u=o*t.b-h*t.a,f=o*t.d-h*t.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){const p=d*f-c*u;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(d*c+u*f,p)*R.radDeg,this.arotation=Math.atan2(u,d)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(c*c+f*f),this.ashearY=0,this.arotation=90-Math.atan2(f,c)*R.radDeg}worldToLocal(r){const t=this.matrix,e=t.a,s=t.c,i=t.b,n=t.d,l=1/(e*n-s*i),o=r.x-t.tx,a=r.y-t.ty;return r.x=o*n*l-a*s*l,r.y=a*e*l-o*i*l,r}localToWorld(r){const t=this.matrix,e=r.x,s=r.y;return r.x=e*t.a+s*t.c+t.tx,r.y=e*t.b+s*t.d+t.ty,r}worldToLocalRotation(r){const t=R.sinDeg(r),e=R.cosDeg(r),s=this.matrix;return Math.atan2(s.a*t-s.b*e,s.d*e-s.c*t)*R.radDeg}localToWorldRotation(r){const t=R.sinDeg(r),e=R.cosDeg(r),s=this.matrix;return Math.atan2(e*s.b+t*s.d,e*s.a+t*s.c)*R.radDeg}rotateWorld(r){const t=this.matrix,e=t.a,s=t.c,i=t.b,n=t.d,l=R.cosDeg(r),o=R.sinDeg(r);t.a=l*e-o*i,t.c=l*s-o*n,t.b=o*e+l*i,t.d=o*s+l*n,this.appliedValid=!1}},Hh=class{constructor(r,t,e){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=nt.Normal,this.skinRequired=!1,this.color=new W,r<0)throw new Error("index must be >= 0.");if(null==t)throw new Error("name cannot be null.");this.index=r,this.name=t,this.parent=e}},io=class{constructor(r,t,e){this.name=r,this.order=t,this.skinRequired=e}},Wh=class{constructor(r,t){if(null==t)throw new Error("data cannot be null.");this.time=r,this.data=t}},jh=class{constructor(r){this.name=r}},dm=class{constructor(r,t){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.mix=r.mix,this.softness=r.softness,this.bendDirection=r.bendDirection,this.compress=r.compress,this.stretch=r.stretch,this.bones=new Array;for(let e=0;e180?u-=360:u<-180&&(u+=360);let m=r.ascaleX,g=r.ascaleY;if(s||i){switch(r.data.transformMode){case nt.NoScale:case nt.NoScaleOrReflection:f=t-r.worldX,p=e-r.worldY}const x=r.data.length*m,y=Math.sqrt(f*f+p*p);if(s&&yx&&x>1e-4){const _=(y/x-1)*l+1;m*=_,n&&(g*=_)}}r.updateWorldTransformWith(r.ax,r.ay,r.arotation+u*l,m,g,r.ashearX,r.ashearY)}apply2(r,t,e,s,i,n,l,o){if(0==o)return void t.updateWorldTransform();r.appliedValid||r.updateAppliedTransform(),t.appliedValid||t.updateAppliedTransform();const a=r.ax,h=r.ay;let d=r.ascaleX,c=d,u=r.ascaleY,f=t.ascaleX;const p=r.matrix;let m=0,g=0,x=0;d<0?(d=-d,m=180,x=-1):(m=0,x=1),u<0&&(u=-u,x=-x),f<0?(f=-f,g=180):g=0;const y=t.ax;let _=0,b=0,v=0,w=p.a,E=p.c,T=p.b,A=p.d;const D=Math.abs(d-u)<=1e-4;D?(_=t.ay,b=w*y+E*_+p.tx,v=T*y+A*_+p.ty):(_=0,b=w*y+p.tx,v=T*y+p.ty);const C=r.parent.matrix;w=C.a,E=C.c,T=C.b,A=C.d;const M=1/(w*A-E*T);let I=b-C.tx,P=v-C.ty;const B=(I*A-P*E)*M-a,U=(P*w-I*T)*M-h,O=Math.sqrt(B*B+U*U);let N,F,k=t.data.length*f;if(O<1e-4)return this.apply1(r,e,s,!1,n,!1,o),void t.updateWorldTransformWith(y,_,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);I=e-C.tx,P=s-C.ty;let L=(I*A-P*E)*M-a,Y=(P*w-I*T)*M-h,H=L*L+Y*Y;if(0!=l){l*=d*(f+1)/2;const K=Math.sqrt(H),lt=K-O-k*d+l;if(lt>0){let ht=Math.min(1,lt/(2*l))-1;ht=(lt-l*(1-ht*ht))/K,L-=ht*L,Y-=ht*Y,H=L*L+Y*Y}}t:if(D){k*=d;let K=(H-O*O-k*k)/(2*O*k);K<-1?K=-1:K>1&&(K=1,n&&(c*=(Math.sqrt(H)/(O+k)-1)*o+1)),F=Math.acos(K)*i,w=O+k*K,E=k*Math.sin(F),N=Math.atan2(Y*w-L*E,L*w+Y*E)}else{w=d*k,E=u*k;const K=w*w,lt=E*E,ht=Math.atan2(Y,L);T=lt*O*O+K*H-K*lt;const ft=-2*lt*O,yt=lt-K;if(A=ft*ft-4*yt*T,A>=0){let Ye=Math.sqrt(A);ft<0&&(Ye=-Ye),Ye=-(ft+Ye)/2;const ys=Ye/yt,or=T/Ye,Je=Math.abs(ys)=-1&&T<=1&&(T=Math.acos(T),I=w*Math.cos(T)+O,P=E*Math.sin(T),A=I*I+P*P,ASr&&(jt=T,Sr=A,ge=I,we=P)),H<=(Mt+Sr)/2?(N=ht-Math.atan2(ce*i,ct),F=at*i):(N=ht-Math.atan2(we*i,ge),F=jt*i)}const G=Math.atan2(_,y)*x;let z=r.arotation;N=(N-G)*R.radDeg+m-z,N>180?N-=360:N<-180&&(N+=360),r.updateWorldTransformWith(a,h,z+N*o,c,r.ascaleY,0,0),z=t.arotation,F=((F+G)*R.radDeg-t.ashearX)*x+g-z,F>180?F-=360:F<-180&&(F+=360),t.updateWorldTransformWith(y,_,z+F*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},$h=class extends io{constructor(r){super(r,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},zh=class extends io{constructor(r){super(r,0,!1),this.bones=new Array}};var pe=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(pe||{});const ci=class{constructor(r,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.bones=new Array;for(let e=0,s=r.bones.length;e0;if(!(e>0||i))return;const n=this.data,l=n.spacingMode,o=l==pe.Length,a=n.rotateMode,h=a==Qt.Tangent,d=a==Qt.ChainScale,c=this.bones.length,u=h?c:c+1,f=this.bones,p=V.setArraySize(this.spaces,u);let m=null;const g=this.spacing;if(d||o){d&&(m=V.setArraySize(this.lengths,c));for(let w=0,E=u-1;w0?R.degRad:-R.degRad}for(let w=0,E=3;wR.PI?k-=R.PI2:k<-R.PI&&(k+=R.PI2),k*=t,N=Math.cos(k),F=Math.sin(k),A.a=N*P-F*U,A.c=N*B-F*O,A.b=F*P+N*U,A.d=F*B+N*O}T.appliedValid=!1}}computeWorldPositions(r,t,e,s,i){const n=this.target;let l=this.position;const o=this.spaces,a=V.setArraySize(this.positions,3*t+2);let h=null;const d=r.closed;let c=r.worldVerticesLength,u=c/6,f=ci.NONE;if(!r.constantSpeed){const k=r.lengths;u-=d?1:2;const N=k[u];if(s&&(l*=N),i)for(let F=0;FN){f!=ci.AFTER&&(f=ci.AFTER,r.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(G-N,h,0,a,L);continue}}for(;;Y++){const z=k[Y];if(!(G>z)){if(0==Y)G/=z;else{const K=k[Y-1];G=(G-K)/(z-K)}break}}Y!=f&&(f=Y,d&&Y==u?(r.computeWorldVertices(n,c-4,4,h,0,2),r.computeWorldVertices(n,0,4,h,4,2)):r.computeWorldVertices(n,6*Y+2,8,h,0,2)),this.addCurvePosition(G,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],a,L,e||F>0&&0==H)}return a}d?(c+=2,h=V.setArraySize(this.world,c),r.computeWorldVertices(n,2,c-4,h,0,2),r.computeWorldVertices(n,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=V.setArraySize(this.world,c),r.computeWorldVertices(n,2,c,h,0,2));const p=V.setArraySize(this.curves,u);let m=0,g=h[0],x=h[1],y=0,_=0,b=0,v=0,w=0,E=0,T=0,A=0,D=0,C=0,M=0,I=0,P=0,B=0;for(let k=0,N=2;km){this.addAfterPosition(H-m,h,c-4,a,N);continue}}for(;;F++){const G=p[F];if(!(H>G)){if(0==F)H/=G;else{const z=p[F-1];H=(H-z)/(G-z)}break}}if(F!=f){f=F;let G=6*F;for(g=h[G],x=h[G+1],y=h[G+2],_=h[G+3],b=h[G+4],v=h[G+5],w=h[G+6],E=h[G+7],T=.03*(g-2*y+b),A=.03*(x-2*_+v),D=.006*(3*(y-b)-g+w),C=.006*(3*(_-v)-x+E),M=2*T+D,I=2*A+C,P=.3*(y-g)+T+.16666667*D,B=.3*(_-x)+A+.16666667*C,O=Math.sqrt(P*P+B*B),U[0]=O,G=1;G<8;G++)P+=M,B+=I,M+=D,I+=C,O+=Math.sqrt(P*P+B*B),U[G]=O;P+=M,B+=I,O+=Math.sqrt(P*P+B*B),U[8]=O,P+=M+D,B+=I+C,O+=Math.sqrt(P*P+B*B),U[9]=O,L=0}for(H*=O;;L++){const G=U[L];if(!(H>G)){if(0==L)H/=G;else{const z=U[L-1];H=L+(H-z)/(G-z)}break}}this.addCurvePosition(.1*H,g,x,y,_,b,v,w,E,a,N,e||k>0&&0==Y)}return a}addBeforePosition(r,t,e,s,i){const n=t[e],l=t[e+1],h=Math.atan2(t[e+3]-l,t[e+2]-n);s[i]=n+r*Math.cos(h),s[i+1]=l+r*Math.sin(h),s[i+2]=h}addAfterPosition(r,t,e,s,i){const n=t[e+2],l=t[e+3],h=Math.atan2(l-t[e+1],n-t[e]);s[i]=n+r*Math.cos(h),s[i+1]=l+r*Math.sin(h),s[i+2]=h}addCurvePosition(r,t,e,s,i,n,l,o,a,h,d,c){(0==r||isNaN(r))&&(r=1e-4);const u=r*r,f=u*r,p=1-r,m=p*p,g=m*p,x=p*r,y=3*x,_=p*y,b=y*r,v=t*g+s*_+n*b+o*f,w=e*g+i*_+l*b+a*f;h[d]=v,h[d+1]=w,c&&(h[d+2]=Math.atan2(w-(e*m+i*x*2+l*u),v-(t*m+s*x*2+n*u)))}};let Yi=ci;Yi.NONE=-1,Yi.BEFORE=-2,Yi.AFTER=-3,Yi.epsilon=1e-5;let fm=class{constructor(r,t){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new Mn,this.active=!1,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.rotateMix=r.rotateMix,this.translateMix=r.translateMix,this.scaleMix=r.scaleMix,this.shearMix=r.shearMix,this.bones=new Array;for(let e=0;e0?R.degRad:-R.degRad,c=this.data.offsetRotation*d,u=this.data.offsetShearY*d,f=this.bones;for(let p=0,m=f.length;pR.PI?E-=R.PI2:E<-R.PI&&(E+=R.PI2),E*=r;const T=Math.cos(E),A=Math.sin(E);y.a=T*_-A*v,y.c=T*b-A*w,y.b=A*_+T*v,y.d=A*b+T*w,x=!0}if(0!=t){const _=this.temp;i.localToWorld(_.set(this.data.offsetX,this.data.offsetY)),y.tx+=(_.x-y.tx)*t,y.ty+=(_.y-y.ty)*t,x=!0}if(e>0){let _=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(l*l+a*a);_>1e-5&&(_=(_+(b-_+this.data.offsetScaleX)*e)/_),y.a*=_,y.b*=_,_=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+h*h),_>1e-5&&(_=(_+(b-_+this.data.offsetScaleY)*e)/_),y.c*=_,y.d*=_,x=!0}if(s>0){const _=y.c,b=y.d,v=Math.atan2(b,_);let w=Math.atan2(h,o)-Math.atan2(a,l)-(v-Math.atan2(y.b,y.a));w>R.PI?w-=R.PI2:w<-R.PI&&(w+=R.PI2),w=v+(w+u)*s;const E=Math.sqrt(_*_+b*b);y.c=Math.cos(w)*E,y.d=Math.sin(w)*E,x=!0}x&&(g.appliedValid=!1)}}applyRelativeWorld(){const r=this.rotateMix,t=this.translateMix,e=this.scaleMix,s=this.shearMix,i=this.target,n=i.matrix,l=n.a,o=n.c,a=n.b,h=n.d,d=l*h-o*a>0?R.degRad:-R.degRad,c=this.data.offsetRotation*d,u=this.data.offsetShearY*d,f=this.bones;for(let p=0,m=f.length;pR.PI?E-=R.PI2:E<-R.PI&&(E+=R.PI2),E*=r;const T=Math.cos(E),A=Math.sin(E);y.a=T*_-A*v,y.c=T*b-A*w,y.b=A*_+T*v,y.d=A*b+T*w,x=!0}if(0!=t){const _=this.temp;i.localToWorld(_.set(this.data.offsetX,this.data.offsetY)),y.tx+=_.x*t,y.ty+=_.y*t,x=!0}if(e>0){let _=(Math.sqrt(l*l+a*a)-1+this.data.offsetScaleX)*e+1;y.a*=_,y.b*=_,_=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleY)*e+1,y.c*=_,y.d*=_,x=!0}if(s>0){let _=Math.atan2(h,o)-Math.atan2(a,l);_>R.PI?_-=R.PI2:_<-R.PI&&(_+=R.PI2);const b=y.c,v=y.d;_=Math.atan2(v,b)+(_-R.PI/2+u)*s;const w=Math.sqrt(b*b+v*v);y.c=Math.cos(_)*w,y.d=Math.sin(_)*w,x=!0}x&&(g.appliedValid=!1)}}applyAbsoluteLocal(){const r=this.rotateMix,t=this.translateMix,e=this.scaleMix,s=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();const n=this.bones;for(let l=0,o=n.length;l0&&(u>1e-5&&(u=(u+(i.ascaleX-u+this.data.offsetScaleX)*e)/u),f>1e-5&&(f=(f+(i.ascaleY-f+this.data.offsetScaleY)*e)/f));const p=a.ashearY;if(s>0){let m=i.ashearY-p+this.data.offsetShearY;m-=360*(16384-(16384.499999999996-m/360|0)),a.shearY+=m*s}a.updateWorldTransformWith(d,c,h,u,f,a.ashearX,p)}}applyRelativeLocal(){const r=this.rotateMix,t=this.translateMix,e=this.scaleMix,s=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();const n=this.bones;for(let l=0,o=n.length;l0&&(u>1e-5&&(u*=(i.ascaleX-1+this.data.offsetScaleX)*e+1),f>1e-5&&(f*=(i.ascaleY-1+this.data.offsetScaleY)*e+1));let p=a.ashearY;s>0&&(p+=(i.ashearY+this.data.offsetShearY)*s),a.updateWorldTransformWith(d,c,h,u,f,a.ashearX,p)}}};const Pn=class{constructor(r){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==r)throw new Error("data cannot be null.");this.data=r,this.bones=new Array;for(let t=0;t1){const i=e[e.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(r),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(r){if(r.active=r.target.bone.isActive()&&(!r.data.skinRequired||null!=this.skin&&V.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target,e=t.data.index,s=t.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,e,s),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let o=0,a=this.data.skins.length;o-1||this.updateCacheReset.push(i)}else for(let s=0;s= 0.");if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("boneData cannot be null.");this.index=r,this.name=t,this.boneData=e}},Qh=class extends io{constructor(r){super(r,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Jh=class{constructor(r,t,e){this.slotIndex=r,this.name=t,this.attachment=e}},no=class{constructor(r){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==r)throw new Error("name cannot be null.");this.name=r}setAttachment(r,t,e){if(null==e)throw new Error("attachment cannot be null.");const s=this.attachments;r>=s.length&&(s.length=r+1),s[r]||(s[r]={}),s[r][t]=e}addSkin(r){for(let e=0;e0){const d=new Xi(a),c=e.slots.length;for(let u=0;u=0;_--)m[_]=-1;const g=V.newArray(c-p,0);let x=0,y=0;for(let _=0;_=0;_--)-1==m[_]&&(m[_]=g[--y]);d.setFrame(u,f,m)}s.push(d),n=Math.max(n,d.frames[a-1])}const h=r.readInt(!0);if(h>0){const d=new ro(h);for(let c=0;c=0;y--)-1==f[y]&&(f[y]=m[--x])}a.setFrame(d++,this.getValue(u,"time",0),f)}n.push(a),l=Math.max(l,a.frames[a.getFrameCount()-1])}if(t.events){const a=new ro(t.events.length);let h=0;for(let d=0;d>1)*n;const l=r.bone.skeleton,o=r.attachmentVertices;let a=this.vertices;const h=this.bones;if(null==h){o.length>0&&(a=o);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,x=f.c,y=f.b,_=f.d;for(let b=t,v=i;v0&&(t%=this.duration));const a=this.timelines;for(let h=0,d=a.length;h>>1;for(;;){if(r[(n+1)*e]<=t?s=n+1:i=n,s==i)return(s+1)*e;n=s+i>>>1}}static linearSearch(r,t,e){for(let s=0,i=r.length-e;s<=i;s+=e)if(r[s]>t)return s;return-1}};var vm=(r=>(r[r.rotate=0]="rotate",r[r.translate=1]="translate",r[r.scale=2]="scale",r[r.shear=3]="shear",r[r.attachment=4]="attachment",r[r.color=5]="color",r[r.deform=6]="deform",r[r.event=7]="event",r[r.drawOrder=8]="drawOrder",r[r.ikConstraint=9]="ikConstraint",r[r.transformConstraint=10]="transformConstraint",r[r.pathConstraintPosition=11]="pathConstraintPosition",r[r.pathConstraintSpacing=12]="pathConstraintSpacing",r[r.pathConstraintMix=13]="pathConstraintMix",r[r.twoColor=14]="twoColor",r))(vm||{});const se=class{constructor(r){if(r<=0)throw new Error(`frameCount must be > 0: ${r}`);this.curves=V.newFloatArray((r-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(r){this.curves[r*se.BEZIER_SIZE]=se.LINEAR}setStepped(r){this.curves[r*se.BEZIER_SIZE]=se.STEPPED}getCurveType(r){const t=r*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(r,t,e,s,i){const n=.03*(2*-t+s),l=.03*(2*-e+i),o=.006*(3*(t-s)+1),a=.006*(3*(e-i)+1);let h=2*n+o,d=2*l+a,c=.3*t+n+.16666667*o,u=.3*e+l+.16666667*a,f=r*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=u;for(let x=f+se.BEZIER_SIZE-1;f=t){let h,d;return s==o?(h=0,d=0):(h=e[s-2],d=e[s-1]),d+(e[s+1]-d)*(t-h)/(n-h)}const l=e[s-1];return l+(1-l)*(t-n)/(1-n)}};let Le=se;Le.LINEAR=0,Le.STEPPED=1,Le.BEZIER=2,Le.BEZIER_SIZE=19;const Os=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(r,t,e){this.frames[r<<=1]=t,this.frames[r+Os.ROTATION]=e}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.bones[this.boneIndex];if(e=o[o.length-Os.ENTRIES]){let p=o[o.length+Os.PREV_ROTATION];switch(n){case S.setup:a.rotation=a.data.rotation+p*i;break;case S.first:case S.replace:p+=a.data.rotation-a.rotation,p-=360*(16384-(16384.499999999996-p/360|0));case S.add:a.rotation+=p*i}return}const h=oe.binarySearch(o,e,Os.ENTRIES),d=o[h+Os.PREV_ROTATION],c=o[h],u=this.getCurvePercent((h>>1)-1,1-(e-c)/(o[h+Os.PREV_TIME]-c));let f=o[h+Os.ROTATION]-d;switch(f=d+(f-360*(16384-(16384.499999999996-f/360|0)))*u,n){case S.setup:a.rotation=a.data.rotation+(f-360*(16384-(16384.499999999996-f/360|0)))*i;break;case S.first:case S.replace:f+=a.data.rotation-a.rotation;case S.add:a.rotation+=(f-360*(16384-(16384.499999999996-f/360|0)))*i}}};let Pe=Os;Pe.ENTRIES=2,Pe.PREV_TIME=-2,Pe.PREV_ROTATION=-1,Pe.ROTATION=1;const ke=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(r,t,e,s){this.frames[r*=ke.ENTRIES]=t,this.frames[r+ke.X]=e,this.frames[r+ke.Y]=s}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.bones[this.boneIndex];if(e=o[o.length-ke.ENTRIES])h=o[o.length+ke.PREV_X],d=o[o.length+ke.PREV_Y];else{const c=oe.binarySearch(o,e,ke.ENTRIES);h=o[c+ke.PREV_X],d=o[c+ke.PREV_Y];const u=o[c],f=this.getCurvePercent(c/ke.ENTRIES-1,1-(e-u)/(o[c+ke.PREV_TIME]-u));h+=(o[c+ke.X]-h)*f,d+=(o[c+ke.Y]-d)*f}switch(n){case S.setup:a.x=a.data.x+h*i,a.y=a.data.y+d*i;break;case S.first:case S.replace:a.x+=(a.data.x+h-a.x)*i,a.y+=(a.data.y+d-a.y)*i;break;case S.add:a.x+=h*i,a.y+=d*i}}};let xr=ke;xr.ENTRIES=3,xr.PREV_TIME=-3,xr.PREV_X=-2,xr.PREV_Y=-1,xr.X=1,xr.Y=2;let wm=class Cr extends xr{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,l,o){const a=this.frames,h=t.bones[this.boneIndex];if(s=a[a.length-Cr.ENTRIES])d=a[a.length+Cr.PREV_X]*h.data.scaleX,c=a[a.length+Cr.PREV_Y]*h.data.scaleY;else{const u=oe.binarySearch(a,s,Cr.ENTRIES);d=a[u+Cr.PREV_X],c=a[u+Cr.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Cr.ENTRIES-1,1-(s-f)/(a[u+Cr.PREV_TIME]-f));d=(d+(a[u+Cr.X]-d)*p)*h.data.scaleX,c=(c+(a[u+Cr.Y]-c)*p)*h.data.scaleY}if(1==n)l==S.add?(h.scaleX+=d-h.data.scaleX,h.scaleY+=c-h.data.scaleY):(h.scaleX=d,h.scaleY=c);else{let u=0,f=0;if(o==mt.mixOut)switch(l){case S.setup:u=h.data.scaleX,f=h.data.scaleY,h.scaleX=u+(Math.abs(d)*R.signum(u)-u)*n,h.scaleY=f+(Math.abs(c)*R.signum(f)-f)*n;break;case S.first:case S.replace:u=h.scaleX,f=h.scaleY,h.scaleX=u+(Math.abs(d)*R.signum(u)-u)*n,h.scaleY=f+(Math.abs(c)*R.signum(f)-f)*n;break;case S.add:u=h.scaleX,f=h.scaleY,h.scaleX=u+(Math.abs(d)*R.signum(u)-h.data.scaleX)*n,h.scaleY=f+(Math.abs(c)*R.signum(f)-h.data.scaleY)*n}else switch(l){case S.setup:u=Math.abs(h.data.scaleX)*R.signum(d),f=Math.abs(h.data.scaleY)*R.signum(c),h.scaleX=u+(d-u)*n,h.scaleY=f+(c-f)*n;break;case S.first:case S.replace:u=Math.abs(h.scaleX)*R.signum(d),f=Math.abs(h.scaleY)*R.signum(c),h.scaleX=u+(d-u)*n,h.scaleY=f+(c-f)*n;break;case S.add:u=R.signum(d),f=R.signum(c),h.scaleX=Math.abs(h.scaleX)*u+(d-Math.abs(h.data.scaleX)*u)*n,h.scaleY=Math.abs(h.scaleY)*f+(c-Math.abs(h.data.scaleY)*f)*n}}}},Em=class Pr extends xr{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,l,o){const a=this.frames,h=t.bones[this.boneIndex];if(s=a[a.length-Pr.ENTRIES])d=a[a.length+Pr.PREV_X],c=a[a.length+Pr.PREV_Y];else{const u=oe.binarySearch(a,s,Pr.ENTRIES);d=a[u+Pr.PREV_X],c=a[u+Pr.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Pr.ENTRIES-1,1-(s-f)/(a[u+Pr.PREV_TIME]-f));d+=(a[u+Pr.X]-d)*p,c+=(a[u+Pr.Y]-c)*p}switch(l){case S.setup:h.shearX=h.data.shearX+d*n,h.shearY=h.data.shearY+c*n;break;case S.first:case S.replace:h.shearX+=(h.data.shearX+d-h.shearX)*n,h.shearY+=(h.data.shearY+c-h.shearY)*n;break;case S.add:h.shearX+=d*n,h.shearY+=c*n}}};const Ht=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(r,t,e,s,i,n){this.frames[r*=Ht.ENTRIES]=t,this.frames[r+Ht.R]=e,this.frames[r+Ht.G]=s,this.frames[r+Ht.B]=i,this.frames[r+Ht.A]=n}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex],a=this.frames;if(e=a[a.length-Ht.ENTRIES]){const f=a.length;h=a[f+Ht.PREV_R],d=a[f+Ht.PREV_G],c=a[f+Ht.PREV_B],u=a[f+Ht.PREV_A]}else{const f=oe.binarySearch(a,e,Ht.ENTRIES);h=a[f+Ht.PREV_R],d=a[f+Ht.PREV_G],c=a[f+Ht.PREV_B],u=a[f+Ht.PREV_A];const p=a[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(a[f+Ht.PREV_TIME]-p));h+=(a[f+Ht.R]-h)*m,d+=(a[f+Ht.G]-d)*m,c+=(a[f+Ht.B]-c)*m,u+=(a[f+Ht.A]-u)*m}if(1==i)o.color.set(h,d,c,u);else{const f=o.color;n==S.setup&&f.setFromColor(o.data.color),f.add((h-f.r)*i,(d-f.g)*i,(c-f.b)*i,(u-f.a)*i)}}};let ze=Ht;ze.ENTRIES=5,ze.PREV_TIME=-5,ze.PREV_R=-4,ze.PREV_G=-3,ze.PREV_B=-2,ze.PREV_A=-1,ze.R=1,ze.G=2,ze.B=3,ze.A=4;const Et=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r*Et.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(r,t,e,s,i,n,l,o,a){this.frames[r*=Et.ENTRIES]=t,this.frames[r+Et.R]=e,this.frames[r+Et.G]=s,this.frames[r+Et.B]=i,this.frames[r+Et.A]=n,this.frames[r+Et.R2]=l,this.frames[r+Et.G2]=o,this.frames[r+Et.B2]=a}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex],a=this.frames;if(e=a[a.length-Et.ENTRIES]){const g=a.length;h=a[g+Et.PREV_R],d=a[g+Et.PREV_G],c=a[g+Et.PREV_B],u=a[g+Et.PREV_A],f=a[g+Et.PREV_R2],p=a[g+Et.PREV_G2],m=a[g+Et.PREV_B2]}else{const g=oe.binarySearch(a,e,Et.ENTRIES);h=a[g+Et.PREV_R],d=a[g+Et.PREV_G],c=a[g+Et.PREV_B],u=a[g+Et.PREV_A],f=a[g+Et.PREV_R2],p=a[g+Et.PREV_G2],m=a[g+Et.PREV_B2];const x=a[g],y=this.getCurvePercent(g/Et.ENTRIES-1,1-(e-x)/(a[g+Et.PREV_TIME]-x));h+=(a[g+Et.R]-h)*y,d+=(a[g+Et.G]-d)*y,c+=(a[g+Et.B]-c)*y,u+=(a[g+Et.A]-u)*y,f+=(a[g+Et.R2]-f)*y,p+=(a[g+Et.G2]-p)*y,m+=(a[g+Et.B2]-m)*y}if(1==i)o.color.set(h,d,c,u),o.darkColor.set(f,p,m,1);else{const g=o.color,x=o.darkColor;n==S.setup&&(g.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),g.add((h-g.r)*i,(d-g.g)*i,(c-g.b)*i,(u-g.a)*i),x.add((f-x.r)*i,(p-x.g)*i,(m-x.b)*i,0)}}};let le=Et;le.ENTRIES=8,le.PREV_TIME=-8,le.PREV_R=-7,le.PREV_G=-6,le.PREV_B=-5,le.PREV_A=-4,le.PREV_R2=-3,le.PREV_G2=-2,le.PREV_B2=-1,le.R=1,le.G=2,le.B=3,le.A=4,le.R2=5,le.G2=6,le.B2=7;let ao=class{constructor(r){this.frames=V.newFloatArray(r),this.attachmentNames=new Array(r)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.attachmentNames[r]=e}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex];if(l==mt.mixOut&&n==S.setup){const c=o.data.attachmentName;return void o.setAttachment(null==c?null:r.getAttachment(this.slotIndex,c))}const a=this.frames;if(e=a[a.length-1]?a.length-1:oe.binarySearch(a,e,1)-1;const d=this.attachmentNames[h];r.slots[this.slotIndex].setAttachment(null==d?null:r.getAttachment(this.slotIndex,d))}},Am=null,Tm=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r),this.frameVertices=new Array(r),null==Am&&(Am=V.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(r,t,e){this.frames[r]=t,this.frameVertices[r]=e}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex],a=o.getAttachment();if(!(a instanceof Ns&&a.applyDeform(this.attachment)))return;const h=o.attachmentVertices;0==h.length&&(n=S.setup);const d=this.frameVertices,c=d[0].length,u=this.frames;if(e=u[u.length-1]){const _=d[u.length-1];if(1==i)if(n==S.add)if(null==a.bones){const v=a.vertices;for(let w=0;we)this.apply(r,t,Number.MAX_VALUE,s,i,n,l),t=-1;else if(t>=o[a-1])return;if(e0&&o[h-1]==d;)h--}for(;h=o[h];h++)s.push(this.events[h])}},oo=class{constructor(r){this.frames=V.newFloatArray(r),this.drawOrders=new Array(r)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.drawOrders[r]=e}apply(r,t,e,s,i,n,l){const o=r.drawOrder,a=r.slots;if(l==mt.mixOut&&n==S.setup)return void V.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);const h=this.frames;if(e=h[h.length-1]?h.length-1:oe.binarySearch(h,e)-1;const c=this.drawOrders[d];if(null==c)V.arrayCopy(a,0,o,0,a.length);else for(let u=0,f=c.length;u=o[o.length-Ft.ENTRIES])return void(n==S.setup?(a.mix=a.data.mix+(o[o.length+Ft.PREV_MIX]-a.data.mix)*i,l==mt.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=o[o.length+Ft.PREV_BEND_DIRECTION],a.compress=0!=o[o.length+Ft.PREV_COMPRESS],a.stretch=0!=o[o.length+Ft.PREV_STRETCH])):(a.mix+=(o[o.length+Ft.PREV_MIX]-a.mix)*i,l==mt.mixIn&&(a.bendDirection=o[o.length+Ft.PREV_BEND_DIRECTION],a.compress=0!=o[o.length+Ft.PREV_COMPRESS],a.stretch=0!=o[o.length+Ft.PREV_STRETCH])));const h=oe.binarySearch(o,e,Ft.ENTRIES),d=o[h+Ft.PREV_MIX],c=o[h],u=this.getCurvePercent(h/Ft.ENTRIES-1,1-(e-c)/(o[h+Ft.PREV_TIME]-c));n==S.setup?(a.mix=a.data.mix+(d+(o[h+Ft.MIX]-d)*u-a.data.mix)*i,l==mt.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=o[h+Ft.PREV_BEND_DIRECTION],a.compress=0!=o[h+Ft.PREV_COMPRESS],a.stretch=0!=o[h+Ft.PREV_STRETCH])):(a.mix+=(d+(o[h+Ft.MIX]-d)*u-a.mix)*i,l==mt.mixIn&&(a.bendDirection=o[h+Ft.PREV_BEND_DIRECTION],a.compress=0!=o[h+Ft.PREV_COMPRESS],a.stretch=0!=o[h+Ft.PREV_STRETCH]))}};let qe=Ft;qe.ENTRIES=5,qe.PREV_TIME=-5,qe.PREV_MIX=-4,qe.PREV_BEND_DIRECTION=-3,qe.PREV_COMPRESS=-2,qe.PREV_STRETCH=-1,qe.MIX=1,qe.BEND_DIRECTION=2,qe.COMPRESS=3,qe.STRETCH=4;const Wt=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(r,t,e,s,i,n){this.frames[r*=Wt.ENTRIES]=t,this.frames[r+Wt.ROTATE]=e,this.frames[r+Wt.TRANSLATE]=s,this.frames[r+Wt.SCALE]=i,this.frames[r+Wt.SHEAR]=n}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.transformConstraints[this.transformConstraintIndex];if(e=o[o.length-Wt.ENTRIES]){const f=o.length;h=o[f+Wt.PREV_ROTATE],d=o[f+Wt.PREV_TRANSLATE],c=o[f+Wt.PREV_SCALE],u=o[f+Wt.PREV_SHEAR]}else{const f=oe.binarySearch(o,e,Wt.ENTRIES);h=o[f+Wt.PREV_ROTATE],d=o[f+Wt.PREV_TRANSLATE],c=o[f+Wt.PREV_SCALE],u=o[f+Wt.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(o[f+Wt.PREV_TIME]-p));h+=(o[f+Wt.ROTATE]-h)*m,d+=(o[f+Wt.TRANSLATE]-d)*m,c+=(o[f+Wt.SCALE]-c)*m,u+=(o[f+Wt.SHEAR]-u)*m}if(n==S.setup){const f=a.data;a.rotateMix=f.rotateMix+(h-f.rotateMix)*i,a.translateMix=f.translateMix+(d-f.translateMix)*i,a.scaleMix=f.scaleMix+(c-f.scaleMix)*i,a.shearMix=f.shearMix+(u-f.shearMix)*i}else a.rotateMix+=(h-a.rotateMix)*i,a.translateMix+=(d-a.translateMix)*i,a.scaleMix+=(c-a.scaleMix)*i,a.shearMix+=(u-a.shearMix)*i}};let Ze=Wt;Ze.ENTRIES=5,Ze.PREV_TIME=-5,Ze.PREV_ROTATE=-4,Ze.PREV_TRANSLATE=-3,Ze.PREV_SCALE=-2,Ze.PREV_SHEAR=-1,Ze.ROTATE=1,Ze.TRANSLATE=2,Ze.SCALE=3,Ze.SHEAR=4;const _r=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r*_r.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(r,t,e){this.frames[r*=_r.ENTRIES]=t,this.frames[r+_r.VALUE]=e}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.pathConstraints[this.pathConstraintIndex];if(e=o[o.length-_r.ENTRIES])h=o[o.length+_r.PREV_VALUE];else{const d=oe.binarySearch(o,e,_r.ENTRIES);h=o[d+_r.PREV_VALUE];const c=o[d],u=this.getCurvePercent(d/_r.ENTRIES-1,1-(e-c)/(o[d+_r.PREV_TIME]-c));h+=(o[d+_r.VALUE]-h)*u}n==S.setup?a.position=a.data.position+(h-a.data.position)*i:a.position+=(h-a.position)*i}};let Bs=_r;Bs.ENTRIES=2,Bs.PREV_TIME=-2,Bs.PREV_VALUE=-1,Bs.VALUE=1;let Im=class Us extends Bs{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,l,o){const a=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(s=a[a.length-Us.ENTRIES])d=a[a.length+Us.PREV_VALUE];else{const c=oe.binarySearch(a,s,Us.ENTRIES);d=a[c+Us.PREV_VALUE];const u=a[c],f=this.getCurvePercent(c/Us.ENTRIES-1,1-(s-u)/(a[c+Us.PREV_TIME]-u));d+=(a[c+Us.VALUE]-d)*f}l==S.setup?h.spacing=h.data.spacing+(d-h.data.spacing)*n:h.spacing+=(d-h.spacing)*n}};const Fe=class extends Le{constructor(r){super(r),this.frames=V.newFloatArray(r*Fe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(r,t,e,s){this.frames[r*=Fe.ENTRIES]=t,this.frames[r+Fe.ROTATE]=e,this.frames[r+Fe.TRANSLATE]=s}apply(r,t,e,s,i,n,l){const o=this.frames,a=r.pathConstraints[this.pathConstraintIndex];if(e=o[o.length-Fe.ENTRIES])h=o[o.length+Fe.PREV_ROTATE],d=o[o.length+Fe.PREV_TRANSLATE];else{const c=oe.binarySearch(o,e,Fe.ENTRIES);h=o[c+Fe.PREV_ROTATE],d=o[c+Fe.PREV_TRANSLATE];const u=o[c],f=this.getCurvePercent(c/Fe.ENTRIES-1,1-(e-u)/(o[c+Fe.PREV_TIME]-u));h+=(o[c+Fe.ROTATE]-h)*f,d+=(o[c+Fe.TRANSLATE]-d)*f}n==S.setup?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*i,a.translateMix=a.data.translateMix+(d-a.data.translateMix)*i):(a.rotateMix+=(h-a.rotateMix)*i,a.translateMix+=(d-a.translateMix)*i)}};let cs=Fe;cs.ENTRIES=3,cs.PREV_TIME=-3,cs.PREV_ROTATE=-2,cs.PREV_TRANSLATE=-1,cs.ROTATE=1,cs.TRANSLATE=2;const me=class{constructor(r){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new ic(this),this.propertyIDs=new Qp,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new to(()=>new lo),this.data=r}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let l=i.next;if(null!=l){const o=i.trackLast-l.delay;if(o>=0){for(l.delay=0,l.trackTime=0==i.timeScale?0:(o/i.timeScale+r)*l.timeScale,i.trackTime+=n,this.setCurrent(e,l,!0);null!=l.mixingFrom;)l.mixTime+=r,l=l.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&null==i.mixingFrom){t[e]=null,this.queue.end(i),this.disposeNext(i);continue}if(null!=i.mixingFrom&&this.updateMixingFrom(i,r)){let o=i.mixingFrom;for(i.mixingFrom=null,null!=o&&(o.mixingTo=null);null!=o;)this.queue.end(o),o=o.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(null==e)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,r.mixTime>0&&r.mixTime>=r.mixDuration?((0==e.totalAlpha||0==r.mixDuration)&&(r.mixingFrom=e.mixingFrom,null!=e.mixingFrom&&(e.mixingFrom.mixingTo=r),r.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,r.mixTime+=t,!1)}apply(r){if(null==r)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let i=0,n=e.length;i0)continue;s=!0;const o=0==i?S.first:l.mixBlend;let a=l.alpha;null!=l.mixingFrom?a*=this.applyMixingFrom(l,r,o):l.trackTime>=l.trackEnd&&null==l.next&&(a=0);const h=l.animationLast,d=l.getAnimationTime(),c=l.animation.timelines.length,u=l.animation.timelines;if(0==i&&1==a||o==S.add)for(let f=0;f1&&(i=1),e!=S.first&&(e=s.mixBlend));const n=i0&&this.queueEvents(s,h),this.events.length=0,s.nextAnimationLast=h,s.nextTrackLast=s.trackTime,i}applyRotateTimeline(r,t,e,s,i,n,l,o){if(o&&(n[l]=0),1==s)return void r.apply(t,0,e,null,1,i,mt.mixIn);const a=r,h=a.frames,d=t.bones[a.boneIndex];let c=0,u=0;if(e=h[h.length-Pe.ENTRIES])u=d.data.rotation+h[h.length+Pe.PREV_ROTATION];else{const m=oe.binarySearch(h,e,Pe.ENTRIES),g=h[m+Pe.PREV_ROTATION],x=h[m],y=a.getCurvePercent((m>>1)-1,1-(e-x)/(h[m+Pe.PREV_TIME]-x));u=h[m+Pe.ROTATION]-g,u-=360*(16384-(16384.499999999996-u/360|0)),u=g+u*y+d.data.rotation,u-=360*(16384-(16384.499999999996-u/360|0))}let f=0,p=u-c;if(p-=360*(16384-(16384.499999999996-p/360|0)),0==p)f=n[l];else{let m=0,g=0;o?(m=0,g=p):(m=n[l],g=n[l+1]);const x=p>0;let y=m>=0;R.signum(g)!=R.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*R.signum(m)),y=x),f=p+m-m%360,y!=x&&(f+=360*R.signum(m)),n[l]=f}n[l+1]=p,c+=f*s,d.rotation=c-360*(16384-(16384.499999999996-c/360|0))}queueEvents(r,t){const e=r.animationStart,s=r.animationEnd,i=s-e,n=r.trackLast%i,l=this.events;let o=0;const a=l.length;for(;os||this.queue.event(r,d)}let h=!1;for(h=r.loop?0==i||n>r.trackTime%i:t>=s&&r.animationLast=this.tracks.length)return;const t=this.tracks[r];if(null==t)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(null==s)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(r,t,e){const s=this.expandToIndex(r);this.tracks[r]=t,null!=s&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,null!=s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(r,t,e){const s=this.data.skeletonData.findAnimation(t);if(null==s)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,s,e)}setAnimationWith(r,t,e){if(null==t)throw new Error("animation cannot be null.");let s=!0,i=this.expandToIndex(r);null!=i&&(-1==i.nextTrackLast?(this.tracks[r]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,s=!1):this.disposeNext(i));const n=this.trackEntry(r,t,e,i);return this.setCurrent(r,n,s),this.queue.drain(),n}addAnimation(r,t,e,s){const i=this.data.skeletonData.findAnimation(t);if(null==i)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,i,e,s)}addAnimationWith(r,t,e,s){if(null==t)throw new Error("animation cannot be null.");let i=this.expandToIndex(r);if(null!=i)for(;null!=i.next;)i=i.next;const n=this.trackEntry(r,t,e,i);if(null==i)this.setCurrent(r,n,!0),this.queue.drain();else if(i.next=n,s<=0){const l=i.animationEnd-i.animationStart;0!=l?(s+=i.loop?l*(1+(i.trackTime/l|0)):Math.max(l,i.trackTime),s-=this.data.getMix(i.animation,t)):s=i.trackTime}return n.delay=s,n}setEmptyAnimation(r,t){const e=this.setAnimationWith(r,me.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(r,me.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(r){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){i[o]=me.HOLD_MIX,n[o]=h;continue t}break}i[o]=me.HOLD}else i[o]=me.FIRST;else i[o]=me.SUBSEQUENT}}hasTimeline(r,t){const e=r.animation.timelines;for(let s=0,i=e.length;s=this.tracks.length?null:this.tracks[r]}addListener(r){if(null==r)throw new Error("listener cannot be null.");this.listeners.push(r)}removeListener(r){const t=this.listeners.indexOf(r);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(r,t,e){me.deprecatedWarning1||(me.deprecatedWarning1=!0),this.setAnimation(r,t,e)}addAnimationByName(r,t,e,s){me.deprecatedWarning2||(me.deprecatedWarning2=!0),this.addAnimation(r,t,e,s)}hasAnimation(r){return null!==this.data.skeletonData.findAnimation(r)}hasAnimationByName(r){return me.deprecatedWarning3||(me.deprecatedWarning3=!0),this.hasAnimation(r)}};let jr=me;jr.emptyAnimation=new oe("",[],0),jr.SUBSEQUENT=0,jr.FIRST=1,jr.HOLD=2,jr.HOLD_MIX=3,jr.deprecatedWarning1=!1,jr.deprecatedWarning2=!1,jr.deprecatedWarning3=!1;const us=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const r=this.animationEnd-this.animationStart;return 0==r?this.animationStart:this.trackTime%r+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(r){this.animationLast=r,this.nextAnimationLast=r}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return us.deprecatedWarning1||(us.deprecatedWarning1=!0),this.trackTime}set time(r){us.deprecatedWarning1||(us.deprecatedWarning1=!0),this.trackTime=r}get endTime(){return us.deprecatedWarning2||(us.deprecatedWarning2=!0),this.trackTime}set endTime(r){us.deprecatedWarning2||(us.deprecatedWarning2=!0),this.trackTime=r}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let lo=us;lo.deprecatedWarning1=!1,lo.deprecatedWarning2=!1;const sc=class{constructor(r){this.objects=[],this.drainDisabled=!1,this.animState=r}start(r){this.objects.push(Ve.start),this.objects.push(r),this.animState.animationsChanged=!0}interrupt(r){this.objects.push(Ve.interrupt),this.objects.push(r)}end(r){this.objects.push(Ve.end),this.objects.push(r),this.animState.animationsChanged=!0}dispose(r){this.objects.push(Ve.dispose),this.objects.push(r)}complete(r){this.objects.push(Ve.complete),this.objects.push(r)}event(r,t){this.objects.push(Ve.event),this.objects.push(r),this.objects.push(t)}deprecateStuff(){return sc.deprecatedWarning1||(sc.deprecatedWarning1=!0),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const r=this.objects,t=this.animState.listeners;for(let e=0;e(r[r.start=0]="start",r[r.interrupt=1]="interrupt",r[r.end=2]="end",r[r.dispose=3]="dispose",r[r.complete=4]="complete",r[r.event=5]="event",r))(Ve||{});const nc=class{constructor(r){if(this.animationToMixTime={},this.defaultMix=0,null==r)throw new Error("skeletonData cannot be null.");this.skeletonData=r}setMix(r,t,e){const s=this.skeletonData.findAnimation(r);if(null==s)throw new Error(`Animation not found: ${r}`);const i=this.skeletonData.findAnimation(t);if(null==i)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,i,e)}setMixByName(r,t,e){nc.deprecatedWarning1||(nc.deprecatedWarning1=!0),this.setMix(r,t,e)}setMixWith(r,t,e){if(null==r)throw new Error("from cannot be null.");if(null==t)throw new Error("to cannot be null.");this.animationToMixTime[`${r.name}.${t.name}`]=e}getMix(r,t){const s=this.animationToMixTime[`${r.name}.${t.name}`];return void 0===s?this.defaultMix:s}};let ac=nc;ac.deprecatedWarning1=!1;let Rm=class{constructor(r){this.atlas=r}newRegionAttachment(r,t,e){const s=this.atlas.findRegion(e);if(null==s)throw new Error(`Region not found in atlas: ${e} (region attachment: ${t})`);const i=new dt(t);return i.region=s,i}newMeshAttachment(r,t,e){const s=this.atlas.findRegion(e);if(null==s)throw new Error(`Region not found in atlas: ${e} (mesh attachment: ${t})`);const i=new ec(t);return i.region=s,i}newBoundingBoxAttachment(r,t){return new gm(t)}newPathAttachment(r,t){return new kn(t)}newPointAttachment(r,t){return new xm(t)}newClippingAttachment(r,t){return new ym(t)}},oc=class{constructor(r,t,e){if(this.matrix=new kt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!0,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.skeleton=t,this.parent=e,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(r,t,e,s,i,n,l){this.ax=r,this.ay=t,this.arotation=e,this.ascaleX=s,this.ascaleY=i,this.ashearX=n,this.ashearY=l,this.appliedValid=!0;const o=this.parent,a=this.matrix,h=this.skeleton.scaleX,d=-this.skeleton.scaleY;if(null==o){const m=this.skeleton,g=e+90+l;return a.a=R.cosDeg(e+n)*s*h,a.c=R.cosDeg(g)*i*h,a.b=R.sinDeg(e+n)*s*d,a.d=R.sinDeg(g)*i*d,a.tx=r*h+m.x,void(a.ty=t*d+m.y)}let c=o.matrix.a,u=o.matrix.c,f=o.matrix.b,p=o.matrix.d;switch(a.tx=c*r+u*t+o.matrix.tx,a.ty=f*r+p*t+o.matrix.ty,this.data.transformMode){case nt.Normal:{const m=e+90+l,g=R.cosDeg(e+n)*s,x=R.cosDeg(m)*i,y=R.sinDeg(e+n)*s,_=R.sinDeg(m)*i;return a.a=c*g+u*y,a.c=c*x+u*_,a.b=f*g+p*y,void(a.d=f*x+p*_)}case nt.OnlyTranslation:{const m=e+90+l;a.a=R.cosDeg(e+n)*s,a.c=R.cosDeg(m)*i,a.b=R.sinDeg(e+n)*s,a.d=R.sinDeg(m)*i;break}case nt.NoRotationOrReflection:{let m=c*c+f*f,g=0;m>1e-4?(m=Math.abs(c*p-u*f)/m,u=f*m,p=c*m,g=Math.atan2(f,c)*R.radDeg):(c=0,f=0,g=90-Math.atan2(p,u)*R.radDeg);const x=e+n-g,y=e+l-g+90,_=R.cosDeg(x)*s,b=R.cosDeg(y)*i,v=R.sinDeg(x)*s,w=R.sinDeg(y)*i;a.a=c*_-u*v,a.c=c*b-u*w,a.b=f*_+p*v,a.d=f*b+p*w;break}case nt.NoScale:case nt.NoScaleOrReflection:{const m=R.cosDeg(e),g=R.sinDeg(e);let x=(c*m+u*g)/h,y=(f*m+p*g)/d,_=Math.sqrt(x*x+y*y);_>1e-5&&(_=1/_),x*=_,y*=_,_=Math.sqrt(x*x+y*y),this.data.transformMode==nt.NoScale&&c*p-u*f<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(_=-_);const b=Math.PI/2+Math.atan2(y,x),v=Math.cos(b)*_,w=Math.sin(b)*_,E=R.cosDeg(n)*s,T=R.cosDeg(90+l)*i,A=R.sinDeg(n)*s,D=R.sinDeg(90+l)*i;a.a=x*E+v*A,a.c=x*T+v*D,a.b=y*E+w*A,a.d=y*T+w*D;break}}a.a*=h,a.c*=h,a.b*=d,a.d*=d}setToSetupPose(){const r=this.data;this.x=r.x,this.y=r.y,this.rotation=r.rotation,this.scaleX=r.scaleX,this.scaleY=r.scaleY,this.shearX=r.shearX,this.shearY=r.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*R.radDeg}getWorldScaleX(){const r=this.matrix;return Math.sqrt(r.a*r.a+r.c*r.c)}getWorldScaleY(){const r=this.matrix;return Math.sqrt(r.b*r.b+r.d*r.d)}updateAppliedTransform(){this.appliedValid=!0;const r=this.parent,t=this.matrix;if(null==r)return this.ax=t.tx,this.ay=t.ty,this.arotation=Math.atan2(t.b,t.a)*R.radDeg,this.ascaleX=Math.sqrt(t.a*t.a+t.b*t.b),this.ascaleY=Math.sqrt(t.c*t.c+t.d*t.d),this.ashearX=0,void(this.ashearY=Math.atan2(t.a*t.c+t.b*t.d,t.a*t.d-t.b*t.c)*R.radDeg);const e=r.matrix,s=1/(e.a*e.d-e.b*e.c),i=t.tx-e.tx,n=t.ty-e.ty;this.ax=i*e.d*s-n*e.c*s,this.ay=n*e.a*s-i*e.b*s;const l=s*e.d,o=s*e.a,a=s*e.c,h=s*e.b,d=l*t.a-a*t.b,c=l*t.c-a*t.d,u=o*t.b-h*t.a,f=o*t.d-h*t.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){const p=d*f-c*u;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(d*c+u*f,p)*R.radDeg,this.arotation=Math.atan2(u,d)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(c*c+f*f),this.ashearY=0,this.arotation=90-Math.atan2(f,c)*R.radDeg}worldToLocal(r){const t=this.matrix,e=t.a,s=t.c,i=t.b,n=t.d,l=1/(e*n-s*i),o=r.x-t.tx,a=r.y-t.ty;return r.x=o*n*l-a*s*l,r.y=a*e*l-o*i*l,r}localToWorld(r){const t=this.matrix,e=r.x,s=r.y;return r.x=e*t.a+s*t.c+t.tx,r.y=e*t.b+s*t.d+t.ty,r}worldToLocalRotation(r){const t=R.sinDeg(r),e=R.cosDeg(r),s=this.matrix;return Math.atan2(s.a*t-s.b*e,s.d*e-s.c*t)*R.radDeg}localToWorldRotation(r){const t=R.sinDeg(r),e=R.cosDeg(r),s=this.matrix;return Math.atan2(e*s.b+t*s.d,e*s.a+t*s.c)*R.radDeg}rotateWorld(r){const t=this.matrix,e=t.a,s=t.c,i=t.b,n=t.d,l=R.cosDeg(r),o=R.sinDeg(r);t.a=l*e-o*i,t.c=l*s-o*n,t.b=o*e+l*i,t.d=o*s+l*n,this.appliedValid=!1}},Mm=class{constructor(r,t,e){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=nt.Normal,r<0)throw new Error("index must be >= 0.");if(null==t)throw new Error("name cannot be null.");this.index=r,this.name=t,this.parent=e}},Cm=class{constructor(r,t){if(null==t)throw new Error("data cannot be null.");this.time=r,this.data=t}},Pm=class{constructor(r){this.name=r}},km=class{constructor(r,t){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.mix=r.mix,this.bendDirection=r.bendDirection,this.compress=r.compress,this.stretch=r.stretch,this.bones=new Array;for(let e=0;e180?f-=360:f<-180&&(f+=360);let p=r.ascaleX,m=r.ascaleY;if(s||i){const g=r.data.length*p,x=Math.sqrt(c*c+u*u);if(s&&xg&&g>1e-4){const y=(x/g-1)*l+1;p*=y,n&&(m*=y)}}r.updateWorldTransformWith(r.ax,r.ay,r.arotation+f*l,p,m,r.ashearX,r.ashearY)}apply2(r,t,e,s,i,n,l){if(0==l)return void t.updateWorldTransform();r.appliedValid||r.updateAppliedTransform(),t.appliedValid||t.updateAppliedTransform();const o=r.ax,a=r.ay;let h=r.ascaleX,d=h,c=r.ascaleY,u=t.ascaleX;const f=r.matrix;let p=0,m=0,g=0;h<0?(h=-h,p=180,g=-1):(p=0,g=1),c<0&&(c=-c,g=-g),u<0?(u=-u,m=180):m=0;const x=t.ax;let y=0,_=0,b=0,v=f.a,w=f.c,E=f.b,T=f.d;const A=Math.abs(h-c)<=1e-4;A?(y=t.ay,_=v*x+w*y+f.tx,b=E*x+T*y+f.ty):(y=0,_=v*x+f.tx,b=E*x+f.ty);const D=r.parent.matrix;v=D.a,w=D.c,E=D.b,T=D.d;const C=1/(v*T-w*E);let M=e-D.tx,I=s-D.ty;const P=(M*T-I*w)*C-o,B=(I*v-M*E)*C-a,U=P*P+B*B;M=_-D.tx,I=b-D.ty;const O=(M*T-I*w)*C-o,k=(I*v-M*E)*C-a,N=Math.sqrt(O*O+k*k);let F=t.data.length*u,L=0,Y=0;t:if(A){F*=h;let z=(U-N*N-F*F)/(2*N*F);z<-1?z=-1:z>1&&(z=1,n&&N+F>1e-4&&(d*=(Math.sqrt(U)/(N+F)-1)*l+1)),Y=Math.acos(z)*i,v=N+F*z,w=F*Math.sin(Y),L=Math.atan2(B*v-P*w,P*v+B*w)}else{v=h*F,w=c*F;const z=v*v,K=w*w,lt=Math.atan2(B,P);E=K*N*N+z*U-z*K;const ht=-2*K*N,ft=K-z;if(T=ht*ht-4*ft*E,T>=0){let we=Math.sqrt(T);ht<0&&(we=-we),we=-(ht+we)/2;const Ye=we/ft,ys=E/we,or=Math.abs(Ye)=-1&&E<=1&&(E=Math.acos(E),M=v*Math.cos(E)+N,I=w*Math.sin(E),T=M*M+I*I,Tge&&(ce=E,ge=T,jt=M,Sr=I)),U<=(ct+ge)/2?(L=lt-Math.atan2(Mt*i,at),Y=yt*i):(L=lt-Math.atan2(Sr*i,jt),Y=ce*i)}const H=Math.atan2(y,x)*g;let G=r.arotation;L=(L-H)*R.radDeg+p-G,L>180?L-=360:L<-180&&(L+=360),r.updateWorldTransformWith(o,a,G+L*l,d,r.ascaleY,0,0),G=t.arotation,Y=((Y+H)*R.radDeg-t.ashearX)*g+m-G,Y>180?Y-=360:Y<-180&&(Y+=360),t.updateWorldTransformWith(x,y,G+Y*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Fm=class{constructor(r){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=r}},Dm=class{constructor(r){this.order=0,this.bones=new Array,this.name=r}};var br=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(br||{});const ui=class{constructor(r,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.bones=new Array;for(let e=0,s=r.bones.length;e0;if(!(e>0||i))return;const n=this.data,l=n.spacingMode,o=l==br.Length,a=n.rotateMode,h=a==Qt.Tangent,d=a==Qt.ChainScale,c=this.bones.length,u=h?c:c+1,f=this.bones,p=V.setArraySize(this.spaces,u);let m=null;const g=this.spacing;if(d||o){d&&(m=V.setArraySize(this.lengths,c));for(let w=0,E=u-1;w0?R.degRad:-R.degRad}for(let w=0,E=3;wR.PI?k-=R.PI2:k<-R.PI&&(k+=R.PI2),k*=t,N=Math.cos(k),F=Math.sin(k),A.a=N*P-F*U,A.c=N*B-F*O,A.b=F*P+N*U,A.d=F*B+N*O}T.appliedValid=!1}}computeWorldPositions(r,t,e,s,i){const n=this.target;let l=this.position;const o=this.spaces,a=V.setArraySize(this.positions,3*t+2);let h=null;const d=r.closed;let c=r.worldVerticesLength,u=c/6,f=ui.NONE;if(!r.constantSpeed){const k=r.lengths;u-=d?1:2;const N=k[u];if(s&&(l*=N),i)for(let F=0;FN){f!=ui.AFTER&&(f=ui.AFTER,r.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(G-N,h,0,a,L);continue}}for(;;Y++){const z=k[Y];if(!(G>z)){if(0==Y)G/=z;else{const K=k[Y-1];G=(G-K)/(z-K)}break}}Y!=f&&(f=Y,d&&Y==u?(r.computeWorldVertices(n,c-4,4,h,0,2),r.computeWorldVertices(n,0,4,h,4,2)):r.computeWorldVertices(n,6*Y+2,8,h,0,2)),this.addCurvePosition(G,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],a,L,e||F>0&&0==H)}return a}d?(c+=2,h=V.setArraySize(this.world,c),r.computeWorldVertices(n,2,c-4,h,0,2),r.computeWorldVertices(n,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=V.setArraySize(this.world,c),r.computeWorldVertices(n,2,c,h,0,2));const p=V.setArraySize(this.curves,u);let m=0,g=h[0],x=h[1],y=0,_=0,b=0,v=0,w=0,E=0,T=0,A=0,D=0,C=0,M=0,I=0,P=0,B=0;for(let k=0,N=2;km){this.addAfterPosition(H-m,h,c-4,a,N);continue}}for(;;F++){const G=p[F];if(!(H>G)){if(0==F)H/=G;else{const z=p[F-1];H=(H-z)/(G-z)}break}}if(F!=f){f=F;let G=6*F;for(g=h[G],x=h[G+1],y=h[G+2],_=h[G+3],b=h[G+4],v=h[G+5],w=h[G+6],E=h[G+7],T=.03*(g-2*y+b),A=.03*(x-2*_+v),D=.006*(3*(y-b)-g+w),C=.006*(3*(_-v)-x+E),M=2*T+D,I=2*A+C,P=.3*(y-g)+T+.16666667*D,B=.3*(_-x)+A+.16666667*C,O=Math.sqrt(P*P+B*B),U[0]=O,G=1;G<8;G++)P+=M,B+=I,M+=D,I+=C,O+=Math.sqrt(P*P+B*B),U[G]=O;P+=M,B+=I,O+=Math.sqrt(P*P+B*B),U[8]=O,P+=M+D,B+=I+C,O+=Math.sqrt(P*P+B*B),U[9]=O,L=0}for(H*=O;;L++){const G=U[L];if(!(H>G)){if(0==L)H/=G;else{const z=U[L-1];H=L+(H-z)/(G-z)}break}}this.addCurvePosition(.1*H,g,x,y,_,b,v,w,E,a,N,e||k>0&&0==Y)}return a}addBeforePosition(r,t,e,s,i){const n=t[e],l=t[e+1],h=Math.atan2(t[e+3]-l,t[e+2]-n);s[i]=n+r*Math.cos(h),s[i+1]=l+r*Math.sin(h),s[i+2]=h}addAfterPosition(r,t,e,s,i){const n=t[e+2],l=t[e+3],h=Math.atan2(l-t[e+1],n-t[e]);s[i]=n+r*Math.cos(h),s[i+1]=l+r*Math.sin(h),s[i+2]=h}addCurvePosition(r,t,e,s,i,n,l,o,a,h,d,c){(0==r||isNaN(r))&&(r=1e-4);const u=r*r,f=u*r,p=1-r,m=p*p,g=m*p,x=p*r,y=3*x,_=p*y,b=y*r,v=t*g+s*_+n*b+o*f,w=e*g+i*_+l*b+a*f;h[d]=v,h[d+1]=w,c&&(h[d+2]=Math.atan2(w-(e*m+i*x*2+l*u),v-(t*m+s*x*2+n*u)))}getOrder(){return this.data.order}};let Gi=ui;Gi.NONE=-1,Gi.BEFORE=-2,Gi.AFTER=-3,Gi.epsilon=1e-5;let Nm=class{constructor(r,t){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new Mn,null==r)throw new Error("data cannot be null.");if(null==t)throw new Error("skeleton cannot be null.");this.data=r,this.rotateMix=r.rotateMix,this.translateMix=r.translateMix,this.scaleMix=r.scaleMix,this.shearMix=r.shearMix,this.bones=new Array;for(let e=0;e0?R.degRad:-R.degRad,c=this.data.offsetRotation*d,u=this.data.offsetShearY*d,f=this.bones;for(let p=0,m=f.length;pR.PI?E-=R.PI2:E<-R.PI&&(E+=R.PI2),E*=r;const T=Math.cos(E),A=Math.sin(E);y.a=T*_-A*v,y.c=T*b-A*w,y.b=A*_+T*v,y.d=A*b+T*w,x=!0}if(0!=t){const _=this.temp;i.localToWorld(_.set(this.data.offsetX,this.data.offsetY)),y.tx+=(_.x-y.tx)*t,y.ty+=(_.y-y.ty)*t,x=!0}if(e>0){let _=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(l*l+a*a);_>1e-5&&(_=(_+(b-_+this.data.offsetScaleX)*e)/_),y.a*=_,y.b*=_,_=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+h*h),_>1e-5&&(_=(_+(b-_+this.data.offsetScaleY)*e)/_),y.c*=_,y.d*=_,x=!0}if(s>0){const _=y.c,b=y.d,v=Math.atan2(b,_);let w=Math.atan2(h,o)-Math.atan2(a,l)-(v-Math.atan2(y.b,y.a));w>R.PI?w-=R.PI2:w<-R.PI&&(w+=R.PI2),w=v+(w+u)*s;const E=Math.sqrt(_*_+b*b);y.c=Math.cos(w)*E,y.d=Math.sin(w)*E,x=!0}x&&(g.appliedValid=!1)}}applyRelativeWorld(){const r=this.rotateMix,t=this.translateMix,e=this.scaleMix,s=this.shearMix,i=this.target,n=i.matrix,l=n.a,o=n.c,a=n.b,h=n.d,d=l*h-o*a>0?R.degRad:-R.degRad,c=this.data.offsetRotation*d,u=this.data.offsetShearY*d,f=this.bones;for(let p=0,m=f.length;pR.PI?E-=R.PI2:E<-R.PI&&(E+=R.PI2),E*=r;const T=Math.cos(E),A=Math.sin(E);y.a=T*_-A*v,y.c=T*b-A*w,y.b=A*_+T*v,y.d=A*b+T*w,x=!0}if(0!=t){const _=this.temp;i.localToWorld(_.set(this.data.offsetX,this.data.offsetY)),y.tx+=_.x*t,y.ty+=_.y*t,x=!0}if(e>0){let _=(Math.sqrt(l*l+a*a)-1+this.data.offsetScaleX)*e+1;y.a*=_,y.b*=_,_=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleY)*e+1,y.c*=_,y.d*=_,x=!0}if(s>0){let _=Math.atan2(h,o)-Math.atan2(a,l);_>R.PI?_-=R.PI2:_<-R.PI&&(_+=R.PI2);const b=y.c,v=y.d;_=Math.atan2(v,b)+(_-R.PI/2+u)*s;const w=Math.sqrt(b*b+v*v);y.c=Math.cos(_)*w,y.d=Math.sin(_)*w,x=!0}x&&(g.appliedValid=!1)}}applyAbsoluteLocal(){const r=this.rotateMix,t=this.translateMix,e=this.scaleMix,s=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();const n=this.bones;for(let l=0,o=n.length;l0&&(u>1e-5&&(u=(u+(i.ascaleX-u+this.data.offsetScaleX)*e)/u),f>1e-5&&(f=(f+(i.ascaleY-f+this.data.offsetScaleY)*e)/f));const p=a.ashearY;if(s>0){let m=i.ashearY-p+this.data.offsetShearY;m-=360*(16384-(16384.499999999996-m/360|0)),a.shearY+=m*s}a.updateWorldTransformWith(d,c,h,u,f,a.ashearX,p)}}applyRelativeLocal(){const r=this.rotateMix,t=this.translateMix,e=this.scaleMix,s=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();const n=this.bones;for(let l=0,o=n.length;l0&&(u>1e-5&&(u*=(i.ascaleX-1+this.data.offsetScaleX)*e+1),f>1e-5&&(f*=(i.ascaleY-1+this.data.offsetScaleY)*e+1));let p=a.ashearY;s>0&&(p+=(i.ashearY+this.data.offsetShearY)*s),a.updateWorldTransformWith(d,c,h,u,f,a.ashearX,p)}}getOrder(){return this.data.order}};const Fn=class{constructor(r){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==r)throw new Error("data cannot be null.");this.data=r,this.bones=new Array;for(let t=0;t1){const i=e[e.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(r),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(r){const t=r.target,e=t.data.index,s=t.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,e,s),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let o=0,a=this.data.skins.length;o-1||this.updateCacheReset.push(i)}else for(let s=0;s= 0.");if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("boneData cannot be null.");this.index=r,this.name=t,this.boneData=e}},Lm=class{constructor(r){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,null==r)throw new Error("name cannot be null.");this.name=r}},Vm=class{constructor(r){if(this.attachments=new Array,null==r)throw new Error("name cannot be null.");this.name=r}addAttachment(r,t,e){if(null==e)throw new Error("attachment cannot be null.");const s=this.attachments;r>=s.length&&(s.length=r+1),s[r]||(s[r]={}),s[r][t]=e}getAttachment(r,t){const e=this.attachments[r];return e?e[t]:null}attachAll(r,t){let e=0;for(let s=0;s=0;y--)-1==f[y]&&(f[y]=m[--x])}a.setFrame(d++,u.time,f)}n.push(a),l=Math.max(l,a.frames[a.getFrameCount()-1])}if(t.events){const a=new Sm(t.events.length);let h=0;for(let d=0;d>1)*n;const l=r.bone.skeleton,o=r.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,x=f.c,y=f.b,_=f.d;for(let b=t,v=i;v=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(r,t){let e=r;const s=(this.start+t).toString();for(let i=this.digits-s.length;i>0;i--)e+="0";return e+=s,e}static nextID(){return fo._nextID++}};let po=fo;po._nextID=0;var $r=(r=>(r[r.hold=0]="hold",r[r.once=1]="once",r[r.loop=2]="loop",r[r.pingpong=3]="pingpong",r[r.onceReverse=4]="onceReverse",r[r.loopReverse=5]="loopReverse",r[r.pingpongReverse=6]="pingpongReverse",r))($r||{});const cc=[0,1,2,3,4,5,6];class mo{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new Jp,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e0&&(e%=this.duration));const h=this.timelines;for(let d=0,c=h.length;de)return i-1;return s-1}static search(t,e,s){const i=t.length;for(let n=s;ne)return n-s;return i-s}}class wr extends Zt{constructor(t,e,s){super(t,s),this.curves=V.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+18*t;if(this.curves.length>e){const s=V.newFloatArray(e);V.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,n,l,o,a,h,d,c){const u=this.curves;let f=this.getFrameCount()+18*t;0==s&&(u[e]=2+f);const p=.03*(i-2*l+a),m=.03*(n-2*o+h),g=.006*(3*(l-a)-i+d),x=.006*(3*(o-h)-n+c);let y=2*p+g,_=2*m+x,b=.3*(l-i)+p+.16666667*g,v=.3*(o-n)+m+.16666667*x,w=i+b,E=n+v;for(let T=f+18;ft){const h=this.frames[e],d=this.frames[e+s];return d+(t-h)/(n[i]-h)*(n[i+1]-d)}const l=i+18;for(i+=2;i=t){const h=n[i-2],d=n[i-1];return d+(t-h)/(n[i]-h)*(n[i+1]-d)}e+=this.getFrameEntries();const o=n[l-2],a=n[l-1];return a+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-a)}}class Er extends wr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){this.frames[t<<=1]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const i=this.curves[s>>1];switch(i){case 0:const n=e[s],l=e[s+1];return l+(t-n)/(e[s+2]-n)*(e[s+2+1]-l);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}}class go extends wr{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){this.frames[t*=3]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class Dn extends Er{constructor(t,e,s){super(t,e,`0|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,l,o){const a=t.bones[this.boneIndex];if(!a.active)return;if(s>2];switch(m){case 0:const g=h[p];c=h[p+1],u=h[p+2],f=h[p+3];const x=(s-g)/(h[p+4]-g);c+=(h[p+4+1]-c)*x,u+=(h[p+4+2]-u)*x,f+=(h[p+4+3]-f)*x;break;case 1:c=h[p+1],u=h[p+2],f=h[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),u=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+36-2)}if(1==n)d.r=c,d.g=u,d.b=f;else{if(l==S.setup){const g=a.data.color;d.r=g.r,d.g=g.g,d.b=g.b}d.r+=(c-d.r)*n,d.g+=(u-d.g)*n,d.b+=(f-d.b)*n}}}class wc extends Er{constructor(t,e,s){super(t,e,`8|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=a.color;if(s>3];switch(b){case 0:const v=h[_];u=h[_+1],f=h[_+2],p=h[_+3],m=h[_+4],g=h[_+5],x=h[_+6],y=h[_+7];const w=(s-v)/(h[_+8]-v);u+=(h[_+8+1]-u)*w,f+=(h[_+8+2]-f)*w,p+=(h[_+8+3]-p)*w,m+=(h[_+8+4]-m)*w,g+=(h[_+8+5]-g)*w,x+=(h[_+8+6]-x)*w,y+=(h[_+8+7]-y)*w;break;case 1:u=h[_+1],f=h[_+2],p=h[_+3],m=h[_+4],g=h[_+5],x=h[_+6],y=h[_+7];break;default:u=this.getBezierValue(s,_,1,b-2),f=this.getBezierValue(s,_,2,b+18-2),p=this.getBezierValue(s,_,3,b+36-2),m=this.getBezierValue(s,_,4,b+54-2),g=this.getBezierValue(s,_,5,b+72-2),x=this.getBezierValue(s,_,6,b+90-2),y=this.getBezierValue(s,_,7,b+108-2)}if(1==n)d.set(u,f,p,m),c.r=g,c.g=x,c.b=y;else{if(l==S.setup){d.setFromColor(a.data.color);const v=a.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}d.add((u-d.r)*n,(f-d.g)*n,(p-d.b)*n,(m-d.a)*n),c.r+=(g-c.r)*n,c.g+=(x-c.g)*n,c.b+=(y-c.b)*n}}}class Ac extends wr{constructor(t,e,s){super(t,e,[`7|${s}`,`9|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,l,o,a){this.frames[t*=7]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=a}apply(t,e,s,i,n,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=this.frames,d=a.color,c=a.darkColor;if(st){const a=this.frames[e];return s[i+1]*(t-a)/(s[i]-a)}const n=i+18;for(i+=2;i=t){const a=s[i-2],h=s[i-1];return h+(t-a)/(s[i]-a)*(s[i+1]-h)}const l=s[n-2],o=s[n-1];return o+(1-o)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}apply(t,e,s,i,n,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=a.getAttachment();if(!(h&&h instanceof vr&&h.timelineAttachment==this.attachment))return;const d=a.deform;0==d.length&&(l=S.setup);const c=this.vertices,u=c[0].length,f=this.frames;if(s=f[f.length-1]){const y=c[f.length-1];if(1==n)if(l==S.add){const _=h;if(_.bones)for(let b=0;be)this.apply(r,t,Number.MAX_VALUE,s,i,n,l),t=-1;else if(t>=o[a-1])return;if(e0&&o[h-1]==d;)h--}for(;h=o[h];h++)s.push(this.events[h])}};let Nn=Gm;Nn.propertyIds=["12"];const Hm=class extends Zt{constructor(r){super(r,Hm.propertyIds),this.drawOrders=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.drawOrders[r]=e}apply(r,t,e,s,i,n,l){if(l==mt.mixOut)return void(n==S.setup&&V.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length));if(e>2];switch(p){case 0:const m=h[f];d=h[f+1],c=h[f+2],u=h[f+3];const g=(s-m)/(h[f+4]-m);d+=(h[f+4+1]-d)*g,c+=(h[f+4+2]-c)*g,u+=(h[f+4+3]-u)*g;break;case 1:d=h[f+1],c=h[f+2],u=h[f+3];break;default:d=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+36-2)}if(l==S.setup){const m=a.data;a.mixRotate=m.mixRotate+(d-m.mixRotate)*n,a.mixX=m.mixX+(c-m.mixX)*n,a.mixY=m.mixY+(u-m.mixY)*n}else a.mixRotate+=(d-a.mixRotate)*n,a.mixX+=(c-a.mixX)*n,a.mixY+=(u-a.mixY)*n}}const Ls=class extends Zt{constructor(r,t,e){super(r,[`19|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return Ls.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(r,t,e,s,i){const n=this.frames;n[r*=Ls.ENTRIES]=t,n[r+Ls.MODE]=e|s<<4,n[r+Ls.DELAY]=i}apply(r,t,e,s,i,n,l){const o=r.slots[this.slotIndex];if(!o.bone.active)return;const a=o.attachment,h=this.attachment;if(!(a==h||a instanceof vr&&a.timelineAttachment==h))return;const d=this.frames;if(e>4;const g=this.attachment.sequence.regions.length,x=cc[15&f];if(x!=$r.hold)switch(m+=(e-d[c])/d[c+Ls.DELAY]+1e-5|0,x){case $r.once:m=Math.min(g-1,m);break;case $r.loop:m%=g;break;case $r.pingpong:{const y=(g<<1)-2;m=0==y?0:m%y,m>=g&&(m=y-m);break}case $r.onceReverse:m=Math.max(g-1-m,0);break;case $r.loopReverse:m=g-1-m%g;break;case $r.pingpongReverse:{const y=(g<<1)-2;m=0==y?0:(m+g-1)%y,m>=g&&(m=y-m)}}o.sequenceIndex=m}};let Hi=Ls;Hi.ENTRIES=3,Hi.MODE=1,Hi.DELAY=2;const zr=class{constructor(r){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Wm(this),this.propertyIDs=new Jp,this.animationsChanged=!1,this.trackEntryPool=new to(()=>new yo),this.data=r}static emptyAnimation(){return zr._emptyAnimation}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let l=i.next;if(l){const o=i.trackLast-l.delay;if(o>=0){for(l.delay=0,l.trackTime+=0==i.timeScale?0:(o/i.timeScale+r)*l.timeScale,i.trackTime+=n,this.setCurrent(e,l,!0);l.mixingFrom;)l.mixTime+=r,l=l.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){t[e]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,r)){let o=i.mixingFrom;for(i.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(!e)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,r.mixTime>0&&r.mixTime>=r.mixDuration?((0==e.totalAlpha||0==r.mixDuration)&&(r.mixingFrom=e.mixingFrom,e.mixingFrom&&(e.mixingFrom.mixingTo=r),r.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,r.mixTime+=t,!1)}apply(r){if(!r)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let l=0,o=e.length;l0)continue;s=!0;const h=0==l?S.first:a.mixBlend;let d=a.alpha;a.mixingFrom?d*=this.applyMixingFrom(a,r,h):a.trackTime>=a.trackEnd&&!a.next&&(d=0);const c=a.animationLast,u=a.getAnimationTime();let f=u,p=t;a.reverse&&(f=a.animation.duration-f,p=null);const m=a.animation.timelines,g=m.length;if(0==l&&1==d||h==S.add)for(let x=0;x1&&(i=1),e!=S.first&&(e=s.mixBlend));const n=i0&&this.queueEvents(s,u),this.events.length=0,s.nextAnimationLast=u,s.nextTrackLast=s.trackTime,i}applyAttachmentTimeline(r,t,e,s,i){const n=t.slots[r.slotIndex];n.bone.active&&(e0;let x=p>=0;R.signum(m)!=R.signum(f)&&Math.abs(m)<=90&&(Math.abs(p)>180&&(p+=360*R.signum(p)),x=g),u=f+p-p%360,x!=g&&(u+=360*R.signum(p)),n[l]=u}n[l+1]=f,a.rotation=d+u*s}queueEvents(r,t){const e=r.animationStart,s=r.animationEnd,i=s-e,n=r.trackLast%i,l=this.events;let o=0;const a=l.length;for(;os||this.queue.event(r,d)}let h=!1;for(h=r.loop?0==i||n>r.trackTime%i:t>=s&&r.animationLast=this.tracks.length)return;const t=this.tracks[r];if(!t)return;this.queue.end(t),this.clearNext(t);let e=t;for(;;){const s=e.mixingFrom;if(!s)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(r,t,e){const s=this.expandToIndex(r);this.tracks[r]=t,t.previous=null,s&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(r,t,e=!1){const s=this.data.skeletonData.findAnimation(t);if(!s)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,s,e)}setAnimationWith(r,t,e=!1){if(!t)throw new Error("animation cannot be null.");let s=!0,i=this.expandToIndex(r);i&&(-1==i.nextTrackLast?(this.tracks[r]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,s=!1):this.clearNext(i));const n=this.trackEntry(r,t,e,i);return this.setCurrent(r,n,s),this.queue.drain(),n}addAnimation(r,t,e=!1,s=0){const i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,i,e,s)}addAnimationWith(r,t,e=!1,s=0){if(!t)throw new Error("animation cannot be null.");let i=this.expandToIndex(r);if(i)for(;i.next;)i=i.next;const n=this.trackEntry(r,t,e,i);return i?(i.next=n,n.previous=i,s<=0&&(s+=i.getTrackComplete()-n.mixDuration)):(this.setCurrent(r,n,!0),this.queue.drain()),n.delay=s,n}setEmptyAnimation(r,t=0){const e=this.setAnimationWith(r,zr.emptyAnimation(),!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t=0,e=0){const s=this.addAnimationWith(r,zr.emptyAnimation(),!1,e);return e<=0&&(s.delay+=s.mixDuration-t),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(r=0){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){i[o]=Uw,n[o]=d;continue t}break}i[o]=kc}else i[o]=Pc}}getCurrent(r){return r>=this.tracks.length?null:this.tracks[r]}addListener(r){if(!r)throw new Error("listener cannot be null.");this.listeners.push(r)}removeListener(r){const t=this.listeners.indexOf(r);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(r,t,e){zr.deprecatedWarning1||(zr.deprecatedWarning1=!0),this.setAnimation(r,t,e)}addAnimationByName(r,t,e,s){zr.deprecatedWarning2||(zr.deprecatedWarning2=!0),this.addAnimation(r,t,e,s)}hasAnimation(r){return null!==this.data.skeletonData.findAnimation(r)}hasAnimationByName(r){return zr.deprecatedWarning3||(zr.deprecatedWarning3=!0),this.hasAnimation(r)}};let Wi=zr;Wi._emptyAnimation=new mo("",[],0),Wi.deprecatedWarning1=!1,Wi.deprecatedWarning2=!1,Wi.deprecatedWarning3=!1;const ds=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const r=this.animationEnd-this.animationStart;return 0==r?this.animationStart:this.trackTime%r+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(r){this.animationLast=r,this.nextAnimationLast=r}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const r=this.animationEnd-this.animationStart;if(0!=r){if(this.loop)return r*(1+(this.trackTime/r|0));if(this.trackTime(r[r.start=0]="start",r[r.interrupt=1]="interrupt",r[r.end=2]="end",r[r.dispose=3]="dispose",r[r.complete=4]="complete",r[r.event=5]="event",r))(Ue||{});const Pc=0,jm=1,$m=2,kc=3,Uw=4,zm=1,Xw=2;class qm{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){const i=this.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);const n=this.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");this.animationToMixTime[`${t.name}.${e.name}`]=s}getMix(t,e){const i=this.animationToMixTime[`${t.name}.${e.name}`];return void 0===i?this.defaultMix:i}}class Fc{constructor(t){this.atlas=t}loadSequence(t,e,s){const i=s.regions;for(let n=0,l=i.length;n1e-4?(g=Math.abs(u*m-f*p)/g,u/=d,p/=c,f=p*g,m=u*g,x=Math.atan2(p,u)*R.radDeg):(u=0,p=0,x=90-Math.atan2(m,f)*R.radDeg);const y=s+l-x,_=s+o-x+90,b=R.cosDeg(y)*i,v=R.cosDeg(_)*n,w=R.sinDeg(y)*i,E=R.sinDeg(_)*n;h.a=u*b-f*w,h.c=u*v-f*E,h.b=p*b+m*w,h.d=p*v+m*E;break}case nt.NoScale:case nt.NoScaleOrReflection:{const g=R.cosDeg(s),x=R.sinDeg(s);let y=(u*g+f*x)/d,_=(p*g+m*x)/c,b=Math.sqrt(y*y+_*_);b>1e-5&&(b=1/b),y*=b,_*=b,b=Math.sqrt(y*y+_*_),this.data.transformMode==nt.NoScale&&u*m-f*p<0!=(d<0!=c<0)&&(b=-b);const v=Math.PI/2+Math.atan2(_,y),w=Math.cos(v)*b,E=Math.sin(v)*b,T=R.cosDeg(l)*i,A=R.cosDeg(90+o)*n,D=R.sinDeg(l)*i,C=R.sinDeg(90+o)*n;h.a=y*T+w*D,h.c=y*A+w*C,h.b=_*T+E*D,h.d=_*A+E*C;break}}h.a*=d,h.c*=d,h.b*=c,h.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*R.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.b*t.b)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.c*t.c+t.d*t.d)}updateAppliedTransform(){const t=this.parent,e=this.matrix;if(!t)return this.ax=e.tx-this.skeleton.x,this.ay=e.ty-this.skeleton.y,this.arotation=Math.atan2(e.b,e.a)*R.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,void(this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*R.radDeg);const s=t.matrix,i=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,l=e.ty-s.ty;this.ax=n*s.d*i-l*s.c*i,this.ay=l*s.a*i-n*s.b*i;const o=i*s.d,a=i*s.a,h=i*s.c,d=i*s.b,c=o*e.a-h*e.b,u=o*e.c-h*e.d,f=a*e.b-d*e.a,p=a*e.d-d*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-u*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*u+f*p,m)*R.radDeg,this.arotation=Math.atan2(f,c)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,u)*R.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,l=e.d,o=1/(s*l-i*n),a=t.x-e.tx,h=t.y-e.ty;return t.x=a*l*o-h*i*o,t.y=h*s*o-a*n*o,t}localToWorld(t){const e=this.matrix,s=t.x,i=t.y;return t.x=s*e.a+i*e.c+e.tx,t.y=s*e.b+i*e.d+e.ty,t}worldToLocalRotation(t){const e=R.sinDeg(t),s=R.cosDeg(t),i=this.matrix;return Math.atan2(i.a*e-i.b*s,i.d*s-i.c*e)*R.radDeg}localToWorldRotation(t){const e=R.sinDeg(t-=this.rotation-this.shearX),s=R.cosDeg(t),i=this.matrix;return Math.atan2(s*i.b+e*i.d,s*i.a+e*i.c)*R.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,l=e.d,o=R.cosDeg(t),a=R.sinDeg(t);e.a=o*s-a*n,e.c=o*i-a*l,e.b=a*s+o*n,e.d=a*i+o*l}}class Nc{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=nt.Normal,this.skinRequired=!1,this.color=new W,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class xo{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let Oc=class{constructor(r,t){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!t)throw new Error("data cannot be null.");this.time=r,this.data=t}};class Bc{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class Zm{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let i=0;i180?f-=360:f<-180&&(f+=360);let y=t.ascaleX,_=t.ascaleY;if(i||n){switch(t.data.transformMode){case nt.NoScale:case nt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const b=t.data.length*y,v=Math.sqrt(p*p+m*m);if(i&&vb&&b>1e-4){const w=(v/b-1)*o+1;y*=w,l&&(_*=w)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,y,_,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,l,o,a,h){const d=t.ax,c=t.ay;let u=t.ascaleX,f=t.ascaleY,p=u,m=f,g=e.ascaleX;const x=t.matrix;let y=0,_=0,b=0;u<0?(u=-u,y=180,b=-1):(y=0,b=1),f<0&&(f=-f,b=-b),g<0?(g=-g,_=180):_=0;const v=e.ax;let w=0,E=0,T=0,A=x.a,D=x.c,C=x.b,M=x.d;const I=Math.abs(u-f)<=1e-4;!I||l?(w=0,E=A*v+x.tx,T=C*v+x.ty):(w=e.ay,E=A*v+D*w+x.tx,T=C*v+M*w+x.ty);const P=t.parent.matrix;if(!P)throw new Error("IK parent must itself have a parent.");A=P.a,D=P.c,C=P.b,M=P.d;const B=1/(A*M-D*C);let U=E-P.tx,O=T-P.ty;const k=(U*M-O*D)*B-d,N=(O*A-U*C)*B-c,F=Math.sqrt(k*k+N*N);let Y,H,L=e.data.length*g;if(F<1e-4)return this.apply1(t,s,i,!1,l,!1,h),void e.updateWorldTransformWith(v,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);U=s-P.tx,O=i-P.ty;let G=(U*M-O*D)*B-d,z=(O*A-U*C)*B-c,K=G*G+z*z;if(0!=a){a*=u*(g+1)*.5;const ft=Math.sqrt(K),yt=ft-F-L*u+a;if(yt>0){let at=Math.min(1,yt/(2*a))-1;at=(yt-a*(1-at*at))/ft,G-=at*G,z-=at*z,K=G*G+z*z}}t:if(I){L*=u;let ft=(K-F*F-L*L)/(2*F*L);ft<-1?(ft=-1,H=Math.PI*n):ft>1?(ft=1,H=0,l&&(A=(Math.sqrt(K)/(F+L)-1)*h+1,p*=A,o&&(m*=A))):H=Math.acos(ft)*n,A=F+L*ft,D=L*Math.sin(H),Y=Math.atan2(z*A-G*D,G*A+z*D)}else{A=u*L,D=f*L;const ft=A*A,yt=D*D,at=Math.atan2(z,G);C=yt*F*F+ft*K-ft*yt;const ct=-2*yt*F,Mt=yt-ft;if(M=ct*ct-4*Mt*C,M>=0){let Je=Math.sqrt(M);ct<0&&(Je=-Je),Je=.5*-(ct+Je);const ag=Je/Mt,og=C/Je,Ki=Math.abs(ag)=-1&&C<=1&&(C=Math.acos(C),U=A*Math.cos(C)+F,O=D*Math.sin(C),M=U*U+O*O,Mys&&(we=C,ys=M,Ye=U,or=O)),K<=.5*(ge+ys)?(Y=at-Math.atan2(Sr*n,jt),H=ce*n):(Y=at-Math.atan2(or*n,Ye),H=we*n)}const lt=Math.atan2(w,v)*b;let ht=t.arotation;Y=(Y-lt)*R.radDeg+y-ht,Y>180?Y-=360:Y<-180&&(Y+=360),t.updateWorldTransformWith(d,c,ht+Y*h,p,m,0,0),ht=e.arotation,H=((H+lt)*R.radDeg-e.ashearX)*b+_-ht,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(v,w,ht+H*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Lc extends xo{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class Vc extends xo{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=Ut.Fixed,this.spacingMode=he.Fixed,this.rotateMode=Qt.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var he=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r[r.Proportional=3]="Proportional",r))(he||{});const fs=class{constructor(r,t){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!r)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=r,this.bones=new Array;for(let s=0,i=r.bones.length;s0){y=h/y*u;for(let b=1;b0?R.degRad:-R.degRad}for(let y=0,_=3;y0){const D=v.a,C=v.c,M=v.b,I=v.d;let P=0,B=0,U=0;if(P=n?f[_-1]:0==d[y+1]?f[_+2]:Math.atan2(A,T),P-=Math.atan2(M,D),x){B=Math.cos(P),U=Math.sin(P);const O=b.data.length;p+=(O*(B*D-U*M)-T)*t,m+=(O*(U*D+B*M)-A)*t}else P+=g;P>R.PI?P-=R.PI2:P<-R.PI&&(P+=R.PI2),P*=t,B=Math.cos(P),U=Math.sin(P),v.a=B*D-U*M,v.c=B*C-U*I,v.b=U*D+B*M,v.d=U*C+B*I}b.updateAppliedTransform()}}computeWorldPositions(r,t,e){const s=this.target;let i=this.position;const n=this.spaces,l=V.setArraySize(this.positions,3*t+2);let o=this.world;const a=r.closed;let h=r.worldVerticesLength,d=h/6,c=fs.NONE;if(!r.constantSpeed){const O=r.lengths;d-=a?1:2;const k=O[d];let N;switch(this.data.positionMode==Ut.Percent&&(i*=k),this.data.spacingMode){case he.Percent:N=k;break;case he.Proportional:N=k/t;break;default:N=1}o=V.setArraySize(this.world,8);for(let F=0,L=0,Y=0;Fk){c!=fs.AFTER&&(c=fs.AFTER,r.computeWorldVertices(s,h-6,4,o,0,2)),this.addAfterPosition(G-k,o,0,l,L);continue}}for(;;Y++){const z=O[Y];if(!(G>z)){if(0==Y)G/=z;else{const K=O[Y-1];G=(G-K)/(z-K)}break}}Y!=c&&(c=Y,a&&Y==d?(r.computeWorldVertices(s,h-4,4,o,0,2),r.computeWorldVertices(s,0,4,o,4,2)):r.computeWorldVertices(s,6*Y+2,8,o,0,2)),this.addCurvePosition(G,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],l,L,e||F>0&&0==H)}return l}a?(h+=2,o=V.setArraySize(this.world,h),r.computeWorldVertices(s,2,h-4,o,0,2),r.computeWorldVertices(s,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(d--,h-=4,o=V.setArraySize(this.world,h),r.computeWorldVertices(s,2,h,o,0,2));const u=V.setArraySize(this.curves,d);let P,f=0,p=o[0],m=o[1],g=0,x=0,y=0,_=0,b=0,v=0,w=0,E=0,T=0,A=0,D=0,C=0,M=0,I=0;for(let O=0,k=2;Of){this.addAfterPosition(Y-f,o,h-4,l,k);continue}}for(;;N++){const H=u[N];if(!(Y>H)){if(0==N)Y/=H;else{const G=u[N-1];Y=(Y-G)/(H-G)}break}}if(N!=c){c=N;let H=6*N;for(p=o[H],m=o[H+1],g=o[H+2],x=o[H+3],y=o[H+4],_=o[H+5],b=o[H+6],v=o[H+7],w=.03*(p-2*g+y),E=.03*(m-2*x+_),T=.006*(3*(g-y)-p+b),A=.006*(3*(x-_)-m+v),D=2*w+T,C=2*E+A,M=.3*(g-p)+w+.16666667*T,I=.3*(x-m)+E+.16666667*A,U=Math.sqrt(M*M+I*I),B[0]=U,H=1;H<8;H++)M+=D,I+=C,D+=T,C+=A,U+=Math.sqrt(M*M+I*I),B[H]=U;M+=D,I+=C,U+=Math.sqrt(M*M+I*I),B[8]=U,M+=D+T,I+=C+A,U+=Math.sqrt(M*M+I*I),B[9]=U,F=0}for(Y*=U;;F++){const H=B[F];if(!(Y>H)){if(0==F)Y/=H;else{const G=B[F-1];Y=F+(Y-G)/(H-G)}break}}this.addCurvePosition(.1*Y,p,m,g,x,y,_,b,v,l,k,e||O>0&&0==L)}return l}addBeforePosition(r,t,e,s,i){const n=t[e],l=t[e+1],h=Math.atan2(t[e+3]-l,t[e+2]-n);s[i]=n+r*Math.cos(h),s[i+1]=l+r*Math.sin(h),s[i+2]=h}addAfterPosition(r,t,e,s,i){const n=t[e+2],l=t[e+3],h=Math.atan2(l-t[e+1],n-t[e]);s[i]=n+r*Math.cos(h),s[i+1]=l+r*Math.sin(h),s[i+2]=h}addCurvePosition(r,t,e,s,i,n,l,o,a,h,d,c){if(0==r||isNaN(r))return h[d]=t,h[d+1]=e,void(h[d+2]=Math.atan2(i-e,s-t));const u=r*r,f=u*r,p=1-r,m=p*p,g=m*p,x=p*r,y=3*x,_=p*y,b=y*r,v=t*g+s*_+n*b+o*f,w=e*g+i*_+l*b+a*f;h[d]=v,h[d+1]=w,c&&(h[d+2]=r<.001?Math.atan2(i-e,s-t):Math.atan2(w-(e*m+i*x*2+l*u),v-(t*m+s*x*2+n*u)))}};let ji=fs;ji.NONE=-1,ji.BEFORE=-2,ji.AFTER=-3,ji.epsilon=1e-5;class Km{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new W,this.darkColor=t.darkColor?new W:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof vr)||!(this.attachment instanceof vr)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class Qm{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new Mn,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let i=0;i0?R.degRad:-R.degRad,m=this.data.offsetRotation*p,g=this.data.offsetShearY*p,x=this.bones;for(let y=0,_=x.length;y<_;y++){const b=x[y],v=b.matrix;if(0!=t){const w=v.a,E=v.c,T=v.b,A=v.d;let D=Math.atan2(u,d)-Math.atan2(T,w)+m;D>R.PI?D-=R.PI2:D<-R.PI&&(D+=R.PI2),D*=t;const C=Math.cos(D),M=Math.sin(D);v.a=C*w-M*T,v.c=C*E-M*A,v.b=M*w+C*T,v.d=M*E+C*A}if(o){const w=this.temp;a.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),v.tx+=(w.x-v.tx)*e,v.ty+=(w.y-v.ty)*s}if(0!=i){let w=Math.sqrt(v.a*v.a+v.b*v.b);0!=w&&(w=(w+(Math.sqrt(d*d+u*u)-w+this.data.offsetScaleX)*i)/w),v.a*=w,v.b*=w}if(0!=n){let w=Math.sqrt(v.c*v.c+v.d*v.d);0!=w&&(w=(w+(Math.sqrt(c*c+f*f)-w+this.data.offsetScaleY)*n)/w),v.c*=w,v.d*=w}if(l>0){const w=v.c,E=v.d,T=Math.atan2(E,w);let A=Math.atan2(f,c)-Math.atan2(u,d)-(T-Math.atan2(v.b,v.a));A>R.PI?A-=R.PI2:A<-R.PI&&(A+=R.PI2),A=T+(A+g)*l;const D=Math.sqrt(w*w+E*E);v.c=Math.cos(A)*D,v.d=Math.sin(A)*D}b.updateAppliedTransform()}}applyRelativeWorld(){const t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,l=this.mixShearY,o=0!=e||0!=s,a=this.target,h=a.matrix,d=h.a,c=h.c,u=h.b,f=h.d,p=d*f-c*u>0?R.degRad:-R.degRad,m=this.data.offsetRotation*p,g=this.data.offsetShearY*p,x=this.bones;for(let y=0,_=x.length;y<_;y++){const b=x[y],v=b.matrix;if(0!=t){const w=v.a,E=v.c,T=v.b,A=v.d;let D=Math.atan2(u,d)+m;D>R.PI?D-=R.PI2:D<-R.PI&&(D+=R.PI2),D*=t;const C=Math.cos(D),M=Math.sin(D);v.a=C*w-M*T,v.c=C*E-M*A,v.b=M*w+C*T,v.d=M*E+C*A}if(o){const w=this.temp;a.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),v.tx+=w.x*e,v.ty+=w.y*s}if(0!=i){const w=(Math.sqrt(d*d+u*u)-1+this.data.offsetScaleX)*i+1;v.a*=w,v.b*=w}if(0!=n){const w=(Math.sqrt(c*c+f*f)-1+this.data.offsetScaleY)*n+1;v.c*=w,v.d*=w}if(l>0){let w=Math.atan2(f,c)-Math.atan2(u,d);w>R.PI?w-=R.PI2:w<-R.PI&&(w+=R.PI2);const E=v.c,T=v.d;w=Math.atan2(T,E)+(w-R.PI/2+g)*l;const A=Math.sqrt(E*E+T*T);v.c=Math.cos(w)*A,v.d=Math.sin(w)*A}b.updateAppliedTransform()}}applyAbsoluteLocal(){const t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,l=this.mixShearY,o=this.target,a=this.bones;for(let h=0,d=a.length;h= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class Gc extends xo{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class Hc{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class _o{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s>4,t.readFloat())}i.push(w);break}}}}}const l=t.readInt(!0);if(l>0){const h=new mi(l),d=s.slots.length;for(let c=0;c=0;y--)p[y]=-1;const m=V.newArray(d-f,0);let g=0,x=0;for(let y=0;y=0;y--)-1==p[y]&&(p[y]=m[--x]);h.setFrame(c,u,p)}i.push(h)}const o=t.readInt(!0);if(o>0){const h=new Nn(o);for(let d=0;d=0;x--)-1==u[x]&&(u[x]=p[--g])}o.setFrame(h,X(c,"time",0),u)}n.push(o)}if(t.events){const o=new Nn(t.events.length);let a=0;for(let h=0;h(r[r.UNKNOWN=0]="UNKNOWN",r[r.VER37=37]="VER37",r[r.VER38=38]="VER38",r[r.VER40=40]="VER40",r[r.VER41=41]="VER41",r))(ar||{});function vo(r){const t=r.substr(0,3),e=Math.floor(10*Number(t)+.001);return"3.7"===t?37:"3.8"===t?38:"4.0"===t?40:"4.1"===t?41:e<37?37:0}class fE{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,i=this.readVersionOldFormat(e),n=vo(i);return n===ar.VER38&&(s=new re(new Yh(t))),i=this.readVersionNewFormat(e),n=vo(i),(n===ar.VER40||n===ar.VER41)&&(s=new Wc(new Fc(t))),s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new Ja(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new Ja(t);let s;e.readInt32(),e.readInt32();try{s=e.readString()}catch{s=""}return s||""}}class pE{constructor(){this.scale=1}readSkeletonData(t,e){const i=vo(e.skeleton.spine);let n=null;return i===ar.VER37&&(n=new Um(new Rm(t))),i===ar.VER38&&(n=new pm(new Yh(t))),(i===ar.VER40||i===ar.VER41)&&(n=new bo(new Fc(t))),n.scale=this.scale,n.readSkeletonData(e)}}class wo extends Ui{createSkeleton(t){const e=vo(t.version);let s=null;e===ar.VER37&&(s=Lw),e===ar.VER38&&(s=Fw),(e===ar.VER40||e===ar.VER41)&&(s=dE),this.skeleton=new s.Skeleton(t),this.skeleton.updateWorldTransform(),this.stateData=new s.AnimationStateData(t),this.state=new s.AnimationState(this.stateData)}}(new class mE extends Sw{createBinaryParser(){return new fE}createJsonParser(){return new pE}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}).installLoader();const zc={},tg=window.devicePixelRatio||1;Z.RESOLUTION=tg,Z.RENDER_OPTIONS.MSAA_QUALITY=$t.HIGH,it.defaultOptions.multisample=$t.HIGH,it.defaultOptions.mipmap=rr.ON,it.defaultOptions.anisotropicLevel=4;let Xe=null;const qc=()=>{if(!Xe)return;const r=Math.min(Xe.screen.width/1080,Xe.screen.height/768);Xe.stage.scale.x=r,Xe.stage.scale.y=r,Xe.stage.position.x=Xe.screen.width/2,Xe.stage.position.y=Xe.screen.height/2};window.addEventListener("resize",()=>function gE(r,t=50){zc[r]&&clearTimeout(zc[r]),zc[r]=setTimeout(()=>{r()},t)}(qc,50));var $i={};!function(r){!function(){var t=function(){this.init()};t.prototype={init:function(){var c=this||e;return c._counter=1e3,c._html5AudioPool=[],c.html5PoolSize=10,c._codecs={},c._howls=[],c._muted=!1,c._volume=1,c._canPlayEvent="canplaythrough",c._navigator=typeof window<"u"&&window.navigator?window.navigator:null,c.masterGain=null,c.noAudio=!1,c.usingWebAudio=!0,c.autoSuspend=!0,c.ctx=null,c.autoUnlock=!0,c._setup(),c},volume:function(c){var u=this||e;if(c=parseFloat(c),u.ctx||d(),typeof c<"u"&&c>=0&&c<=1){if(u._volume=c,u._muted)return u;u.usingWebAudio&&u.masterGain.gain.setValueAtTime(c,e.ctx.currentTime);for(var f=0;f=0;u--)c._howls[u].unload();return c.usingWebAudio&&c.ctx&&typeof c.ctx.close<"u"&&(c.ctx.close(),c.ctx=null,d()),c},codecs:function(c){return(this||e)._codecs[c.replace(/^x-/,"")]},_setup:function(){var c=this||e;if(c.state=c.ctx&&c.ctx.state||"suspended",c._autoSuspend(),!c.usingWebAudio)if(typeof Audio<"u")try{typeof(new Audio).oncanplaythrough>"u"&&(c._canPlayEvent="canplay")}catch{c.noAudio=!0}else c.noAudio=!0;try{(new Audio).muted&&(c.noAudio=!0)}catch{}return c.noAudio||c._setupCodecs(),c},_setupCodecs:function(){var c=this||e,u=null;try{u=typeof Audio<"u"?new Audio:null}catch{return c}if(!u||"function"!=typeof u.canPlayType)return c;var f=u.canPlayType("audio/mpeg;").replace(/^no$/,""),p=c._navigator?c._navigator.userAgent:"",m=p.match(/OPR\/(\d+)/g),g=m&&parseInt(m[0].split("/")[1],10)<33,x=-1!==p.indexOf("Safari")&&-1===p.indexOf("Chrome"),y=p.match(/Version\/(.*?) /),_=x&&y&&parseInt(y[1],10)<15;return c._codecs={mp3:!(g||!f&&!u.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!f,opus:!!u.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!u.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!u.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(u.canPlayType('audio/wav; codecs="1"')||u.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!u.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!u.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(u.canPlayType("audio/x-m4a;")||u.canPlayType("audio/m4a;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(u.canPlayType("audio/x-m4b;")||u.canPlayType("audio/m4b;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(u.canPlayType("audio/x-mp4;")||u.canPlayType("audio/mp4;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!u.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!u.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!u.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(u.canPlayType("audio/x-flac;")||u.canPlayType("audio/flac;")).replace(/^no$/,"")},c},_unlockAudio:function(){var c=this||e;if(!c._audioUnlocked&&c.ctx){c._audioUnlocked=!1,c.autoUnlock=!1,!c._mobileUnloaded&&44100!==c.ctx.sampleRate&&(c._mobileUnloaded=!0,c.unload()),c._scratchBuffer=c.ctx.createBuffer(1,1,22050);var u=function(f){for(;c._html5AudioPool.length"u"?_.noteOn(0):_.start(0),"function"==typeof c.ctx.resume&&c.ctx.resume(),_.onended=function(){_.disconnect(0),c._audioUnlocked=!0,document.removeEventListener("touchstart",u,!0),document.removeEventListener("touchend",u,!0),document.removeEventListener("click",u,!0),document.removeEventListener("keydown",u,!0);for(var b=0;b"u")&&e.usingWebAudio){for(var u=0;u"u")&&e.usingWebAudio)return"running"===c.state&&"interrupted"!==c.ctx.state&&c._suspendTimer?(clearTimeout(c._suspendTimer),c._suspendTimer=null):"suspended"===c.state||"running"===c.state&&"interrupted"===c.ctx.state?(c.ctx.resume().then(function(){c.state="running";for(var u=0;u"u"&&(c="__default",!f._playLock)){for(var m=0,g=0;g0?x._seek:f._sprite[c][0]/1e3),b=Math.max(0,(f._sprite[c][0]+f._sprite[c][1])/1e3-_),v=1e3*b/Math.abs(x._rate),w=f._sprite[c][0]/1e3,E=(f._sprite[c][0]+f._sprite[c][1])/1e3;x._sprite=c,x._ended=!1;var T=function(){x._paused=!1,x._seek=_,x._start=w,x._stop=E,x._loop=!(!x._loop&&!f._sprite[c][2])};if(!(_>=E)){var A=x._node;if(f._webAudio){var D=function(){f._playLock=!1,T(),f._refreshBuffer(x),A.gain.setValueAtTime(x._muted||f._muted?0:x._volume,e.ctx.currentTime),x._playStart=e.ctx.currentTime,typeof A.bufferSource.start>"u"?A.bufferSource.noteGrainOn(0,_,x._loop?86400:b):A.bufferSource.start(0,_,x._loop?86400:b),v!==1/0&&(f._endTimers[x._id]=setTimeout(f._ended.bind(f,x),v)),u||setTimeout(function(){f._emit("play",x._id),f._loadQueue()},0)};"running"===e.state&&"interrupted"!==e.ctx.state?D():(f._playLock=!0,f.once("resume",D),f._clearTimer(x._id))}else{var C=function(){A.currentTime=_,A.muted=x._muted||f._muted||e._muted||A.muted,A.volume=x._volume*e.volume(),A.playbackRate=x._rate;try{var P=A.play();if(P&&typeof Promise<"u"&&(P instanceof Promise||"function"==typeof P.then)?(f._playLock=!0,T(),P.then(function(){f._playLock=!1,A._unlocked=!0,u?f._loadQueue():f._emit("play",x._id)}).catch(function(){f._playLock=!1,f._emit("playerror",x._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),x._ended=!0,x._paused=!0})):u||(f._playLock=!1,T(),f._emit("play",x._id)),A.playbackRate=x._rate,A.paused)return void f._emit("playerror",x._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==c||x._loop?f._endTimers[x._id]=setTimeout(f._ended.bind(f,x),v):(f._endTimers[x._id]=function(){f._ended(x),A.removeEventListener("ended",f._endTimers[x._id],!1)},A.addEventListener("ended",f._endTimers[x._id],!1))}catch(B){f._emit("playerror",x._id,B)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===A.src&&(A.src=f._src,A.load());var M=window&&window.ejecta||!A.readyState&&e._navigator.isCocoonJS;if(A.readyState>=3||M)C();else{f._playLock=!0,f._state="loading";var I=function(){f._state="loaded",C(),A.removeEventListener(e._canPlayEvent,I,!1)};A.addEventListener(e._canPlayEvent,I,!1),f._clearTimer(x._id)}}return x._id}f._ended(x)},pause:function(c){var u=this;if("loaded"!==u._state||u._playLock)return u._queue.push({event:"pause",action:function(){u.pause(c)}}),u;for(var f=u._getSoundIds(c),p=0;p"u"?m._node.bufferSource.noteOff(0):m._node.bufferSource.stop(0),u._cleanBuffer(m._node)}else(!isNaN(m._node.duration)||m._node.duration===1/0)&&m._node.pause();arguments[1]||u._emit("pause",m?m._id:null)}return u},stop:function(c,u){var f=this;if("loaded"!==f._state||f._playLock)return f._queue.push({event:"stop",action:function(){f.stop(c)}}),f;for(var p=f._getSoundIds(c),m=0;m"u"?g._node.bufferSource.noteOff(0):g._node.bufferSource.stop(0),f._cleanBuffer(g._node)):(!isNaN(g._node.duration)||g._node.duration===1/0)&&(g._node.currentTime=g._start||0,g._node.pause(),g._node.duration===1/0&&f._clearSound(g._node))),u||f._emit("stop",g._id))}return f},mute:function(c,u){var f=this;if("loaded"!==f._state||f._playLock)return f._queue.push({event:"mute",action:function(){f.mute(c,u)}}),f;if(typeof u>"u"){if("boolean"!=typeof c)return f._muted;f._muted=c}for(var p=f._getSoundIds(u),m=0;m"u"?c._getSoundIds().indexOf(u[0])>=0?p=parseInt(u[0],10):f=parseFloat(u[0]):u.length>=2&&(f=parseFloat(u[0]),p=parseInt(u[1],10)),!(typeof f<"u"&&f>=0&&f<=1))return(x=p?c._soundById(p):c._sounds[0])?x._volume:0;if("loaded"!==c._state||c._playLock)return c._queue.push({event:"volume",action:function(){c.volume.apply(c,u)}}),c;typeof p>"u"&&(c._volume=f),p=c._getSoundIds(p);for(var y=0;y"u")}}return m},_startFadeInterval:function(c,u,f,p,m,g){var x=this,y=u,_=f-u,b=Math.abs(_/.01),v=Math.max(4,b>0?p/b:p),w=Date.now();c._fadeTo=f,c._interval=setInterval(function(){var E=(Date.now()-w)/p;w=Date.now(),y+=_*E,y=Math.round(100*y)/100,y=_<0?Math.max(f,y):Math.min(f,y),x._webAudio?c._volume=y:x.volume(y,c._id,!0),g&&(x._volume=y),(fu&&y>=f)&&(clearInterval(c._interval),c._interval=null,c._fadeTo=null,x.volume(f,c._id),x._emit("fade",c._id))},v)},_stopFade:function(c){var u=this,f=u._soundById(c);return f&&f._interval&&(u._webAudio&&f._node.gain.cancelScheduledValues(e.ctx.currentTime),clearInterval(f._interval),f._interval=null,u.volume(f._fadeTo,c),f._fadeTo=null,u._emit("fade",c)),u},loop:function(){var f,p,m,c=this,u=arguments;if(0===u.length)return c._loop;if(1===u.length){if("boolean"!=typeof u[0])return!!(m=c._soundById(parseInt(u[0],10)))&&m._loop;c._loop=f=u[0]}else 2===u.length&&(f=u[0],p=parseInt(u[1],10));for(var g=c._getSoundIds(p),x=0;x=0?p=parseInt(u[0],10):f=parseFloat(u[0]):2===u.length&&(f=parseFloat(u[0]),p=parseInt(u[1],10)),"number"!=typeof f)return(x=c._soundById(p))?x._rate:c._rate;if("loaded"!==c._state||c._playLock)return c._queue.push({event:"rate",action:function(){c.rate.apply(c,u)}}),c;typeof p>"u"&&(c._rate=f),p=c._getSoundIds(p);for(var y=0;y=0?p=parseInt(u[0],10):c._sounds.length&&(p=c._sounds[0]._id,f=parseFloat(u[0])):2===u.length&&(f=parseFloat(u[0]),p=parseInt(u[1],10)),typeof p>"u")return 0;if("number"==typeof f&&("loaded"!==c._state||c._playLock))return c._queue.push({event:"seek",action:function(){c.seek.apply(c,u)}}),c;var x=c._soundById(p);if(x){if(!("number"==typeof f&&f>=0)){if(c._webAudio){var v=c.playing(p)?e.ctx.currentTime-x._playStart:0;return x._seek+((x._rateSeek?x._rateSeek-x._seek:0)+v*Math.abs(x._rate))}return x._node.currentTime}var y=c.playing(p);y&&c.pause(p,!0),x._seek=f,x._ended=!1,c._clearTimer(p),!c._webAudio&&x._node&&!isNaN(x._node.duration)&&(x._node.currentTime=f);var _=function(){y&&c.play(p,!0),c._emit("seek",p)};if(y&&!c._webAudio){var b=function(){c._playLock?setTimeout(b,0):_()};setTimeout(b,0)}else _()}return c},playing:function(c){var u=this;if("number"==typeof c){var f=u._soundById(c);return!!f&&!f._paused}for(var p=0;p=0&&e._howls.splice(p,1);var m=!0;for(f=0;f=0){m=!1;break}return n&&m&&delete n[c._src],e.noAudio=!1,c._state="unloaded",c._sounds=[],c=null,null},on:function(c,u,f,p){return"function"==typeof u&&this["_on"+c].push(p?{id:f,fn:u,once:p}:{id:f,fn:u}),this},off:function(c,u,f){var p=this,m=p["_on"+c],g=0;if("number"==typeof u&&(f=u,u=null),u||f)for(g=0;g=0;g--)(!m[g].id||m[g].id===u||"load"===c)&&(setTimeout(function(x){x.call(this,u,f)}.bind(p,m[g].fn),0),m[g].once&&p.off(c,m[g].fn,m[g].id));return p._loadQueue(c),p},_loadQueue:function(c){var u=this;if(u._queue.length>0){var f=u._queue[0];f.event===c&&(u._queue.shift(),u._loadQueue()),c||f.action()}return u},_ended:function(c){var u=this,f=c._sprite;if(!u._webAudio&&c._node&&!c._node.paused&&!c._node.ended&&c._node.currentTime=0;p--){if(f<=u)return;c._sounds[p]._ended&&(c._webAudio&&c._sounds[p]._node&&c._sounds[p]._node.disconnect(0),c._sounds.splice(p,1),f--)}}},_getSoundIds:function(c){if(typeof c>"u"){for(var f=[],p=0;p=0;if(!c.bufferSource)return this;if(e._scratchBuffer&&c.bufferSource&&(c.bufferSource.onended=null,c.bufferSource.disconnect(0),f))try{c.bufferSource.buffer=e._scratchBuffer}catch{}return c.bufferSource=null,this},_clearSound:function(c){/MSIE |Trident\//.test(e._navigator&&e._navigator.userAgent)||(c.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var i=function(c){this._parent=c,this.init()};i.prototype={init:function(){var c=this,u=c._parent;return c._muted=u._muted,c._loop=u._loop,c._volume=u._volume,c._rate=u._rate,c._seek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++e._counter,u._sounds.push(c),c.create(),c},create:function(){var c=this,u=c._parent,f=e._muted||c._muted||c._parent._muted?0:c._volume;return u._webAudio?(c._node=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),c._node.gain.setValueAtTime(f,e.ctx.currentTime),c._node.paused=!0,c._node.connect(e.masterGain)):e.noAudio||(c._node=e._obtainHtml5Audio(),c._errorFn=c._errorListener.bind(c),c._node.addEventListener("error",c._errorFn,!1),c._loadFn=c._loadListener.bind(c),c._node.addEventListener(e._canPlayEvent,c._loadFn,!1),c._endFn=c._endListener.bind(c),c._node.addEventListener("ended",c._endFn,!1),c._node.src=u._src,c._node.preload=!0===u._preload?"auto":u._preload,c._node.volume=f*e.volume(),c._node.load()),c},reset:function(){var c=this,u=c._parent;return c._muted=u._muted,c._loop=u._loop,c._volume=u._volume,c._rate=u._rate,c._seek=0,c._rateSeek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++e._counter,c},_errorListener:function(){var c=this;c._parent._emit("loaderror",c._id,c._node.error?c._node.error.code:0),c._node.removeEventListener("error",c._errorFn,!1)},_loadListener:function(){var c=this,u=c._parent;u._duration=Math.ceil(10*c._node.duration)/10,0===Object.keys(u._sprite).length&&(u._sprite={__default:[0,1e3*u._duration]}),"loaded"!==u._state&&(u._state="loaded",u._emit("load"),u._loadQueue()),c._node.removeEventListener(e._canPlayEvent,c._loadFn,!1)},_endListener:function(){var c=this,u=c._parent;u._duration===1/0&&(u._duration=Math.ceil(10*c._node.duration)/10,u._sprite.__default[1]===1/0&&(u._sprite.__default[1]=1e3*u._duration),u._ended(c)),c._node.removeEventListener("ended",c._endFn,!1)}};var n={},l=function(c){var u=c._src;if(n[u])return c._duration=n[u].duration,void h(c);if(/^data:[^;]+;base64,/.test(u)){for(var f=atob(u.split(",")[1]),p=new Uint8Array(f.length),m=0;m0?(n[u._src]=m,h(u,m)):f()};typeof Promise<"u"&&1===e.ctx.decodeAudioData.length?e.ctx.decodeAudioData(c).then(p).catch(f):e.ctx.decodeAudioData(c,p,f)},h=function(c,u){u&&!c._duration&&(c._duration=u.duration),0===Object.keys(c._sprite).length&&(c._sprite={__default:[0,1e3*c._duration]}),"loaded"!==c._state&&(c._state="loaded",c._emit("load"),c._loadQueue())},d=function(){if(e.usingWebAudio){try{typeof AudioContext<"u"?e.ctx=new AudioContext:typeof webkitAudioContext<"u"?e.ctx=new webkitAudioContext:e.usingWebAudio=!1}catch{e.usingWebAudio=!1}e.ctx||(e.usingWebAudio=!1);var c=/iP(hone|od|ad)/.test(e._navigator&&e._navigator.platform),u=e._navigator&&e._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=u?parseInt(u[1],10):null;if(c&&f&&f<9){var p=/safari/.test(e._navigator&&e._navigator.userAgent.toLowerCase());e._navigator&&!p&&(e.usingWebAudio=!1)}e.usingWebAudio&&(e.masterGain=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),e.masterGain.gain.setValueAtTime(e._muted?0:e._volume,e.ctx.currentTime),e.masterGain.connect(e.ctx.destination)),e._setup()}};r.Howler=e,r.Howl=s,typeof Dr<"u"?(Dr.HowlerGlobal=t,Dr.Howler=e,Dr.Howl=s,Dr.Sound=i):typeof window<"u"&&(window.HowlerGlobal=t,window.Howler=e,window.Howl=s,window.Sound=i)}(),function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var i=s._howls.length-1;i>=0;i--)s._howls[i].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,i){var n=this;return n.ctx&&n.ctx.listener?"number"!=typeof e?n._pos:(n._pos=[e,s="number"!=typeof s?n._pos[1]:s,i="number"!=typeof i?n._pos[2]:i],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n):n},HowlerGlobal.prototype.orientation=function(e,s,i,n,l,o){var a=this;if(!a.ctx||!a.ctx.listener)return a;var h=a._orientation;return"number"!=typeof e?h:(a._orientation=[e,s="number"!=typeof s?h[1]:s,i="number"!=typeof i?h[2]:i,n="number"!=typeof n?h[3]:n,l="number"!=typeof l?h[4]:l,o="number"!=typeof o?h[5]:o],typeof a.ctx.listener.forwardX<"u"?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(l,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(o,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,s,i,n,l,o),a)},Howl.prototype.init=function(e){return function(s){var i=this;return i._orientation=s.orientation||[1,0,0],i._stereo=s.stereo||null,i._pos=s.pos||null,i._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},i._onstereo=s.onstereo?[{fn:s.onstereo}]:[],i._onpos=s.onpos?[{fn:s.onpos}]:[],i._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"stereo",action:function(){i.stereo(e,s)}}),i;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u"){if("number"!=typeof e)return i._stereo;i._stereo=e,i._pos=[e,0,0]}for(var l=i._getSoundIds(s),o=0;o"u"){if("number"!=typeof e)return l._pos;l._pos=[e,s,i]}for(var o=l._getSoundIds(n),a=0;a"u"){if("number"!=typeof e)return l._orientation;l._orientation=[e,s,i]}for(var o=l._getSoundIds(n),a=0;a"u"&&(i.pannerAttr||(i.pannerAttr={coneInnerAngle:i.coneInnerAngle,coneOuterAngle:i.coneOuterAngle,coneOuterGain:i.coneOuterGain,distanceModel:i.distanceModel,maxDistance:i.maxDistance,refDistance:i.refDistance,rolloffFactor:i.rolloffFactor,panningModel:i.panningModel}),e._pannerAttr={coneInnerAngle:typeof i.pannerAttr.coneInnerAngle<"u"?i.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof i.pannerAttr.coneOuterAngle<"u"?i.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof i.pannerAttr.coneOuterGain<"u"?i.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof i.pannerAttr.distanceModel<"u"?i.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof i.pannerAttr.maxDistance<"u"?i.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof i.pannerAttr.refDistance<"u"?i.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof i.pannerAttr.rolloffFactor<"u"?i.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof i.pannerAttr.panningModel<"u"?i.pannerAttr.panningModel:e._panningModel})}else 2===s.length&&(i=s[0],n=parseInt(s[1],10));for(var o=e._getSoundIds(n),a=0;a$(this,null,function*(){var s,i,n,l,o,a,h,d,c,u,f,p,m,g,x,y,_,b,v,w;const E=[],T={};let A=pt(pt({},r.ticker),r.ticker[t]);const D=Yr.load(A.font);E.push(D);const C={skin:null,segments:null};r.wheel&&(C.segments={},C.skin=Yr.load(r.wheel.base),E.push(C.skin),Object.keys(r.wheel.skins).forEach(B=>{const U=Yr.load(r.wheel.skins[B]);E.push(U),C.segments[B]=U})),e||(null!=(i=null==(s=r.pots[t])?void 0:s.sfx)&&i.intro&&(T.intro=new $i.Howl({src:null==(l=null==(n=r.pots[t])?void 0:n.sfx)?void 0:l.intro}),E.push(new Promise(B=>T.intro.once("load",B)))),null!=(a=null==(o=r.pots[t])?void 0:o.sfx)&&a.particles&&(T.particles=new $i.Howl({src:null==(d=null==(h=r.pots[t])?void 0:h.sfx)?void 0:d.particles}),E.push(new Promise(B=>T.particles.once("load",B)))),null!=(u=null==(c=r.pots[t])?void 0:c.sfx)&&u.tickup_start&&(T.tickup_start=new $i.Howl({src:null==(p=null==(f=r.pots[t])?void 0:f.sfx)?void 0:p.tickup_start}),E.push(new Promise(B=>T.tickup_start.once("load",B)))),null!=(g=null==(m=r.pots[t])?void 0:m.sfx)&&g.tickup_loop&&(T.tickup_loop=new $i.Howl({loop:!0,src:null==(y=null==(x=r.pots[t])?void 0:x.sfx)?void 0:y.tickup_loop}),E.push(new Promise(B=>T.tickup_loop.once("load",B)))),null!=(b=null==(_=r.pots[t])?void 0:_.sfx)&&b.outro&&(T.outro=new $i.Howl({src:null==(w=null==(v=r.pots[t])?void 0:v.sfx)?void 0:w.outro}),E.push(new Promise(B=>T.outro.once("load",B)))));let M=null;r.particles&&r.particles[t]&&(M=Yr.load(r.particles[t].source),E.push(M));const I=Yr.load(A.skin);E.push(I);const P=Yr.load(r.pots[t].source);return E.push(P),yield Promise.all(E),C.segments&&(Object.keys(C.segments).forEach(B=>$(this,null,function*(){return C.segments[B]=yield C.segments[B]})),C.skin=yield C.skin),{wheel:C,particles:M?yield M:null,ticker:yield I,pot:yield P,sfx:T}});var eg={exports:{}};!function(r,t){self,r.exports=function(){var e={55:function(n,l,o){Object.defineProperty(l,"__esModule",{value:!0}),l.setBezierFunction=l.getCubicBezierTransition=void 0;const a=o(188);l.getCubicBezierTransition=(h=.25,d=.25,c=.75,u=.75)=>f=>function(p,m,g,x,y,_){let b=0,v=0,w=0,E=0,T=0,A=0;const D=B=>((b*B+v)*B+w)*B,C=B=>(3*b*B+2*v)*B+w,M=B=>B>=0?B:0-B;return w=3*m,v=3*(x-m)-w,b=1-w-v,A=3*g,T=3*(y-g)-A,E=1-A-T,B=((B,U)=>{let O,k,N,F,L,Y;for(N=B,Y=0;Y<8;Y++){if(F=D(N)-B,M(F)<.005)return N;if(L=C(N),M(L)<1e-6)break;N-=F/L}if(O=0,k=1,N=B,Nk)return k;for(;OF?O=N:k=N,N=.5*(k-O)+O}return N})(p),((E*B+T)*B+A)*B;var B}(f,h,d,c,u),l.setBezierFunction=(h,d,c,u,f)=>{const p=(0,l.getCubicBezierTransition)(d,c,u,f);return p.displayName=h,p.x1=d,p.y1=c,p.x2=u,p.y2=f,a.Tweenable.easing[h]=p}},607:function(n,l,o){var a=this&&this.__createBinding||(Object.create?function(m,g,x,y){void 0===y&&(y=x);var _=Object.getOwnPropertyDescriptor(g,x);_&&!("get"in _?!g.__esModule:_.writable||_.configurable)||(_={enumerable:!0,get:function(){return g[x]}}),Object.defineProperty(m,y,_)}:function(m,g,x,y){void 0===y&&(y=x),m[y]=g[x]}),h=this&&this.__exportStar||function(m,g){for(var x in m)"default"===x||Object.prototype.hasOwnProperty.call(g,x)||a(g,m,x)};Object.defineProperty(l,"__esModule",{value:!0}),l.VERSION=l.standardEasingFunctions=l.setBezierFunction=l.Scene=l.interpolate=l.tween=l.Tweenable=l.shouldScheduleUpdate=l.processTweens=void 0;const d=o(188);Object.defineProperty(l,"processTweens",{enumerable:!0,get:function(){return d.processTweens}}),Object.defineProperty(l,"shouldScheduleUpdate",{enumerable:!0,get:function(){return d.shouldScheduleUpdate}}),Object.defineProperty(l,"Tweenable",{enumerable:!0,get:function(){return d.Tweenable}}),Object.defineProperty(l,"tween",{enumerable:!0,get:function(){return d.tween}});var c=o(166);Object.defineProperty(l,"interpolate",{enumerable:!0,get:function(){return c.interpolate}});var u=o(147);Object.defineProperty(l,"Scene",{enumerable:!0,get:function(){return u.Scene}});var f=o(55);Object.defineProperty(l,"setBezierFunction",{enumerable:!0,get:function(){return f.setBezierFunction}});var p=o(64);Object.defineProperty(l,"standardEasingFunctions",{enumerable:!0,get:function(){return p.standardEasingFunctions}}),h(o(699),l),l.VERSION="3.0.3"},166:function(n,l,o){Object.defineProperty(l,"__esModule",{value:!0}),l.interpolate=void 0;const a=o(188),h=new a.Tweenable,{filters:d}=a.Tweenable;l.interpolate=(c,u,f,p=a.Tweenable.easing.linear,m=0)=>{const g=Object.assign({},c),x=(0,a.composeEasingObject)(c,p);h._filters.length=0,h.setState({}),h._currentState=g,h._originalState=c,h._targetState=u,h._easing=x;for(const _ in d)d[_].doesApply(h)&&h._filters.push(d[_]);h._applyFilter("tweenCreated"),h._applyFilter("beforeTween");const y=(0,a.tweenProps)(f,g,c,u,1,m,x);return h._applyFilter("afterTween"),y}},147:function(n,l){Object.defineProperty(l,"__esModule",{value:!0}),l.Scene=void 0,l.Scene=class{constructor(...o){this._tweenables=[],o.forEach(this.add.bind(this))}get tweenables(){return[...this._tweenables]}get promises(){return this._tweenables.map(o=>o.then())}add(o){return this._tweenables.push(o),o}remove(o){const a=this._tweenables.indexOf(o);return a>-1&&this._tweenables.splice(a,1),o}empty(){return this.tweenables.map(this.remove.bind(this))}get isPlaying(){return this._tweenables.some(({isPlaying:o})=>o)}tween(){return this._tweenables.forEach(o=>o.tween()),this}pause(){return this._tweenables.forEach(o=>o.pause()),this}resume(){return this._tweenables.filter(({hasEnded:o})=>!o).forEach(o=>o.resume()),this}stop(o){return this._tweenables.forEach(a=>a.stop(o)),this}}},64:function(n,l){Object.defineProperty(l,"__esModule",{value:!0}),l.standardEasingFunctions=void 0,l.standardEasingFunctions=Object.freeze({linear:o=>o,easeInQuad:o=>Math.pow(o,2),easeOutQuad:o=>-(Math.pow(o-1,2)-1),easeInOutQuad:o=>(o/=.5)<1?.5*Math.pow(o,2):-.5*((o-=2)*o-2),easeInCubic:o=>Math.pow(o,3),easeOutCubic:o=>Math.pow(o-1,3)+1,easeInOutCubic:o=>(o/=.5)<1?.5*Math.pow(o,3):.5*(Math.pow(o-2,3)+2),easeInQuart:o=>Math.pow(o,4),easeOutQuart:o=>-(Math.pow(o-1,4)-1),easeInOutQuart:o=>(o/=.5)<1?.5*Math.pow(o,4):-.5*((o-=2)*Math.pow(o,3)-2),easeInQuint:o=>Math.pow(o,5),easeOutQuint:o=>Math.pow(o-1,5)+1,easeInOutQuint:o=>(o/=.5)<1?.5*Math.pow(o,5):.5*(Math.pow(o-2,5)+2),easeInSine:o=>1-Math.cos(o*(Math.PI/2)),easeOutSine:o=>Math.sin(o*(Math.PI/2)),easeInOutSine:o=>-.5*(Math.cos(Math.PI*o)-1),easeInExpo:o=>0===o?0:Math.pow(2,10*(o-1)),easeOutExpo:o=>1===o?1:1-Math.pow(2,-10*o),easeInOutExpo:o=>0===o?0:1===o?1:(o/=.5)<1?.5*Math.pow(2,10*(o-1)):.5*(2-Math.pow(2,-10*--o)),easeInCirc:o=>-(Math.sqrt(1-o*o)-1),easeOutCirc:o=>Math.sqrt(1-Math.pow(o-1,2)),easeInOutCirc:o=>(o/=.5)<1?-.5*(Math.sqrt(1-o*o)-1):.5*(Math.sqrt(1-(o-=2)*o)+1),easeOutBounce:o=>o<.36363636363636365?7.5625*o*o:o<.7272727272727273?7.5625*(o-=.5454545454545454)*o+.75:o<.9090909090909091?7.5625*(o-=.8181818181818182)*o+.9375:7.5625*(o-=.9545454545454546)*o+.984375,easeInBack:o=>o*o*(2.70158*o-1.70158),easeOutBack:o=>(o-=1)*o*(2.70158*o+1.70158)+1,easeInOutBack:o=>{let a=1.70158;return(o/=.5)<1?o*o*((1+(a*=1.525))*o-a)*.5:.5*((o-=2)*o*((1+(a*=1.525))*o+a)+2)},elastic:o=>-1*Math.pow(4,-8*o)*Math.sin((6*o-1)*(2*Math.PI)/2)+1,swingFromTo:o=>{let a=1.70158;return(o/=.5)<1?o*o*((1+(a*=1.525))*o-a)*.5:.5*((o-=2)*o*((1+(a*=1.525))*o+a)+2)},swingFrom:o=>o*o*(2.70158*o-1.70158),swingTo:o=>(o-=1)*o*(2.70158*o+1.70158)+1,bounce:o=>o<.36363636363636365?7.5625*o*o:o<.7272727272727273?7.5625*(o-=.5454545454545454)*o+.75:o<.9090909090909091?7.5625*(o-=.8181818181818182)*o+.9375:7.5625*(o-=.9545454545454546)*o+.984375,bouncePast:o=>o<.36363636363636365?7.5625*o*o:o<.7272727272727273?2-(7.5625*(o-=.5454545454545454)*o+.75):o<.9090909090909091?2-(7.5625*(o-=.8181818181818182)*o+.9375):2-(7.5625*(o-=.9545454545454546)*o+.984375),easeFromTo:o=>(o/=.5)<1?.5*Math.pow(o,4):-.5*((o-=2)*Math.pow(o,3)-2),easeFrom:o=>Math.pow(o,4),easeTo:o=>Math.pow(o,.25)})},432:function(n,l,o){Object.defineProperty(l,"__esModule",{value:!0}),l.afterTween=l.beforeTween=l.tweenCreated=l.doesApply=void 0;const a=o(699),h=/(\d|-|\.)/,d=/([^\-0-9.]+)/g,c=/[0-9.-]+/g,u=(()=>{const C=c.source,M=/,\s*/.source;return new RegExp(`rgba?\\(${C}${M}${C}${M}${C}(${M}${C})?\\)`,"g")})(),f=/^.*\(/,p=/#([0-9]|[a-f]){3,6}/gi,m="VAL",g=(C,M)=>C.map((I,P)=>`_${M}_${P}`),x=C=>{let M=C.match(d);return M?(1===M.length||C.charAt(0).match(h))&&M.unshift(""):M=["",""],M.join(m)};function y(C){return parseInt(C,16)}const _=C=>`rgb(${(M=>{if(3===(M=M.replace(/#/,"")).length){const[I,P,B]=M.split("");M=I+I+P+P+B+B}return[y(M.substring(0,2)),y(M.substring(2,4)),y(M.substring(4,6))]})(C).join(",")})`,b=(C,M,I)=>{const P=M.match(C);let B=M.replace(C,m);return P&&P.forEach(U=>B=B.replace(m,I(U))),B},v=C=>{for(const M in C){const I=C[M];"string"==typeof I&&I.match(p)&&(C[M]=b(p,I,_))}},w=C=>{var M,I;const P=null!==(M=C.match(c))&&void 0!==M?M:[],B=P.slice(0,3).map(O=>Math.floor(Number(O))),U=null===(I=C.match(f))||void 0===I?void 0:I[0];if(3===P.length)return`${U}${B.join(",")})`;if(4===P.length)return`${U}${B.join(",")},${P[3]})`;throw new Error(`Invalid rgbChunk: ${C}`)},E=C=>{var M;return null!==(M=C.match(c))&&void 0!==M?M:[]},T=(C,M)=>{const I={};return M.forEach(P=>{I[P]=C[P],delete C[P]}),I},A=(C,M)=>M.map(I=>Number(C[I])),D=(C,M)=>(M.forEach(I=>C=C.replace(m,String(+I.toFixed(4)))),C);l.doesApply=C=>{for(const M in C._currentState)if("string"==typeof C._currentState[M])return!0;return!1},l.tweenCreated=function(C){const{_currentState:M,_originalState:I,_targetState:P}=C;[M,I,P].forEach(v),C._tokenData=(B=>{var U;const O={};for(const k in B){const N=B[k];"string"==typeof N&&(O[k]={formatString:x(N),chunkNames:g(null===(U=E(N))||void 0===U?void 0:U.map(Number),k)})}return O})(M)},l.beforeTween=function(C){const{_currentState:M,_originalState:I,_targetState:P,_easing:B,_tokenData:U}=C;"function"!=typeof B&&U&&((O,k)=>{var N;for(const F in k){const{chunkNames:L}=k[F],Y=O[F];if("string"==typeof Y){const H=Y.split(" "),G=H[H.length-1];for(let z=0;zO[H]=Y);delete O[F]}})(B,U),[M,I,P].forEach(O=>((k,N)=>{for(const F in N)E(String(k[F])).forEach((L,Y)=>k[N[F].chunkNames[Y]]=+L),delete k[F]})(O,U??{}))},l.afterTween=function(C){const{_currentState:M,_originalState:I,_targetState:P,_easing:B,_tokenData:U}=C;[M,I,P].forEach(O=>((k,N)=>{for(const F in N){const{chunkNames:L,formatString:Y}=N[F],H=D(Y,A(T(k,L),L));k[F]=b(u,H,w)}})(O,U??{})),"function"!=typeof B&&U&&((O,k)=>{for(const N in k){const{chunkNames:F}=k[N],L=O[F[0]];O[N]="string"==typeof L?F.map(Y=>{const H=O[Y];return delete O[Y],H}).join(" "):L}})(B,U)}},188:function(n,l,o){var a,h=this&&this.__createBinding||(Object.create?function(O,k,N,F){void 0===F&&(F=N);var L=Object.getOwnPropertyDescriptor(k,N);L&&!("get"in L?!k.__esModule:L.writable||L.configurable)||(L={enumerable:!0,get:function(){return k[N]}}),Object.defineProperty(O,F,L)}:function(O,k,N,F){void 0===F&&(F=N),O[F]=k[N]}),d=this&&this.__setModuleDefault||(Object.create?function(O,k){Object.defineProperty(O,"default",{enumerable:!0,value:k})}:function(O,k){O.default=k}),c=this&&this.__importStar||function(O){if(O&&O.__esModule)return O;var k={};if(null!=O)for(var N in O)"default"!==N&&Object.prototype.hasOwnProperty.call(O,N)&&h(k,O,N);return d(k,O),k};Object.defineProperty(l,"__esModule",{value:!0}),l.shouldScheduleUpdate=l.tween=l.Tweenable=l.composeEasingObject=l.scheduleUpdate=l.processTweens=l.tweenProps=l.getListTail=l.getListHead=l.resetList=void 0;const u=o(64),f=o(55),p=o(699),m=c(o(432)),g="linear",x=typeof window<"u"?window:o.g,y="afterTween",_="beforeTween",b="string",v="function";let w=x.requestAnimationFrame;w||(w=typeof window>"u"?setTimeout:window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||window.mozCancelRequestAnimationFrame&&window.mozRequestAnimationFrame||setTimeout);const E=()=>{};let T=null,A=null;l.resetList=()=>{T=A=null},l.getListHead=()=>T,l.getListTail=()=>A,l.tweenProps=(O,k,N,F,L,Y,H)=>{var G;let z,K=0;const lt=O{var N;let F=null!==(N=O._timestamp)&&void 0!==N?N:0;const L=O._currentState,Y=O._delay;if(kz?z:k;O._hasEnded=K>=z;const lt=H-(z-K);if(O._hasEnded)return O._render(G,lt,O._data),O.stop(!0);O._applyFilter(_),K{let O;const k=U.now();let N=T;for(;N;)O=N._next,D(N,k),N=O};const{now:C}=Date;let M,I=!1;l.scheduleUpdate=()=>{M=C(),I&&w.call(x,l.scheduleUpdate,16.666666666666668),(0,l.processTweens)()},l.composeEasingObject=(O,k=g,N={})=>{if(typeof k===b&&(0,p.isEasingKey)(k))return U.easing[k];if(Array.isArray(k))return(0,f.getCubicBezierTransition)(...k);if("object"==typeof N)if(typeof k===b||typeof k===v)for(const F in O)N[F]=k;else for(const F in O)N[F]=k[F]||g;return N};const P=(()=>{let O,k;return N=>{O=null,k=null,N===T?(T=N._next,T?T._previous=null:A=null):N===A?(A=N._previous,A?A._next=null:T=null):(O=N._previous,k=N._next,O&&(O._next=k),k&&(k._previous=O)),N._previous=N._next=null}})(),B=typeof Promise===v?Promise:null;class U{constructor(k={},N){this[a]="Promise",this._next=null,this._previous=null,this._config={},this._data={},this._delay=0,this._duration=500,this._filters=[],this._timestamp=null,this._hasEnded=!1,this._resolve=null,this._reject=null,this._originalState={},this._targetState={},this._start=E,this._render=E,this._promiseCtor=B,this._promise=null,this._isPlaying=!1,this._pausedAtTime=null,this._easing={},this._currentState=k||{},N&&this.setConfig(N)}_applyFilter(k){var N;for(let F=this._filters.length;F>0;F--){const L=this._filters[F-F];null===(N=L[k])||void 0===N||N.call(L,this)}}tween(k){return this._isPlaying&&this.stop(),!k&&this._config||this.setConfig(k),this._pausedAtTime=null,this._timestamp=U.now(),this._start(this.state,this._data),this._delay&&this._render(this._currentState,0,this._data),this._resume(this._timestamp)}setConfig(k={}){var N;const{_config:F}=this;let L;for(L in k)F[L]=k[L];const{promise:Y=this._promiseCtor,start:H=E,finish:G,render:z=E}=F;this._data=F.data||this._data,this._isPlaying=!1,this._pausedAtTime=null,this._delay=k.delay||0,this._start=H,this._render=z,this._duration=F.duration||500,this._promiseCtor=Y,G&&(this._resolve=G);const{from:K,to:lt={}}=k,{_currentState:ht,_originalState:ft,_targetState:yt}=this;for(const ct in K)ht[ct]=K[ct];let at=!1;for(const ct in ht){const Mt=ht[ct];at||typeof Mt!==b||(at=!0),ft[ct]=Mt,yt[ct]=null!==(N=lt[ct])&&void 0!==N?N:Mt}if(this._easing=(0,l.composeEasingObject)(this._currentState,F.easing,this._easing),this._filters.length=0,at){for(const ct in U.filters)U.filters[ct].doesApply(this)&&this._filters.push(U.filters[ct]);this._applyFilter("tweenCreated")}return this}then(k,N){if(!this._promiseCtor)throw new Error("Promise implementation is unavailable");return this._promise=new this._promiseCtor((F,L)=>{this._resolve=F,this._reject=L}),this._promise.then(k,N)}catch(k){return this.then().catch(k)}finally(k){return this.then().finally(k)}get state(){return Object.assign({},this._currentState)}setState(k){this._currentState=k}pause(){return this._isPlaying?(this._pausedAtTime=U.now(),this._isPlaying=!1,P(this),this):this}resume(){return this._resume()}_resume(k=U.now()){return null===this._timestamp?this.tween():(this._isPlaying&&this._promise||(this._pausedAtTime&&(this._timestamp+=k-this._pausedAtTime,this._pausedAtTime=null),this._isPlaying=!0,null===T?(T=this,A=this):(this._previous=A,A&&(A._next=this),A=this)),this)}seek(k){var N;k=Math.max(k,0);const F=U.now();return(null!==(N=this._timestamp)&&void 0!==N?N:0)+k===0||(this._timestamp=F-k,D(this,F)),this}stop(k=!1){var N;return this._isPlaying?(this._isPlaying=!1,P(this),k&&(this._applyFilter(_),(0,l.tweenProps)(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),this._applyFilter(y),this._applyFilter("afterTweenEnd")),null===(N=this._resolve)||void 0===N||N.call(this,{data:this._data,state:this._currentState,tweenable:this}),this._resolve=null,this._reject=null,this):this}cancel(k=!1){var N;const{_currentState:F,_data:L,_isPlaying:Y}=this;return Y?(null===(N=this._reject)||void 0===N||N.call(this,{data:L,state:F,tweenable:this}),this._resolve=null,this._reject=null,this.stop(k)):this}get isPlaying(){return this._isPlaying}get hasEnded(){return this._hasEnded}data(k=null){return k&&(this._data=Object.assign({},k)),this._data}dispose(){for(const k in this)delete this[k]}}l.Tweenable=U,a=Symbol.toStringTag,U.now=()=>M,U.setScheduleFunction=O=>w=O,U.filters={token:m},U.easing=Object.create(u.standardEasingFunctions),l.tween=function(O={}){return new U({},{}).tween(O)},l.shouldScheduleUpdate=O=>{O&&I||(I=O,O&&(0,l.scheduleUpdate)())},(0,l.shouldScheduleUpdate)(!0)},699:function(n,l,o){Object.defineProperty(l,"__esModule",{value:!0}),l.isEasingKey=void 0;const a=o(188);l.isEasingKey=h=>h in a.Tweenable.easing}},s={};function i(n){var l=s[n];if(void 0!==l)return l.exports;var o=s[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch{if("object"==typeof window)return window}}(),i(607)}()}(eg);var Zc=eg.exports;const rg=(r,t)=>{const e=parseInt(r);return isNaN(e)?t:e},wE=(r,t,e,s)=>$(this,null,function*(){const i=e.wheel.segments.length,n=e.wheel.segments.indexOf(s);r.angle=e.wheel.rotate||0;const o=e.wheel.segments.map(h=>$(this,null,function*(){return yield t[h]}));let a=n;r.hackTextureBySlotName("Seg_placeholder_01_win",yield o[n]),r.hackTextureBySlotName("Seg_placeholder_02",yield o[++a%i]),r.hackTextureBySlotName("Seg_placeholder_03",yield o[++a%i]),r.hackTextureBySlotName("Seg_placeholder_04",yield o[++a%i]),r.hackTextureBySlotName("Seg_placeholder_05",yield o[++a%i]),r.hackTextureBySlotName("Seg_placeholder_06",yield o[++a%i]),r.hackTextureBySlotName("Seg_placeholder_07",yield o[++a%i]),r.hackTextureBySlotName("Seg_placeholder_08",yield o[++a%i]),r.autoUpdate=!0,r.state.timeScale=1}),ms=(r,t,e=1)=>new Promise((s,i)=>{let n=0;!1===r.state.hasAnimation(t)&&i(`player.play() -> no such animation: ${t}`),r.state.addListener({complete:()=>{n++,!(-1===e||e>n)&&(r.state.clearListeners(),s())}}),r.state.setAnimation(0,t,1!=e)});function Kc(r,t=500){return $(this,null,function*(){const e=new rp(1);r.filters=[e];let s=r.scale.x;return Zc.tween({easing:"easeIn",duration:3*t,from:{a:s},to:{a:10*s},render:({a:i})=>{r.scale.x=i,r.scale.y=i}}),Zc.tween({easing:"easeInOutQuad",duration:t,from:{a:1},to:{a:0},render:({a:i})=>{e.alpha=i}})})}let Qc=!1,Jc=!1,tu=null;const TE=r=>$(this,null,function*(){for(Qc=!1,Jc=!1,tu=r,yield ms(r,"intro");!1===Qc;)yield ms(r,"loop");Jc||(yield ms(r,"win",1)),yield Kc(r)}),eu="wheel-spinning",ru="wheel-stopping",su="money-ticking",iu="anim-looping",Eo="anim-booting";let zi=null,Bn=null,Ao=null,Zr=null,Ke=null,qi=Eo,To=[];const So=r=>{Bn&&(Bn.textContent=r)},Io=r=>{Zr&&(Zr.textContent=r)},Zi=r=>{(r=>{Zr&&(Zr.className=r)})(r),(r=>{zi&&(zi.className=r)})(r)},Qe_build=(r,t)=>$(this,null,function*(){var e,s,i,n,l,o,a,h,d,c,u,f,p;Ke=r;const m=(_,b)=>{var v,w,E,T,A,D,C,M,I,P;b.stopPropagation(),("button"!==_||(qi!==eu||null!=(E=null==(w=null==(v=r?.dom)?void 0:v.touch)?void 0:w.wheel)&&E.stop)&&(qi!==ru||null!=(D=null==(A=null==(T=r?.dom)?void 0:T.touch)?void 0:A.wheel)&&D.skip)&&(qi!==su||null!=(M=null==(C=r?.dom)?void 0:C.touch)&&M.tickup)&&(qi!==iu||null!=(P=null==(I=r?.dom)?void 0:I.touch)&&P.close))&&(Zi("stop-clicked"),t())},g=document.querySelector("#jackpot-app"),x=document.createElement("div");x.setAttribute("id","main-container");const y=document.createElement("canvas");if(y.setAttribute("id","animations"),x.appendChild(y),null!=(e=r?.dom)&&e.top){zi=document.createElement("div");let _=(null==(i=null==(s=r?.dom)?void 0:s.top)?void 0:i.id)||"top-container";zi.setAttribute("id",_);let b=(null==(o=null==(l=null==(n=r?.dom)?void 0:n.top)?void 0:l.message)?void 0:o.id)||"top-message";Bn=document.createElement("div"),Bn.setAttribute("id",b),g.appendChild(zi),zi.appendChild(Bn)}if(g.appendChild(x),null!=(a=r?.dom)&&a.bottom){Ao=document.createElement("div");let _=(null==(d=null==(h=r?.dom)?void 0:h.bottom)?void 0:d.id)||"bottom-container";Ao.setAttribute("id",_),g.appendChild(Ao);let b=(null==(f=null==(u=null==(c=r?.dom)?void 0:c.bottom)?void 0:u.button)?void 0:f.id)||"action-button";Zr=document.createElement("button"),Zr.setAttribute("id",b),Zr.setAttribute("class","stop-clicked"),Ao.appendChild(Zr);const v=m.bind(null,"button");Zr.addEventListener("pointerup",v),To.push(()=>{Zr.removeEventListener("pointerup",v)})}if(null!=(p=r?.dom)&&p.touch){const _=m.bind(null,"button");g.addEventListener("pointerup",_),To.push(()=>{g.removeEventListener("pointerup",_)})}}),Qe_teardown=()=>$(this,null,function*(){To.forEach(r=>r()),document.querySelector("#jackpot-app").innerHTML="",To=[],qi=Eo}),Qe_setPhase=r=>$(this,null,function*(){var t,e,s,i,n,l,o,a,h,d,c,u,f,p,m,g,x,y,_,b,v,w;qi=r,r===Eo&&Zi("stop-clicked"),r===eu&&(Zi(""),So(null==(s=null==(e=null==(t=Ke?.dom)?void 0:t.top)?void 0:e.message)?void 0:s.wheel),Io(null==(o=null==(l=null==(n=null==(i=Ke?.dom)?void 0:i.bottom)?void 0:n.button)?void 0:l.wheel)?void 0:o.stop)),r===ru&&(Zi(""),So(""),Io(null==(c=null==(d=null==(h=null==(a=Ke?.dom)?void 0:a.bottom)?void 0:h.button)?void 0:d.wheel)?void 0:c.skip)),r===su&&(Zi(""),So(null==(p=null==(f=null==(u=Ke?.dom)?void 0:u.top)?void 0:f.message)?void 0:p.tickup),Io(null==(y=null==(x=null==(g=null==(m=Ke?.dom)?void 0:m.bottom)?void 0:g.button)?void 0:x.tickup)?void 0:y.skip)),r===iu&&(Zi(""),So(""),Io(null==(w=null==(v=null==(b=null==(_=Ke?.dom)?void 0:_.bottom)?void 0:b.button)?void 0:v.end)?void 0:w.close))}),Qe_PHASES_PHASE_SPINNING=eu,Qe_PHASES_PHASE_STOPPING=ru,Qe_PHASES_PHASE_TICKING=su,Qe_PHASES_PHASE_LOOPING=iu,Qe_PHASES_PHASE_START=Eo,nu=r=>new Promise(t=>setTimeout(t,r));let ig=null,gs=null,Ro={};const ng=(r,t="",e=!1)=>$(this,null,function*(){ig=yield fetch(r),gs=yield ig.json(),Ro[r+t+e]=yield bE(gs,t,e)});bt.preload=ng,bt.run=(r,t="epic",e=1e3,s=!1)=>$(this,null,function*(){null!=Ro&&Ro[r+t+s]||(yield ng(r,t,s));const i=gs.particles&&gs.particles[t].prefix||"",n=gs.pots[t].prefix||"",{particles:l,pot:o,ticker:a,wheel:h,sfx:d}=Ro[r+t+s];let c=null;if(Qe_build(gs,()=>{c&&c()}),(()=>{const r=document.querySelector("#jackpot-app #main-container"),t=document.querySelector("#jackpot-app #animations");Xe=new hp({view:t,resizeTo:r,backgroundAlpha:0,antialias:!0,resolution:tg,autoDensity:!0}),Xe.ticker.maxFPS=60})(),gs.wheel){c=()=>{Qc=!0,c=()=>{(()=>{Jc=!0,tu.state.setAnimation(0,"win",!1);const r=tu.state.tracks[0];r.trackTime=r.trackEnd})()},Qe_setPhase(Qe_PHASES_PHASE_STOPPING)},Qe_setPhase(Qe_PHASES_PHASE_SPINNING);const v=new wo(h.skin.spineData);Xe.stage.addChild(v),qc(),yield wE(v,h.segments,gs,t),yield TE(v),Xe.stage.removeChild(v)}else Qe_setPhase(Qe_PHASES_PHASE_START);const f=new Ae;f.scale.x=.5,f.scale.y=.5,Xe.stage.addChild(f);let p=null;l&&(p=new wo(l.spineData),f.addChild(p));const m=new wo(o.spineData);f.addChild(m),qc(),d.intro&&d.intro.play(),yield nu(500),yield ms(m,n+"intro"),ms(m,n+"loop",-1);const g=new wo(a.spineData);f.addChildAt(g,0);let x=g.slotContainers[g.skeleton.findSlotIndex("win_backdrop")];d.tickup_start&&d.tickup_start.play(),ms(g,"intro");const{tweenable:y,tween:_}=((r,t,e,s)=>{const i=pt(pt({},r.ticker),r.ticker[s]),n=new Intl.NumberFormat(i.currencyFormat,{style:"currency",currency:i.currency||"EUR"}),l=i.currency,o=x=>l?n.format(x):Math.round(x),a=new Zc.Tweenable,h=4*t.width/5,d=rg(i.maxFontSize,120),c=rg(i.duration,5e3);if(d<=0)throw new Error(`Invalid maxFontSize value in config! Value: ${d}`);if(c<=0)throw new Error(`Invalid tickup duration value in config! Value: ${c}`);const u=o(e),f=parseInt(h/u.length)+10;let p=Math.min(d,f);const m=new wh("0",{fontFamily:i.fontFamily,fontSize:p,fill:"white",align:"left"});for(m.text=u,m.transform.scale.y=-1;m.width>h;)p-=Math.max(parseInt(p/5),5),m.style.fontSize=p;t.addChild(m);const g=a.tween({from:{value:0},to:{value:e},duration:c,easeing:"easeOutQuad",render:({value:x})=>{m.text=o(x),m.position.set(-m.width/2,m.height/2)}}).then(()=>{m.text=o(e),m.position.set(-m.width/2,m.height/2)});return{tweenable:a,tween:g}})(gs,x,e,t);c=()=>{y.stop(!0)};let b=!1;for(d.tickup_loop&&d.tickup_loop.play(),_.then(()=>{d.tickup_loop&&d.tickup_loop.fade(1,0,100),Qe_setPhase(Qe_PHASES_PHASE_LOOPING),p&&(d.particles&&d.particles.play(),ms(p,i+"loop").then(()=>f.removeChild(p))),ms(g,"end"),c=()=>$(this,null,function*(){c=null,d.outro&&d.outro.play(),yield nu(400),yield Kc(g,200),yield Kc(m,200),yield Qe_teardown(),b=!0})}),p&&(d.particles&&d.particles.play(),ms(p,"loop")),Qe_setPhase(Qe_PHASES_PHASE_TICKING);!b;)yield nu(100)}),bt.stop=()=>$(this,null,function*(){yield Qe_teardown()}),Object.defineProperty(bt,Symbol.toStringTag,{value:"Module"})});