1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[242],{2236:function(t,e,i){i.d(e,{Z:function(){return tt}});var r,s,n,a=[],o="ResizeObserver loop completed with undelivered notifications.",h=function(){var t;"function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:o}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=o),window.dispatchEvent(t)};(n=r||(r={})).BORDER_BOX="border-box",n.CONTENT_BOX="content-box",n.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box";var l=function(t){return Object.freeze(t)},u=function(t,e){this.inlineSize=t,this.blockSize=e,l(this)},d=function(){function t(t,e,i,r){return this.x=t,this.y=e,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,l(this)}return t.prototype.toJSON=function(){var t,e=this.x,i=this.y,r=this.top,s=this.right,n=this.bottom,a=this.left;return{x:e,y:i,top:r,right:s,bottom:n,left:a,width:this.width,height:this.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),c=function(t){return t instanceof SVGElement&&"getBBox"in t},f=function(t){if(c(t)){var e=t.getBBox(),i=e.width,r=e.height;return!i&&!r}var s=t.offsetWidth,n=t.offsetHeight;return!(s||n||t.getClientRects().length)},p=function(t){if(t instanceof Element)return!0;var e,i=null===(e=null==t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},m=function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},g="undefined"!=typeof window?window:{},_=new WeakMap,v=/auto|scroll/,x=/^tb|vertical/,y=/msie|trident/i.test(g.navigator&&g.navigator.userAgent),b=function(t){return parseFloat(t||"0")},E=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),new u((i?e:t)||0,(i?t:e)||0)},T=l({devicePixelContentBoxSize:E(),borderBoxSize:E(),contentBoxSize:E(),contentRect:new d(0,0,0,0)}),A=function(t,e){if(void 0===e&&(e=!1),_.has(t)&&!e)return _.get(t);if(f(t))return _.set(t,T),T;var i=getComputedStyle(t),r=c(t)&&t.ownerSVGElement&&t.getBBox(),s=!y&&"border-box"===i.boxSizing,n=x.test(i.writingMode||""),a=!r&&v.test(i.overflowY||""),o=!r&&v.test(i.overflowX||""),h=r?0:b(i.paddingTop),u=r?0:b(i.paddingRight),p=r?0:b(i.paddingBottom),m=r?0:b(i.paddingLeft),g=r?0:b(i.borderTopWidth),A=r?0:b(i.borderRightWidth),S=r?0:b(i.borderBottomWidth),w=r?0:b(i.borderLeftWidth),R=m+u,I=h+p,C=w+A,M=g+S,P=o?t.offsetHeight-M-t.clientHeight:0,D=a?t.offsetWidth-C-t.clientWidth:0,B=r?r.width:b(i.width)-(s?R+C:0)-D,N=r?r.height:b(i.height)-(s?I+M:0)-P,O=l({devicePixelContentBoxSize:E(Math.round(B*devicePixelRatio),Math.round(N*devicePixelRatio),n),borderBoxSize:E(B+R+D+C,N+I+P+M,n),contentBoxSize:E(B,N,n),contentRect:new d(m,h,B,N)});return _.set(t,O),O},S=function(t,e,i){var s=A(t,i),n=s.borderBoxSize,a=s.contentBoxSize,o=s.devicePixelContentBoxSize;switch(e){case r.DEVICE_PIXEL_CONTENT_BOX:return o;case r.BORDER_BOX:return n;default:return a}},w=function(t){var e=A(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=l([e.borderBoxSize]),this.contentBoxSize=l([e.contentBoxSize]),this.devicePixelContentBoxSize=l([e.devicePixelContentBoxSize])},R=function(t){if(f(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},I=function(){var t=1/0,e=[];a.forEach(function(i){if(0!==i.activeTargets.length){var r=[];i.activeTargets.forEach(function(e){var i=new w(e.target),s=R(e.target);r.push(i),e.lastReportedSize=S(e.target,e.observedBox),s<t&&(t=s)}),e.push(function(){i.callback.call(i.observer,r,i.observer)}),i.activeTargets.splice(0,i.activeTargets.length)}});for(var i=0;i<e.length;i++)(0,e[i])();return t},C=function(t){a.forEach(function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach(function(i){i.isActive()&&(R(i.target)>t?e.activeTargets.push(i):e.skippedTargets.push(i))})})},M=function(){var t=0;for(C(t);a.some(function(t){return t.activeTargets.length>0});)t=I(),C(t);return a.some(function(t){return t.skippedTargets.length>0})&&h(),t>0},P=[],D=function(t){if(!s){var e=0,i=document.createTextNode("");
1new MutationObserver(function(){return P.splice(0).forEach(function(t){return t()})}).observe(i,{characterData:!0}),s=function(){i.textContent="".concat(e?e--:e++)}}P.push(t),s()},B=function(t){D(function(){requestAnimationFrame(t)})},N=0,O={attributes:!0,characterData:!0,childList:!0,subtree:!0},L=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],F=function(t){return void 0===t&&(t=0),Date.now()+t},k=!1,U=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!k){k=!0;var i=F(t);B(function(){var r=!1;try{r=M()}finally{if(k=!1,t=i-F(),!N)return;r?e.run(1e3):t>0?e.run(t):e.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,O)};document.body?e():g.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),L.forEach(function(e){return g.addEventListener(e,t.listener,!0)}))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),L.forEach(function(e){return g.removeEventListener(e,t.listener,!0)}),this.stopped=!0)},t}()),G=function(t){!N&&t>0&&U.start(),(N+=t)||U.stop()},H=function(){function t(t,e){this.target=t,this.observedBox=e||r.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=S(this.target,this.observedBox,!0);return!c(t=this.target)&&!m(t)&&"inline"===getComputedStyle(t).display&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),X=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},z=new WeakMap,V=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return -1},W=function(){function t(){}return t.connect=function(t,e){var i=new X(t,e);z.set(t,i)},t.observe=function(t,e,i){var r=z.get(t),s=0===r.observationTargets.length;0>V(r.observationTargets,e)&&(s&&a.push(r),r.observationTargets.push(new H(e,i&&i.box)),G(1),U.schedule())},t.unobserve=function(t,e){var i=z.get(t),r=V(i.observationTargets,e),s=1===i.observationTargets.length;r>=0&&(s&&a.splice(a.indexOf(i),1),i.observationTargets.splice(r,1),G(-1))},t.disconnect=function(t){var e=this,i=z.get(t);i.observationTargets.slice().forEach(function(i){return e.unobserve(t,i.target)}),i.activeTargets.splice(0,i.activeTargets.length)},t}(),j=function(){function t(t){if(0===arguments.length)throw TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");W.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!p(t))throw TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");W.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!p(t))throw TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");W.unobserve(this,t)},t.prototype.disconnect=function(){W.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),Y=i(7294);let $=Y["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"],q=t=>{let e=Y.useRef(t);return Y.useEffect(()=>{e.current=t}),e},K="undefined"!=typeof window&&"ResizeObserver"in window?window.ResizeObserver:j;function Z(){}let Q,J=()=>Q||(Q=function(){let t=!1,e=[],i=new Map,r=new K((r,s)=>{e=e.concat(r),t||window.requestAnimationFrame(function(){let r=new Set;for(let n=0;n<e.length;n++){if(r.has(e[n].target))continue;r.add(e[n].target);let a=i.get(e[n].target);null==a||a.forEach(t=>t(e[n],s))}e=[],t=!1}),t=!0});return{observer:r,subscribe(t,e){var s;r.observe(t);let n=null!==(s=i.get(t))&&void 0!==s?s:[];n.push(e),i.set(t,n)},unsubscribe(t,e){var s;let n=null!==(s=i.get(t))&&void 0!==s?s:[];if(1===n.length){r.unobserve(t),i.delete(t);return}let a=n.indexOf(e);-1!==a&&n.splice(a,1),i.set(t,n)}}}());var tt=function(t,e){let i=J(),r=q(e);return $(()=>{let e=!1,s=t&&"current"in t?t.current:t;if(!s)return Z;function n(t,i){e||r.current(t,i)}return i.subscribe(s,n),()=>{e=!0,i.unsubscribe(s,n)}},[t,i,r]),i.observer}}
1,6010:function(t,e,i){function r(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t){if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(i=r(t[e]))&&(s&&(s+=" "),s+=i);else for(e in t)t[e]&&(s&&(s+=" "),s+=e)}return s}function s(){for(var t,e,i=0,s="";i<arguments.length;)(t=arguments[i++])&&(e=r(t))&&(s&&(s+=" "),s+=e);return s}i.r(e),i.d(e,{clsx:function(){return s}}),e.default=s},9187:function(t){function e(t,e,r){r=r||2;var n,a,o,h,d,c,p,m=e&&e.length,g=m?e[0]*r:t.length,_=i(t,0,g,r,!0),v=[];if(!_||_.next===_.prev)return v;if(m&&(_=function(t,e,r,s){var n,a,o,h,d,c=[];for(n=0,a=e.length;n<a;n++)o=e[n]*s,h=n<a-1?e[n+1]*s:t.length,(d=i(t,o,h,s,!1))===d.next&&(d.steiner=!0),c.push(f(d));for(c.sort(l),n=0;n<c.length;n++)r=u(c[n],r);return r}(t,e,_,r)),t.length>80*r){n=o=t[0],a=h=t[1];for(var x=r;x<g;x+=r)d=t[x],c=t[x+1],d<n&&(n=d),c<a&&(a=c),d>o&&(o=d),c>h&&(h=c);p=0!==(p=Math.max(o-n,h-a))?32767/p:0}return s(_,v,r,n,a,p,0),v}function i(t,e,i,r,s){var n,a;if(s===w(t,e,i,r)>0)for(n=e;n<i;n+=r)a=T(n,t[n],t[n+1],a);else for(n=i-r;n>=e;n-=r)a=T(n,t[n],t[n+1],a);return a&&_(a,a.next)&&(A(a),a=a.next),a}function r(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(_(r,r.next)||0===g(r.prev,r,r.next))){if(A(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function s(t,e,i,l,u,d,f){if(t){!f&&d&&function(t,e,i,r){var s=t;do 0===s.z&&(s.z=c(s.x,s.y,e,i,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,r,s,n,a,o,h,l=1;do{for(i=t,t=null,n=null,a=0;i;){for(a++,r=i,o=0,e=0;e<l&&(o++,r=r.nextZ);e++);for(h=l;o>0||h>0&&r;)0!==o&&(0===h||!r||i.z<=r.z)?(s=i,i=i.nextZ,o--):(s=r,r=r.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;i=r}n.nextZ=null,l*=2}while(a>1)}(s)}(t,l,u,d);for(var p,m,g=t;t.prev!==t.next;){if(p=t.prev,m=t.next,d?a(t,l,u,d):n(t)){e.push(p.i/i|0),e.push(t.i/i|0),e.push(m.i/i|0),A(t),t=m.next,g=m.next;continue}if((t=m)===g){f?1===f?s(t=o(r(t),e,i),e,i,l,u,d,2):2===f&&h(t,e,i,l,u,d):s(r(t),e,i,l,u,d,1);break}}}}function n(t){var e=t.prev,i=t.next;if(g(e,t,i)>=0)return!1;for(var r=e.x,s=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=r<s?r<n?r:n:s<n?s:n,u=a<o?a<h?a:h:o<h?o:h,d=r>s?r>n?r:n:s>n?s:n,c=a>o?a>h?a:h:o>h?o:h,f=i.next;f!==e;){if(f.x>=l&&f.x<=d&&f.y>=u&&f.y<=c&&p(r,a,s,o,n,h,f.x,f.y)&&g(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function a(t,e,i,r){var s=t.prev,n=t.next;if(g(s,t,n)>=0)return!1;for(var a=s.x,o=t.x,h=n.x,l=s.y,u=t.y,d=n.y,f=a<o?a<h?a:h:o<h?o:h,m=l<u?l<d?l:d:u<d?u:d,_=a>o?a>h?a:h:o>h?o:h,v=l>u?l>d?l:d:u>d?u:d,x=c(f,m,e,i,r),y=c(_,v,e,i,r),b=t.prevZ,E=t.nextZ;b&&b.z>=x&&E&&E.z<=y;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=v&&b!==s&&b!==n&&p(a,l,o,u,h,d,b.x,b.y)&&g(b.prev,b,b.next)>=0||(b=b.prevZ,E.x>=f&&E.x<=_&&E.y>=m&&E.y<=v&&E!==s&&E!==n&&p(a,l,o,u,h,d,E.x,E.y)&&g(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;b&&b.z>=x;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=v&&b!==s&&b!==n&&p(a,l,o,u,h,d,b.x,b.y)&&g(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;E&&E.z<=y;){if(E.x>=f&&E.x<=_&&E.y>=m&&E.y<=v&&E!==s&&E!==n&&p(a,l,o,u,h,d,E.x,E.y)&&g(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function o(t,e,i){var s=t;do{var n=s.prev,a=s.next.next;!_(n,a)&&v(n,s,s.next,a)&&b(n,a)&&b(a,n)&&(e.push(n.i/i|0),e.push(s.i/i|0),e.push(a.i/i|0),A(s),A(s.next),s=t=a),s=s.next}while(s!==t);return r(s)}function h(t,e,i,n,a,o){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&m(h,l)){var u=E(h,l);h=r(h,h.next),u=r(u,u.next),s(h,e,i,n,a,o,0),s(u,e,i,n,a,o,0);return}l=l.next}h=h.next}while(h!==t)}function l(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,r=e,s=t.x,n=t.y,a=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var o=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y
1);if(o<=s&&o>a&&(a=o,i=r.x<r.next.x?r:r.next,o===s))return i}r=r.next}while(r!==e);if(!i)return null;var h,l=i,u=i.x,c=i.y,f=1/0;r=i;do s>=r.x&&r.x>=u&&s!==r.x&&p(n<c?s:a,n,u,c,n<c?a:s,n,r.x,r.y)&&(h=Math.abs(n-r.y)/(s-r.x),b(r,t)&&(h<f||h===f&&(r.x>i.x||r.x===i.x&&d(i,r)))&&(i=r,f=h)),r=r.next;while(r!==l);return i}(t,e);if(!i)return e;var s=E(i,t);return r(s,s.next),r(i,i.next)}function d(t,e){return 0>g(t.prev,t,e.prev)&&0>g(e.next,t,t.next)}function c(t,e,i,r,s){return(t=((t=((t=((t=((t=(t-i)*s|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=(e-r)*s|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function f(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function p(t,e,i,r,s,n,a,o){return(s-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(r-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(s-a)*(r-o)}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&v(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var i=t,r=!1,s=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&s<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(t,e)&&(g(t.prev,t,e.prev)||g(t,e.prev,e))||_(t,e)&&g(t.prev,t,t.next)>0&&g(e.prev,e,e.next)>0)}function g(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function _(t,e){return t.x===e.x&&t.y===e.y}function v(t,e,i,r){var s=y(g(t,e,i)),n=y(g(t,e,r)),a=y(g(i,r,t)),o=y(g(i,r,e));return!!(s!==n&&a!==o||0===s&&x(t,i,e)||0===n&&x(t,r,e)||0===a&&x(i,t,r)||0===o&&x(i,e,r))}function x(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function y(t){return t>0?1:t<0?-1:0}function b(t,e){return 0>g(t.prev,t,t.next)?g(t,e,t.next)>=0&&g(t,t.prev,e)>=0:0>g(t,e,t.prev)||0>g(t,t.next,e)}function E(t,e){var i=new S(t.i,t.x,t.y),r=new S(e.i,e.x,e.y),s=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function T(t,e,i,r){var s=new S(t,e,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function w(t,e,i,r){for(var s=0,n=e,a=i-r;n<i;n+=r)s+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return s}t.exports=e,t.exports.default=e,e.deviation=function(t,e,i,r){var s=e&&e.length,n=s?e[0]*i:t.length,a=Math.abs(w(t,0,n,i));if(s)for(var o=0,h=e.length;o<h;o++){var l=e[o]*i,u=o<h-1?e[o+1]*i:t.length;a-=Math.abs(w(t,l,u,i))}var d=0;for(o=0;o<r.length;o+=3){var c=r[o]*i,f=r[o+1]*i,p=r[o+2]*i;d+=Math.abs((t[c]-t[p])*(t[f+1]-t[c+1])-(t[c]-t[f])*(t[p+1]-t[c+1]))}return 0===a&&0===d?0:Math.abs((d-a)/a)},e.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,s=0;s<t.length;s++){for(var n=0;n<t[s].length;n++)for(var a=0;a<e;a++)i.vertices.push(t[s][n][a]);s>0&&(r+=t[s-1].length,i.holes.push(r))}return i}},6729:function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,r,n,a){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new s(r,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(i=!1)),o.prototype.eventNames=function(){var t,r,s=[];if(0===this._eventsCount)return s;for(r in t=this._events)e.call(t,r)&&s.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,a=Array(n);s<n;s++)a[s]=r[s].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},o.prototype.emit=function(t,e,r,s,n,a){var o=i?i+t:t;if(!this._events[o])return!1;var h,l,u=this._events[o],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,s),!0;case 5:return u.fn.call(u.context,e,r,s,n),!0;case 6:return u.fn.call(u.context,e,r,s,n,a),!0}for(l=1,h=Array(d-1);l<d;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h)}else{var c,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,r);break;case 4:u[l].fn.call(u[l].context,e,r,s);break;default:if(!h)for(c=1,h=Array(d-1);c<d;c++)h[c-1]=arguments[c];u[l].fn.apply(u[l].context,h)}}return!0}
1,o.prototype.on=function(t,e,i){return n(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return n(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,r,s){var n=i?i+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||s&&!o.once||r&&o.context!==r||a(this,n);else{for(var h=0,l=[],u=o.length;h<u;h++)(o[h].fn!==e||s&&!o[h].once||r&&o[h].context!==r)&&l.push(o[h]);l.length?this._events[n]=1===l.length?l[0]:l:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o},5668:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),e.default=void 0;var r=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=f(e);if(i&&i.has(t))return i.get(t);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in t)if("default"!==n&&Object.prototype.hasOwnProperty.call(t,n)){var a=s?Object.getOwnPropertyDescriptor(t,n):null;a&&(a.get||a.set)?Object.defineProperty(r,n,a):r[n]=t[n]}return r.default=t,i&&i.set(t,r),r}(i(7294)),s=c(i(5697)),n=c(i(3935)),a=c(i(6010)),o=i(1825),h=i(2849),l=i(9280),u=c(i(783)),d=c(i(5904));function c(t){return t&&t.__esModule?t:{default:t}}function f(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(f=function(t){return t?i:e})(t)}function p(){return(p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}function m(t,e,i){var r,s;return(r=e,s=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(r,"string"),(e="symbol"==typeof s?s:String(s))in t)?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class g extends r.Component{static getDerivedStateFromProps(t,e){let{position:i}=t,{prevPropsPosition:r}=e;return i&&(!r||i.x!==r.x||i.y!==r.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:i,prevPropsPosition:r}),{x:i.x,y:i.y,prevPropsPosition:{...i}}):null}constructor(t){super(t),m(this,"onDragStart",(t,e)=>{(0,d.default)("Draggable: onDragStart: %j",e);let i=this.props.onStart(t,(0,h.createDraggableData)(this,e));if(!1===i)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(t,e)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",e);let i=(0,h.createDraggableData)(this,e),r={x:i.x,y:i.y,slackX:0,slackY:0};if(this.props.bounds){let{x:s,y:n}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[a,o]=(0,h.getBoundPosition)(this,r.x,r.y);r.x=a,r.y=o,r.slackX=this.state.slackX+(s-r.x),r.slackY=this.state.slackY+(n-r.y),i.x=r.x,i.y=r.y,i.deltaX=r.x-this.state.x,i.deltaY=r.y-this.state.y}let l=this.props.onDrag(t,i);if(!1===l)return!1;this.setState(r)}),m(this,"onDragStop",(t,e)=>{if(!this.state.dragging)return!1;let i=this.props.onStop(t,(0,h.createDraggableData)(this,e));if(!1===i)return!1;(0,d.default)("Draggable: onDragStop: %j",e);let r={dragging:!1,slackX:0,slackY:0},s=Boolean(this.props.position);if(s){let{x:n,y:a}=this.props.position;r.x=n,r.y=a}this.setState(r)}),this.state={dragging:!1,dragged:!1,x:t.position?t.position.x:t.defaultPosition.x,y:t.position?t.position.y:t.defaultPosition.y,prevPropsPosition:{...t.position},slackX:0,slackY:0,isElementSVG:!1},t.position&&!(t.onDrag||t.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode() instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var t,e;return null!==(t=null===(e=this.props)||void 0===e||null===(e=e.nodeRef)||void 0===e?void 0:e.current)&&void 0!==t?t:n.default.findDOMNode(this)}render(){let{axis:t,bounds:e,children:i,defaultPosition:s,defaultClassName:n,defaultClassNameDragging:l,defaultClassNameDragged:d,position:c,positionOffset:f,scale:m,...g}=this.props,_={},v=null,x=Boolean(c),y=!x||this.state.dragging,b=c||s,E={x:(0,h.canDragX)(this)&&y?this.state.x:b.x,y:(0,h.canDragY)(this)&&y?this.state.y:b.y};this.state.isElementSVG?v=(0,o.createSVGTransform)(E,f):_=(0,o.createCSSTransform)(E,f);let T=(0,a.default)(i.props.className||"",n,{[l]:this.state.dragging,[d]:this.state.dragged});return r.createElement(u.default,p({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),r.cloneElement(r.Children.only(i),{className:T,style:{...i.props.style,..._},transform:v}))}}e.default=g,m(g,"displayName","Draggable"),m(g,"propTypes",{...u.default.propT
1ypes,axis:s.default.oneOf(["both","x","y","none"]),bounds:s.default.oneOfType([s.default.shape({left:s.default.number,right:s.default.number,top:s.default.number,bottom:s.default.number}),s.default.string,s.default.oneOf([!1])]),defaultClassName:s.default.string,defaultClassNameDragging:s.default.string,defaultClassNameDragged:s.default.string,defaultPosition:s.default.shape({x:s.default.number,y:s.default.number}),positionOffset:s.default.shape({x:s.default.oneOfType([s.default.number,s.default.string]),y:s.default.oneOfType([s.default.number,s.default.string])}),position:s.default.shape({x:s.default.number,y:s.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),m(g,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})},783:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=d(e);if(i&&i.has(t))return i.get(t);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in t)if("default"!==n&&Object.prototype.hasOwnProperty.call(t,n)){var a=s?Object.getOwnPropertyDescriptor(t,n):null;a&&(a.get||a.set)?Object.defineProperty(r,n,a):r[n]=t[n]}return r.default=t,i&&i.set(t,r),r}(i(7294)),s=u(i(5697)),n=u(i(3935)),a=i(1825),o=i(2849),h=i(9280),l=u(i(5904));function u(t){return t&&t.__esModule?t:{default:t}}function d(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(d=function(t){return t?i:e})(t)}function c(t,e,i){var r,s;return(r=e,s=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(r,"string"),(e="symbol"==typeof s?s:String(s))in t)?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}let f={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},p=f.mouse;class m extends r.Component{constructor(){super(...arguments),c(this,"dragging",!1),c(this,"lastX",NaN),c(this,"lastY",NaN),c(this,"touchIdentifier",null),c(this,"mounted",!1),c(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&"number"==typeof t.button&&0!==t.button)return!1;let e=this.findDOMNode();if(!e||!e.ownerDocument||!e.ownerDocument.body)throw Error("<DraggableCore> not mounted on DragStart!");let{ownerDocument:i}=e;if(this.props.disabled||!(t.target instanceof i.defaultView.Node)||this.props.handle&&!(0,a.matchesSelectorAndParentsTo)(t.target,this.props.handle,e)||this.props.cancel&&(0,a.matchesSelectorAndParentsTo)(t.target,this.props.cancel,e))return;"touchstart"===t.type&&t.preventDefault();let r=(0,a.getTouchIdentifier)(t);this.touchIdentifier=r;let s=(0,o.getControlPosition)(t,r,this);if(null==s)return;let{x:n,y:h}=s,u=(0,o.createCoreData)(this,n,h);(0,l.default)("DraggableCore: handleDragStart: %j",u),(0,l.default)("calling",this.props.onStart);let d=this.props.onStart(t,u);!1!==d&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,a.addUserSelectStyles)(i),this.dragging=!0,this.lastX=n,this.lastY=h,(0,a.addEvent)(i,p.move,this.handleDrag),(0,a.addEvent)(i,p.stop,this.handleDragStop))}),c(this,"handleDrag",t=>{let e=(0,o.getControlPosition)(t,this.touchIdentifier,this);if(null==e)return;let{x:i,y:r}=e;if(Array.isArray(this.props.grid)){let s=i-this.lastX,n=r-this.lastY;
1if([s,n]=(0,o.snapToGrid)(this.props.grid,s,n),!s&&!n)return;i=this.lastX+s,r=this.lastY+n}let a=(0,o.createCoreData)(this,i,r);(0,l.default)("DraggableCore: handleDrag: %j",a);let h=this.props.onDrag(t,a);if(!1===h||!1===this.mounted){try{this.handleDragStop(new MouseEvent("mouseup"))}catch(d){let u=document.createEvent("MouseEvents");u.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(u)}return}this.lastX=i,this.lastY=r}),c(this,"handleDragStop",t=>{if(!this.dragging)return;let e=(0,o.getControlPosition)(t,this.touchIdentifier,this);if(null==e)return;let{x:i,y:r}=e;if(Array.isArray(this.props.grid)){let s=i-this.lastX||0,n=r-this.lastY||0;[s,n]=(0,o.snapToGrid)(this.props.grid,s,n),i=this.lastX+s,r=this.lastY+n}let h=(0,o.createCoreData)(this,i,r),u=this.props.onStop(t,h);if(!1===u||!1===this.mounted)return!1;let d=this.findDOMNode();d&&this.props.enableUserSelectHack&&(0,a.removeUserSelectStyles)(d.ownerDocument),(0,l.default)("DraggableCore: handleDragStop: %j",h),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,d&&((0,l.default)("DraggableCore: Removing handlers"),(0,a.removeEvent)(d.ownerDocument,p.move,this.handleDrag),(0,a.removeEvent)(d.ownerDocument,p.stop,this.handleDragStop))}),c(this,"onMouseDown",t=>(p=f.mouse,this.handleDragStart(t))),c(this,"onMouseUp",t=>(p=f.mouse,this.handleDragStop(t))),c(this,"onTouchStart",t=>(p=f.touch,this.handleDragStart(t))),c(this,"onTouchEnd",t=>(p=f.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;let t=this.findDOMNode();t&&(0,a.addEvent)(t,f.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let t=this.findDOMNode();if(t){let{ownerDocument:e}=t;(0,a.removeEvent)(e,f.mouse.move,this.handleDrag),(0,a.removeEvent)(e,f.touch.move,this.handleDrag),(0,a.removeEvent)(e,f.mouse.stop,this.handleDragStop),(0,a.removeEvent)(e,f.touch.stop,this.handleDragStop),(0,a.removeEvent)(t,f.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,a.removeUserSelectStyles)(e)}}findDOMNode(){var t,e;return null!==(t=this.props)&&void 0!==t&&t.nodeRef?null===(e=this.props)||void 0===e||null===(e=e.nodeRef)||void 0===e?void 0:e.current:n.default.findDOMNode(this)}render(){return r.cloneElement(r.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}e.default=m,c(m,"displayName","DraggableCore"),c(m,"propTypes",{allowAnyClick:s.default.bool,children:s.default.node.isRequired,disabled:s.default.bool,enableUserSelectHack:s.default.bool,offsetParent:function(t,e){if(t[e]&&1!==t[e].nodeType)throw Error("Draggable's offsetParent must be a DOM Node.")},grid:s.default.arrayOf(s.default.number),handle:s.default.string,cancel:s.default.string,nodeRef:s.default.object,onStart:s.default.func,onDrag:s.default.func,onStop:s.default.func,onMouseDown:s.default.func,scale:s.default.number,className:h.dontSetMe,style:h.dontSetMe,transform:h.dontSetMe}),c(m,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},1193:function(t,e,i){let{default:r,DraggableCore:s}=i(5668);t.exports=r,t.exports.default=r,t.exports.DraggableCore=s},1825:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.addClassName=l,e.addEvent=function(t,e,i,r){if(!t)return;let s={capture:!0,...r};t.addEventListener?t.addEventListener(e,i,s):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i},e.addUserSelectStyles=function(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||((e=t.createElement("style")).type="text/css",e.id="react-draggable-style-el",e.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",e.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",t.getElementsByTagName("head")[0].appendChild(e)),t.body&&l(t.body,"react-draggable-transparent-selection")},e.createCSSTransform=function(t,e){let i=h(t,e,"px");return{[(0,s.browserPrefixToKey)("transform",s.default)]:i}},e.createSVGTransform=function(t,e){let i=h(t,e,"");return i},e.getTouch=function(t,e){return t.targetTouches&&(0,r.findInArray)(t.targetTouches,t=>e===t.identifier)||t.changedTouches&&(0,r.findInArray)(t.changedTouches,t=>e===t.identifier)},e.getTouchIdentifier=function(t){return t.targetTouches&&t.targetTouches[0]?t.targetTouches[0].identifier:t.changedTouches&&t.changedTouches[0]?t.changedTouches[0].identifier:void 0}
1,e.getTranslation=h,e.innerHeight=function(t){let e=t.clientHeight,i=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,r.int)(i.paddingTop),e-=(0,r.int)(i.paddingBottom)},e.innerWidth=function(t){let e=t.clientWidth,i=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,r.int)(i.paddingLeft),e-=(0,r.int)(i.paddingRight)},e.matchesSelector=o,e.matchesSelectorAndParentsTo=function(t,e,i){let r=t;do{if(o(r,e))return!0;if(r===i)break;r=r.parentNode}while(r);return!1},e.offsetXYFromParent=function(t,e,i){let r=e===e.ownerDocument.body,s=r?{left:0,top:0}:e.getBoundingClientRect(),n=(t.clientX+e.scrollLeft-s.left)/i,a=(t.clientY+e.scrollTop-s.top)/i;return{x:n,y:a}},e.outerHeight=function(t){let e=t.clientHeight,i=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,r.int)(i.borderTopWidth),e+=(0,r.int)(i.borderBottomWidth)},e.outerWidth=function(t){let e=t.clientWidth,i=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,r.int)(i.borderLeftWidth),e+=(0,r.int)(i.borderRightWidth)},e.removeClassName=u,e.removeEvent=function(t,e,i,r){if(!t)return;let s={capture:!0,...r};t.removeEventListener?t.removeEventListener(e,i,s):t.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null},e.removeUserSelectStyles=function(t){if(t)try{if(t.body&&u(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{let e=(t.defaultView||window).getSelection();e&&"Caret"!==e.type&&e.removeAllRanges()}}catch(i){}};var r=i(9280),s=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=n(e);if(i&&i.has(t))return i.get(t);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var o=s?Object.getOwnPropertyDescriptor(t,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=t[a]}return r.default=t,i&&i.set(t,r),r}(i(8650));function n(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(n=function(t){return t?i:e})(t)}let a="";function o(t,e){return a||(a=(0,r.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,r.isFunction)(t[e])})),!!(0,r.isFunction)(t[a])&&t[a](e)}function h(t,e,i){let{x:r,y:s}=t,n="translate(".concat(r).concat(i,",").concat(s).concat(i,")");if(e){let a="".concat("string"==typeof e.x?e.x:e.x+i),o="".concat("string"==typeof e.y?e.y:e.y+i);n="translate(".concat(a,", ").concat(o,")")+n}return n}function l(t,e){t.classList?t.classList.add(e):t.className.match(RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function u(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}},8650:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.browserPrefixToKey=s,e.browserPrefixToStyle=function(t,e){return e?"-".concat(e.toLowerCase(),"-").concat(t):t},e.default=void 0,e.getPrefix=r;let i=["Moz","Webkit","O","ms"];function r(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";let r=null===(t=window.document)||void 0===t||null===(t=t.documentElement)||void 0===t?void 0:t.style;if(!r||e in r)return"";for(let n=0;n<i.length;n++)if(s(e,i[n]) in r)return i[n];return""}function s(t,e){return e?"".concat(e).concat(function(t){let e="",i=!0;for(let r=0;r<t.length;r++)i?(e+=t[r].toUpperCase(),i=!1):"-"===t[r]?i=!0:e+=t[r];return e}(t)):t}e.default=r()},5904:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){}},2849:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.canDragX=function(t){return"both"===t.props.axis||"x"===t.props.axis},e.canDragY=function(t){return"both"===t.props.axis||"y"===t.props.axis},e.createCoreData=function(t,e,i){let s=!(0,r.isNum)(t.lastX),a=n(t);return s?{node:a,deltaX:0,deltaY:0,lastX:e,lastY:i,x:e,y:i}:{node:a,deltaX:e-t.lastX,deltaY:i-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:i}},e.createDraggableData=function(t,e){let i=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/i,y:t.state.y+e.deltaY/i,deltaX:e.deltaX/i,deltaY:e.deltaY/i,lastX:t.state.x,lastY:t.state.y}}
1,e.getBoundPosition=function(t,e,i){var a;if(!t.props.bounds)return[e,i];let{bounds:o}=t.props;o="string"==typeof o?o:(a=o,{left:a.left,top:a.top,right:a.right,bottom:a.bottom});let h=n(t);if("string"==typeof o){let{ownerDocument:l}=h,u=l.defaultView,d;if(!((d="parent"===o?h.parentNode:l.querySelector(o))instanceof u.HTMLElement))throw Error('Bounds selector "'+o+'" could not find an element.');let c=u.getComputedStyle(h),f=u.getComputedStyle(d);o={left:-h.offsetLeft+(0,r.int)(f.paddingLeft)+(0,r.int)(c.marginLeft),top:-h.offsetTop+(0,r.int)(f.paddingTop)+(0,r.int)(c.marginTop),right:(0,s.innerWidth)(d)-(0,s.outerWidth)(h)-h.offsetLeft+(0,r.int)(f.paddingRight)-(0,r.int)(c.marginRight),bottom:(0,s.innerHeight)(d)-(0,s.outerHeight)(h)-h.offsetTop+(0,r.int)(f.paddingBottom)-(0,r.int)(c.marginBottom)}}return(0,r.isNum)(o.right)&&(e=Math.min(e,o.right)),(0,r.isNum)(o.bottom)&&(i=Math.min(i,o.bottom)),(0,r.isNum)(o.left)&&(e=Math.max(e,o.left)),(0,r.isNum)(o.top)&&(i=Math.max(i,o.top)),[e,i]},e.getControlPosition=function(t,e,i){let r="number"==typeof e?(0,s.getTouch)(t,e):null;if("number"==typeof e&&!r)return null;let a=n(i),o=i.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,s.offsetXYFromParent)(r||t,o,i.props.scale)},e.snapToGrid=function(t,e,i){let r=Math.round(e/t[0])*t[0],s=Math.round(i/t[1])*t[1];return[r,s]};var r=i(9280),s=i(1825);function n(t){let e=t.findDOMNode();if(!e)throw Error("<DraggableCore>: Unmounted during event!");return e}},9280:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.dontSetMe=function(t,e,i){if(t[e])return Error("Invalid prop ".concat(e," passed to ").concat(i," - do not set this, set it on the child."))},e.findInArray=function(t,e){for(let i=0,r=t.length;i<r;i++)if(e.apply(e,[t[i],i,t]))return t[i]},e.int=function(t){return parseInt(t,10)},e.isFunction=function(t){return"function"==typeof t||"[object Function]"===Object.prototype.toString.call(t)},e.isNum=function(t){return"number"==typeof t&&!isNaN(t)}},2439:function(t,e,i){i.d(e,{MxU:function(){return sg},TCu:function(){return nJ}});var r,s=((tj=s||{})[tj.WEBGL_LEGACY=0]="WEBGL_LEGACY",tj[tj.WEBGL=1]="WEBGL",tj[tj.WEBGL2=2]="WEBGL2",tj),n=((tY=n||{})[tY.UNKNOWN=0]="UNKNOWN",tY[tY.WEBGL=1]="WEBGL",tY[tY.CANVAS=2]="CANVAS",tY),a=((t$=a||{})[t$.COLOR=16384]="COLOR",t$[t$.DEPTH=256]="DEPTH",t$[t$.STENCIL=1024]="STENCIL",t$),o=((tq=o||{})[tq.NORMAL=0]="NORMAL",tq[tq.ADD=1]="ADD",tq[tq.MULTIPLY=2]="MULTIPLY",tq[tq.SCREEN=3]="SCREEN",tq[tq.OVERLAY=4]="OVERLAY",tq[tq.DARKEN=5]="DARKEN",tq[tq.LIGHTEN=6]="LIGHTEN",tq[tq.COLOR_DODGE=7]="COLOR_DODGE",tq[tq.COLOR_BURN=8]="COLOR_BURN",tq[tq.HARD_LIGHT=9]="HARD_LIGHT",tq[tq.SOFT_LIGHT=10]="SOFT_LIGHT",tq[tq.DIFFERENCE=11]="DIFFERENCE",tq[tq.EXCLUSION=12]="EXCLUSION",tq[tq.HUE=13]="HUE",tq[tq.SATURATION=14]="SATURATION",tq[tq.COLOR=15]="COLOR",tq[tq.LUMINOSITY=16]="LUMINOSITY",tq[tq.NORMAL_NPM=17]="NORMAL_NPM",tq[tq.ADD_NPM=18]="ADD_NPM",tq[tq.SCREEN_NPM=19]="SCREEN_NPM",tq[tq.NONE=20]="NONE",tq[tq.SRC_OVER=0]="SRC_OVER",tq[tq.SRC_IN=21]="SRC_IN",tq[tq.SRC_OUT=22]="SRC_OUT",tq[tq.SRC_ATOP=23]="SRC_ATOP",tq[tq.DST_OVER=24]="DST_OVER",tq[tq.DST_IN=25]="DST_IN",tq[tq.DST_OUT=26]="DST_OUT",tq[tq.DST_ATOP=27]="DST_ATOP",tq[tq.ERASE=26]="ERASE",tq[tq.SUBTRACT=28]="SUBTRACT",tq[tq.XOR=29]="XOR",tq),h=((tK=h||{})[tK.POINTS=0]="POINTS",tK[tK.LINES=1]="LINES",tK[tK.LINE_LOOP=2]="LINE_LOOP",tK[tK.LINE_STRIP=3]="LINE_STRIP",tK[tK.TRIANGLES=4]="TRIANGLES",tK[tK.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",tK[tK.TRIANGLE_FAN=6]="TRIANGLE_FAN",tK),l=((tZ=l||{})[tZ.RGBA=6408]="RGBA",tZ[tZ.RGB=6407]="RGB",tZ[tZ.RG=33319]="RG",tZ[tZ.RED=6403]="RED",tZ[tZ.RGBA_INTEGER=36249]="RGBA_INTEGER",tZ[tZ.RGB_INTEGER=36248]="RGB_INTEGER",tZ[tZ.RG_INTEGER=33320]="RG_INTEGER",tZ[tZ.RED_INTEGER=36244]="RED_INTEGER",tZ[tZ.ALPHA=6406]="ALPHA",tZ[tZ.LUMINANCE=6409]="LUMINANCE",tZ[tZ.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",tZ[tZ.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",tZ[tZ.DEPTH_STENCIL=34041]="DEPTH_STENCIL",tZ),u=((tQ=u||{})[tQ.TEXTURE_2D=3553]="TEXTURE_2D",tQ[tQ.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",tQ[tQ.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",tQ[tQ.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",tQ[tQ.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",tQ[tQ.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",tQ[tQ.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",tQ[tQ.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",tQ[tQ.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",tQ),d=((tJ=d||{})[tJ.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",tJ[tJ.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",tJ[tJ.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",tJ[tJ.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",tJ[tJ.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",tJ[tJ.UNSIGNED_INT=5125]="UNSIGNED_INT",tJ[tJ.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",tJ[tJ.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",tJ[tJ.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",tJ[tJ.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",tJ[tJ.BYTE=5120]="BYTE",tJ[tJ.SHORT=5122]="SHORT",tJ[tJ.INT=5124]="INT",tJ[tJ.FLOAT=5126]="FLOAT",tJ[tJ.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",tJ[tJ.HALF_FLOAT=36193]="HALF_FLOAT",tJ),c=((t0=c||{})[t0.FLOAT=0]="FLOAT",t0[t0.INT=1]="INT",t0[t0.UINT=2]="UINT",t0),f=((t1=f||{})[t1.NEAREST=0]="NEAREST",t1[t1.LINEAR=1]="LINEAR",t1),p=((t2=p||{})[t2.CLAMP=33071]="CLAMP",t2[t2.REPEAT=10497]="REPEAT",t2[t2.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t2),m=((t3=m||{})[t3.OFF=0]="OFF",t3[t3.POW2=1]="POW2",t3[t3.ON=2]="ON",t3[t3.ON_MANUAL=3]="ON_MANUAL",t3),g=((t4=g||{})[t4.NPM=0]="NPM",t4[t4.UNPACK=1]="UNPACK",t4[t4.PMA=2]="PMA",t4[t4.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t4[t4.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t4[t4.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t4),_=((t5=_||{})[t5.NO=0]="NO",t5[t5.YES=1]="YES",t5[t5.AUTO=2]="AUTO",t5[t5.BLEND=0]="BLEND",t5[t5.CLEAR=1]="CLEAR",t5[t5.BLIT=2]="BLIT",t5),v=((t8=v||{})[t8.AUTO=0]="AUTO",t8[t8.MANUAL=1]="MANUAL",t8),x=((t6=x||{}).LOW="lowp",t6.MEDIUM="mediump",t6.HIGH="highp",t6),y=((t7=y||{})[t7.NONE=0]="NONE",t7[t7.SCISSOR=1]="SCISSOR",t7[t7.STENCIL=2]="STENCIL",t7[t7.SPRITE=3]="SPRITE",t7[t7.COLOR=4]="COLOR",t7),b=((t9=b||{})[t9.RED=1]="RED",t9[t9.GREEN=2]="GREEN",t9[t9.BLUE=4]="BLUE",t9[t9.ALPHA=8]="ALPHA",t9),E=((et=E||{})[et.NONE=0]="NONE",et[et.LOW=2]="LOW",et[et.MEDIUM=4]="MEDIUM",et[et.HIGH=8]="HIGH",et),T=((ee=T||{})[ee.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",ee[ee.ARRAY_BUFFER=34962]="ARRAY_BUFFER",ee[ee.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",ee);let A={ADAPTER:{createCanvas(t,e){let i=document.createElement("canvas");return i.width=t,i.height=e,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var S=/iPhone/i,w=/iPod/i,R=/iPad/i,I=/\biOS-universal(?:.+)Mac\b/i,C=/\bAndroid(?:.+)Mobile\b/i,M=/Android/i,P=/(?:SD4930UR|\bSilk(?:.
1+)Mobile\b)/i,D=/Silk/i,B=/Windows Phone/i,N=/\bWindows(?:.+)ARM\b/i,O=/BlackBerry/i,L=/BB10/i,F=/Opera Mini/i,k=/\b(CriOS|Chrome)(?:.+)Mobile/i,U=/Mobile(?:.+)Firefox\b/i,G=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};function H(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i,r=e.userAgent,s=r.split("[FBAN");void 0!==s[1]&&(r=s[0]),void 0!==(s=r.split("Twitter"))[1]&&(r=s[0]);var n=(i=r,function(t){return t.test(i)}),a={apple:{phone:n(S)&&!n(B),ipod:n(w),tablet:!n(S)&&(n(R)||G(e))&&!n(B),universal:n(I),device:(n(S)||n(w)||n(R)||n(I)||G(e))&&!n(B)},amazon:{phone:n(P),tablet:!n(P)&&n(D),device:n(P)||n(D)},android:{phone:!n(B)&&n(P)||!n(B)&&n(C),tablet:!n(B)&&!n(P)&&!n(C)&&(n(D)||n(M)),device:!n(B)&&(n(P)||n(D)||n(C)||n(M))||n(/\bokhttp\b/i)},windows:{phone:n(B),tablet:n(N),device:n(B)||n(N)},other:{blackberry:n(O),blackberry10:n(L),opera:n(F),firefox:n(U),chrome:n(k),device:n(O)||n(L)||n(F)||n(U)||n(k)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}let X=H.default??H,z=X(globalThis.navigator);A.RETINA_PREFIX=/@([0-9\.]+)x/,A.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var V=i(6729),W=i(9187);i(1987);let j={};function Y(t,e,i=3){if(j[e])return;let r=Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} 2Deprecated since v${t}`):(r=r.split(` 3`).splice(i).join(` 4`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} 5Deprecated since v${t}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} 6Deprecated since v${t}`),console.warn(r))),j[e]=!0}function $(t){if("string"!=typeof t)throw TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function q(t){return t.split("?")[0].split("#")[0]}let K={toPosix(t){var e,i;return t.replace(RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){$(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let i=/^[^/:]+:\/{0,2}/.exec(t);return i?i[0]:""},toAbsolute(t,e,i){if($(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let r=q(this.toPosix(e??A.ADAPTER.getBaseUrl())),s=q(this.toPosix(i??this.rootname(r)));return(t=this.toPosix(t)).startsWith("/")?K.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if($(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",i=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let r=t.endsWith("/");return(t=function(t,e){let i="",r=0,s=-1,n=0,a=-1;for(let o=0;o<=t.length;++o){if(o<t.length)a=t.charCodeAt(o);else{if(47===a)break;a=47}if(47===a){if(!(s===o-1||1===n)){if(s!==o-1&&2===n){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2)){if(i.length>2){let h=i.lastIndexOf("/");if(h!==i.length-1){-1===h?(i="",r=0):r=(i=i.slice(0,h)).length-1-i.lastIndexOf("/"),s=o,n=0;continue}}else if(2===i.length||1===i.length){i="",r=0,s=o,n=0;continue}}e&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${t.slice(s+1,o)}`:i=t.slice(s+1,o),r=o-s-1}s=o,n=0}else 46===a&&-1!==n?++n:n=-1}return i}(t,!1)).length>0&&r&&(t+="/"),i?`/${t}`:e+t},isAbsolute(t){return $(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let i=0;i<t.length;++i){let r=t[i];if($(r),r.length>0){if(void 0===e)e=r;else{let s=t[i-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}}return void 0===e?".":this.normalize(e)},dirname(t){if($(t),0===t.length)return".";
6let e=(t=this.toPosix(t)).charCodeAt(0),i=47===e,r=-1,s=!0,n=this.getProtocol(t),a=t;t=t.slice(n.length);for(let o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!s){r=o;break}}else s=!1;return -1===r?i?"/":this.isUrl(a)?n+t:n:i&&1===r?"//":n+t.slice(0,r)},rootname(t){$(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){let i=t.indexOf("/",e.length);(e=-1!==i?t.slice(0,i):t).endsWith("/")||(e+="/")}return e},basename(t,e){$(t),e&&$(e),t=q(this.toPosix(t));let i=0,r=-1,s=!0,n;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(n=t.length-1;n>=0;--n){let h=t.charCodeAt(n);if(47===h){if(!s){i=n+1;break}}else -1===o&&(s=!1,o=n+1),a>=0&&(h===e.charCodeAt(a)?-1==--a&&(r=n):(a=-1,r=o))}return i===r?r=o:-1===r&&(r=t.length),t.slice(i,r)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!s){i=n+1;break}}else -1===r&&(s=!1,r=n+1);return -1===r?"":t.slice(i,r)},extname(t){$(t),t=q(this.toPosix(t));let e=-1,i=0,r=-1,s=!0,n=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(47===o){if(!s){i=a+1;break}continue}-1===r&&(s=!1,r=a+1),46===o?-1===e?e=a:1!==n&&(n=1):-1!==e&&(n=-1)}return -1===e||-1===r||0===n||1===n&&e===r-1&&e===i+1?"":t.slice(e,r)},parse(t){$(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let i=(t=q(this.toPosix(t))).charCodeAt(0),r=this.isAbsolute(t),s;e.root=this.rootname(t),s=r||this.hasProtocol(t)?1:0;let n=-1,a=0,o=-1,h=!0,l=t.length-1,u=0;for(;l>=s;--l){if(47===(i=t.charCodeAt(l))){if(!h){a=l+1;break}continue}-1===o&&(h=!1,o=l+1),46===i?-1===n?n=l:1!==u&&(u=1):-1!==n&&(u=-1)}return -1===n||-1===o||0===u||1===u&&n===o-1&&n===a+1?-1!==o&&(0===a&&r?e.base=e.name=t.slice(1,o):e.base=e.name=t.slice(a,o)):(0===a&&r?(e.name=t.slice(1,n),e.base=t.slice(1,o)):(e.name=t.slice(a,n),e.base=t.slice(a,o)),e.ext=t.slice(n,o)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]},Z;async function Q(){return(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return g.UNPACK;let e=await new Promise(t=>{let e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()});if(!e)return g.UNPACK;let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,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);let s=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,s),t.deleteFramebuffer(r),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),s[0]<=s[3]?g.PMA:g.UNPACK})()}let J;var tt={grad:.9,turn:360,rad:360/(2*Math.PI)},te=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},ti=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=Math.pow(10,e)),Math.round(i*t)/i+0},tr=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=1),t>i?i:t>e?t:e},ts=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},tn=function(t){return{r:tr(t.r,0,255),g:tr(t.g,0,255),b:tr(t.b,0,255),a:tr(t.a)}},ta=function(t){return{r:ti(t.r),g:ti(t.g),b:ti(t.b),a:ti(t.a,3)}},to=/^#([0-9a-f]{3,8})$/i,th=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},tl=function(t){var e=t.r,i=t.g,r=t.b,s=t.a,n=Math.max(e,i,r),a=n-Math.min(e,i,r),o=a?n===e?(i-r)/a:n===i?2+(r-e)/a:4+(e-i)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:s}},tu=function(t){var e=t.h,i=t.s,r=t.v,s=t.a;e=e/360*6;var n=Math.floor(e),a=(r/=100)*(1-(i/=100)),o=r*(1-(e-n)*i),h=r*(1-(1-e+n)*i),l=n%6;return{r:255*[r,o,a,a,h,r][l],g:255*[h,r,r,o,a,a][l],b:255*[a,a,h,r,r,o][l],a:s}},td=function(t){return{h:ts(t.h),s:tr(t.s,0,100),l:tr(t.l,0,100),a:tr(t.a)}},tc=function(t){return{h:ti(t.h),s:ti(t.s),l:ti(t.l),a:ti(t.a,3)}},tf=function(t){var e,i;return tu((e=t.s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}))},tp=function(t){var e,i,r,s;return{h:(e=tl(t)).h,s:(s=(200-(i=e.s))*(r=e.v)/100)>0&&s<200?i*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a}},tm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tg=/^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*,\
6s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tx={string:[[function(t){var e=to.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?ti(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?ti(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=t_.exec(t)||tv.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:tn({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=tm.exec(t)||tg.exec(t);if(!e)return null;var i,r,s=td({h:(i=e[1],void 0===(r=e[2])&&(r="deg"),Number(i)*(tt[r]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return tf(s)},"hsl"]],object:[[function(t){var e=t.r,i=t.g,r=t.b,s=t.a;return te(e)&&te(i)&&te(r)?tn({r:Number(e),g:Number(i),b:Number(r),a:Number(void 0===s?1:s)}):null},"rgb"],[function(t){var e=t.h,i=t.s,r=t.l,s=t.a;if(!te(e)||!te(i)||!te(r))return null;var n=td({h:Number(e),s:Number(i),l:Number(r),a:Number(void 0===s?1:s)});return tf(n)},"hsl"],[function(t){var e=t.h,i=t.s,r=t.v,s=t.a;if(!te(e)||!te(i)||!te(r))return null;var n,a=(n={h:Number(e),s:Number(i),v:Number(r),a:Number(void 0===s?1:s)},{h:ts(n.h),s:tr(n.s,0,100),v:tr(n.v,0,100),a:tr(n.a)});return tu(a)},"hsv"]]},ty=function(t,e){for(var i=0;i<e.length;i++){var r=e[i][0](t);if(r)return[r,e[i][1]]}return[null,void 0]},tb=function(t,e){var i=tp(t);return{h:i.h,s:tr(i.s+100*e,0,100),l:i.l,a:i.a}},tE=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},tT=function(t,e){var i=tp(t);return{h:i.h,s:i.s,l:tr(i.l+100*e,0,100),a:i.a}},tA=function(){function t(t){var e;this.parsed=("string"==typeof t?ty(t.trim(),tx.string):"object"==typeof t&&null!==t?ty(t,tx.object):[null,void 0])[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return ti(tE(this.rgba),2)},t.prototype.isDark=function(){return .5>tE(this.rgba)},t.prototype.isLight=function(){return tE(this.rgba)>=.5},t.prototype.toHex=function(){var t,e,i,r,s,n;return e=(t=ta(this.rgba)).r,i=t.g,r=t.b,n=(s=t.a)<1?th(ti(255*s)):"","#"+th(e)+th(i)+th(r)+n},t.prototype.toRgb=function(){return ta(this.rgba)},t.prototype.toRgbString=function(){var t,e,i,r,s;return e=(t=ta(this.rgba)).r,i=t.g,r=t.b,(s=t.a)<1?"rgba("+e+", "+i+", "+r+", "+s+")":"rgb("+e+", "+i+", "+r+")"},t.prototype.toHsl=function(){return tc(tp(this.rgba))},t.prototype.toHslString=function(){var t,e,i,r,s;return e=(t=tc(tp(this.rgba))).h,i=t.s,r=t.l,(s=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+s+")":"hsl("+e+", "+i+"%, "+r+"%)"},t.prototype.toHsv=function(){var t;return t=tl(this.rgba),{h:ti(t.h),s:ti(t.s),v:ti(t.v),a:ti(t.a,3)}},t.prototype.invert=function(){var t;return tS({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a})},t.prototype.saturate=function(t){return void 0===t&&(t=.1),tS(tb(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),tS(tb(this.rgba,-t))},t.prototype.grayscale=function(){return tS(tb(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),tS(tT(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),tS(tT(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){var e;return"number"==typeof t?tS({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ti(this.rgba.a,3)},t.prototype.hue=function(t){var e=tp(this.rgba);return"number"==typeof t?tS({h:t,s:e.s,l:e.l,a:e.a}):ti(e.h)},t.prototype.isEqual=function(t){return this.toHex()===tS(t).toHex()},t}(),tS=function(t){return t instanceof tA?t:new tA(t)},tw=[];!function(t){t.forEach(function(t){0>tw.indexOf(t)&&(t(tA,tx),tw.push(t))})}([function(t,e){var i={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",s
6andybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in i)r[i[s]]=s;var n={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var s,a,o=r[this.toHex()];if(o)return o;if(null==e?void 0:e.closest){var h=this.toRgb(),l=1/0,u="black";if(!n.length)for(var d in i)n[d]=new t(i[d]).toRgb();for(var c in i){var f=(s=h,a=n[c],Math.pow(s.r-a.r,2)+Math.pow(s.g-a.g,2)+Math.pow(s.b-a.b,2));f<l&&(l=f,u=c)}return u}},e.string.push([function(e){var r=e.toLowerCase(),s="transparent"===r?"#0000":i[r];return s?new t(s).toRgb():null},"name"])}]);let tR=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw Error("Cannot set PIXI.Color#value to null");null!==this._value&&this.isSourceEqual(this._value,e)||(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if("number"===i||"string"===i||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every((t,i)=>t===e[i]);if(null!==t&&null!==e){let r=Object.keys(t),s=Object.keys(e);return r.length===s.length&&r.every(i=>t[i]===e[i])}return t===e}toRgba(){let[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,r]=this._components;return(t=t??[])[0]=Math.round(255*e),t[1]=Math.round(255*i),t[2]=Math.round(255*r),t}toRgbArray(t){t=t??[];let[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){let[i,r,s,n]=t.temp.setValue(e)._components;return this._components[0]*=i,this._components[1]*=r,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return -16777216+this._int;if(0===t)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,s=255&this._int;return e&&(i=i*t+.5|0,r=r*t+.5|0,s=s*t+.5|0),(255*t<<24)+(i<<16)+(r<<8)+s}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let 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){let[e,i,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,r,s]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=s,t}normalize(e){let i,r,s,n;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){let a=e;i=(a>>16&255)/255,r=(a>>8&255)/255,s=(255&a)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[i,r,s,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[i,r,s,n=255]=e,i/=255,r/=255,s/=255,n/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){let o=t.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}let h=tS(e);h.isValid()&&({r:i,g:r,b:s,a:n}=h.rgba,i/=255,r/=255,s/=255)}if(void 0!==i)this._components[0]=i,this._components[1]=r,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*i|0)}_clamp(t,e=0,i=1){return"number"==typeof t?Math.min(Math.max(t,e),i):(t.forEach((r,s)=>{t[s]=Math.min(Math.max(r,e),i)}),t)}};tR.shared=new tR,tR.temp=new tR,tR.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let tI=function(){let t=[],e=[];for(let i=0;i<32;i++)t[i]=i,e[i]=i;t[o.NORMAL_NPM]=o.NORMAL,t[o.ADD_NPM]=o.ADD,t[o.SCREEN_NPM]=o.SCREEN,e[o.NORMAL]=o.NORMAL_NPM,e[o.ADD]=o.ADD_NPM,e[o.SCREEN]=o.SCREEN_NPM;let r=[];return r.push(e),r.push(t),r}();function tC(t,e){return tI[e?1:0][t]}function tM(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}function tP(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function tD(t){return!(t&t-1)&&!!t}function tB(t){let e=(t>65535?1:0)<<4,i=((t>>>=e)>255?1:0)<<3;return t>>>=i,e|=i,i=(t>15?1:0)<<2,t>>>=i,e|=i,i=(t>3?1:0)<<1,t>>>=i,(e|=i)|t>>1}function tN(t,e,i){let r=t.length,s;if(e>=r||0===i)return;i=e+i>r?r-e:i;let n=r-i;for(s=e;s<n;++s)t[s]=t[s+i];t.length=n}function tO(t){return 0===t?0:t<0?-1:1}let tL=0;function tF(){return++tL}let tk=class{constructor(t,e,i,r){this.left=t,this.top=e,this.right=i,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};
6tk.EMPTY=new tk(0,0,0,0);let tU={},tG=Object.create(null),tH=Object.create(null);class tX{constructor(t,e,i){this._canvas=A.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||A.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(null===this._canvas)throw TypeError("The CanvasRenderTarget has already been destroyed")}}function tz(t,e,i){for(let r=0,s=4*i*e;r<e;++r,s+=4)if(0!==t[s+3])return!1;return!0}function tV(t,e,i,r,s){let n=4*e;for(let a=r,o=r*n+4*i;a<=s;++a,o+=n)if(0!==t[o+3])return!1;return!0}function tW(t,e=1){let i=A.RETINA_PREFIX?.exec(t);return i?parseFloat(i[1]):e}var tj,tY,t$,tq,tK,tZ,tQ,tJ,t0,t1,t2,t3,t4,t5,t8,t6,t7,t9,et,ee,ei,er=((ei=er||{}).Renderer="renderer",ei.Application="application",ei.RendererSystem="renderer-webgl-system",ei.RendererPlugin="renderer-webgl-plugin",ei.CanvasRendererSystem="renderer-canvas-system",ei.CanvasRendererPlugin="renderer-canvas-plugin",ei.Asset="asset",ei.LoadParser="load-parser",ei.ResolveParser="resolve-parser",ei.CacheParser="cache-parser",ei.DetectionParser="detection-parser",ei);let es=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"==typeof t)t={...t};else throw Error("Invalid extension type");return"string"==typeof t.type&&(t.type=[t.type]),t},en=(t,e)=>es(t).priority??e,ea={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(es).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...t){return t.map(es).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,r=this._queue;i[e]?i[e](t):(r[e]=r[e]||[],r[e].push(t))})}),this},handle(t,e,i){let r=this._addHandlers,s=this._removeHandlers;if(r[t]||s[t])throw Error(`Extension type ${t} already has a handler`);r[t]=e,s[t]=i;let n=this._queue;return n[t]&&(n[t].forEach(t=>e(t)),delete n[t]),this},handleByMap(t,e){return this.handle(t,t=>{e[t.name]=t.ref},t=>{delete e[t.name]})},handleByList(t,e,i=-1){return this.handle(t,t=>{e.includes(t.ref)||(e.push(t.ref),e.sort((t,e)=>en(e,i)-en(t,i)))},t=>{let i=e.indexOf(t.ref);-1!==i&&e.splice(i,1)})}};class eo{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw Error(`${t} isn't a valid view type`)}}}let eh=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` 7`);function el(t){let e="";for(let i=0;i<t;++i)i>0&&(e+=` 8else `),i<t-1&&(e+=`if(test == ${i}.0){}`);return e}class eu{constructor(){this.data=0,this.blendMode=o.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}
8get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==o.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new eu;return t.depthTest=!1,t.blend=!0,t}}eu.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};let ed=[];function ec(t,e){if(!t)return null;let i="";if("string"==typeof t){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);r&&(i=r[1].toLowerCase())}for(let s=ed.length-1;s>=0;--s){let n=ed[s];if(n.test&&n.test(t,i))return new n(t,e)}throw Error("Unrecognized source type to auto-detect Resource")}class ef{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,r,s,n,a,o){if(arguments.length>8)throw Error("max arguments reached");let{name:h,items:l}=this;this._aliasCount++;for(let u=0,d=l.length;u<d;u++)l[u][h](t,e,i,r,s,n,a,o);return l===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return -1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(ef.prototype,{dispatch:{value:ef.prototype.emit},run:{value:ef.prototype.emit}});class ep{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ef("setRealSize"),this.onUpdate=new ef("update"),this.onError=new ef("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class em extends ep{constructor(t,e){let{width:i,height:r}=e||{};if(!i||!r)throw Error("BufferResource width or height invalid");super(i,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===g.UNPACK);let s=e.realWidth,n=e.realHeight;return i.width===s&&i.height===n?r.texSubImage2D(e.target,0,0,0,s,n,e.format,i.type,this.data):(i.width=s,i.height=n,r.texImage2D(e.target,0,i.internalFormat,s,n,0,e.format,i.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}}let eg={scaleMode:f.NEAREST,alphaMode:g.NPM},e_=class t extends V{constructor(e=null,i=null){super(),i=Object.assign({},t.defaultOptions,i);let{alphaMode:r,mipmap:s,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:d,target:c,resolution:f,resourceOptions:p}=i;!e||e instanceof ep||((e=ec(e,p)).internal=!0),this.resolution=f||A.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=d,this.target=c,this.alphaMode=r,this.uid=tF(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),void 0!==e&&e!==this.mipmap&&
8(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=tD(this.realWidth)&&tD(this.realHeight)}setResolution(t){let 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 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 tH[this.cacheId],delete tG[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,i,r=A.STRICT_TEXTURE_CACHE){let s="string"==typeof e,n=null;if(s)n=e;else{if(!e._pixiId){let a=i?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${tF()}`}n=e._pixiId}let o=tH[n];if(s&&r&&!o)throw Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||((o=new t(e,i)).cacheId=n,t.addToCache(o,n)),o}static fromBuffer(e,i,r,s){e=e||new Float32Array(i*r*4);let n=new em(e,{width:i,height:r,...s?.resourceOptions}),a,o;return e instanceof Float32Array?(a=l.RGBA,o=d.FLOAT):e instanceof Int32Array?(a=l.RGBA_INTEGER,o=d.INT):e instanceof Uint32Array?(a=l.RGBA_INTEGER,o=d.UNSIGNED_INT):e instanceof Int16Array?(a=l.RGBA_INTEGER,o=d.SHORT):e instanceof Uint16Array?(a=l.RGBA_INTEGER,o=d.UNSIGNED_SHORT):e instanceof Int8Array?(a=l.RGBA,o=d.BYTE):(a=l.RGBA,o=d.UNSIGNED_BYTE),n.internal=!0,new t(n,Object.assign({},eg,{type:o,format:a},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),tH[e]&&tH[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),tH[e]=t)}static removeFromCache(t){if("string"==typeof t){let e=tH[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete tH[t],e}}else if(t?.textureCacheIds){for(let r=0;r<t.textureCacheIds.length;++r)delete tH[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null}};e_.defaultOptions={mipmap:m.POW2,anisotropicLevel:0,scaleMode:f.LINEAR,wrapMode:p.CLAMP,alphaMode:g.UNPACK,target:u.TEXTURE_2D,format:l.RGBA,type:d.UNSIGNED_BYTE},e_._globalBatch=0;let ev=e_;class ex{constructor(){this.texArray=null,this.blend=0,this.type=h.TRIANGLES,this.start=0,this.size=0,this.data=null}}let ey=0;class eb{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=ey++,this.disposeRunner=new ef("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?T.ELEMENT_ARRAY_BUFFER:T.ARRAY_BUFFER}get index(){return this.type===T.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new eb(t)}}class eE{constructor(t,e=0,i=!1,r=d.FLOAT,s,n,a,o=1){this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=s,this.start=n,this.instance=a,this.divisor=o}destroy(){this.buffer=null}static from(t,e,i,r,s){return new eE(t,e,i,r,s)}}let eT={Float32Array,Uint32Array,Int32Array,Uint8Array},eA={5126:4,5123:2,5121:1},eS=0,ew={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class eR{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=eS++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ef("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,r=!1,s,n,a,o=!1){if(!e)throw Error("You must pass a buffer when creating an attribute");e instanceof eb||(e instanceof Array&&(e=new Float32Array(e)),e=new eb(e));let h=t.split("|");if(h.length>1){for(let l=0;l<h.length;l++)this.addAttribute(h[l],e,i,r,s);return this}let u=this.buffers.indexOf(e);return -1===u&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new eE(u,i,r,s,n,a,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof eb||(t instanceof Array&&(t=new Uint16Array(t)),t=new eb(t)),t.type=T.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;let t=[],e=[],i=new eb,r;for(r in this.attributes){let s=this.attributes[r],n=this.buffers[s.buffer];t.push(n.data),e.push(s.size*eA[s.type]/4),s.buffer=0}for(i.data=function(t,e){let i=0,r=0,s={};for(let n=0;n<t.length;n++)r+=e[n],i+=t[n].length;let a=new ArrayBuffer(4*i),o=null,h=0;for(let l=0;l<t.length;l++){let u=e[l],d=t[l],c=tM(d);s[c]||(s[c]=new eT[c](a)),o=s[c];for(let f=0;f<d.length;f++){let p=(f/u|0)*r+h,m=f%u;o[p+m]=d[f]}h+=u}return new Float32Array(a)}(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new eR;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new eb(this.buffers[e].data.slice(0));for(let i in this.attributes){let r=this.attributes[i];t.attributes[i]=new eE(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=T.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new eR,i=[],r=[],s=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let o=0;o<n.buffers.length;o++)r[o]=r[o]||0,r[o]+=n.buffers[o].data.length,s[o]=0}for(let h=0;h<n.buffers.length;h++)i[h]=new ew[tM(n.buffers[h].data)](r[h]),e.buffers[h]=new eb(i[h]);for(let l=0;l<t.length;l++){n=t[l];for(let u=0;u<n.buffers.length;u++)i[u].set(n.buffers[u].data,s[u]),s[u]+=n.buffers[u].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=T.ELEMENT_ARRAY_BUFFER;let d=0,c=0,f=0,p=0;for(let m=0;m<n.buffers.length;m++)if(n.buffers[m]!==n.indexBuffer){p=m;break}for(let g in n.attributes){let _=n.attributes[g];(0|_.buffer)===p&&(c+=_.size*eA[_.type]/4)}for(let v=0;v<t.length;v++){let x=t[v].indexBuffer.data;for(let y=0;y<x.length;y++)e.indexBuffer.data[y+f]+=d;d+=t[v].buffers[p].data.length/c,f+=x.length}}return e}}class eI extends eR{constructor(t=!1){super(),this._buffer=new eb(null,t,!1),this._indexBuffer=new eb(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,d.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,d.FLOAT).addAttribute("aColor",this._buffer,4,!0,d.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,d.FLOAT).addIndex(this._indexBuffer)}}let eC=2*Math.PI,eM=180/Math.PI,eP=Math.PI/180;var eD,eB=((eD=eB||{})[eD.POLY=0]="POLY",eD[eD.RECT=1]="RECT",eD[eD.CIRC=2]="CIRC",eD[eD.ELIP=3]="ELIP",eD[eD.RREC=4]="RREC",eD);class eN{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new eN(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}}eN.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};let eO=[new eN,new eN,new eN,new eN];class eL{constructor(t=0,e=0,i=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=eB.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 eL(0,0,0,0)}clone(){return new eL(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.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let i=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=i)return!1;let r=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>r}let s=this.left,n=this.right,a=this.top,o=this.bottom;if(n<=s||o<=a)return!1;let h=eO[0].set(t.left,t.top),l=eO[1].set(t.left,t.bottom),u=eO[2].set(t.right,t.top),d=eO[3].set(t.right,t.bottom);if(u.x<=h.x||l.y<=h.y)return!1;let c=Math.sign(e.a*e.d-e.b*e.c);
8if(0===c||(e.apply(h,h),e.apply(l,l),e.apply(u,u),e.apply(d,d),Math.max(h.x,l.x,u.x,d.x)<=s||Math.min(h.x,l.x,u.x,d.x)>=n||Math.max(h.y,l.y,u.y,d.y)<=a||Math.min(h.y,l.y,u.y,d.y)>=o))return!1;let f=c*(l.y-h.y),p=c*(h.x-l.x),m=f*s+p*a,g=f*n+p*a,_=f*s+p*o,v=f*n+p*o;if(Math.max(m,g,_,v)<=f*h.x+p*h.y||Math.min(m,g,_,v)>=f*d.x+p*d.y)return!1;let x=c*(h.y-u.y),y=c*(u.x-h.x),b=x*s+y*a,E=x*n+y*a,T=x*s+y*o,A=x*n+y*o;return!(Math.max(b,E,T,A)<=x*h.x+y*h.y||Math.min(b,E,T,A)>=x*d.x+y*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){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(s-r,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=s-r,this}}eL.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class eF{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=eB.CIRC}clone(){return new eF(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,r=this.x-t,s=this.y-e;return r*=r,s*=s,r+s<=i}getBounds(){return new eL(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}eF.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ek{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r,this.type=eB.ELIP}clone(){return new ek(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,i+r<=1}getBounds(){return new eL(this.x-this.width,this.y-this.height,this.width,this.height)}}ek.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class eU{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){let i=[];for(let r=0,s=e.length;r<s;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.type=eB.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new eU(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,r=this.points.length/2;for(let s=0,n=r-1;s<r;n=s++){let a=this.points[2*s],o=this.points[2*s+1],h=this.points[2*n],l=this.points[2*n+1];o>e!=l>e&&t<(h-a)*((e-o)/(l-o))+a&&(i=!i)}return i}}eU.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`};class eG{constructor(t=0,e=0,i=0,r=0,s=20){this.x=t,this.y=e,this.width=i,this.height=r,this.radius=s,this.type=eB.RREC}clone(){return new eG(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){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),s=e-(this.y+i),n=i*i;if(r*r+s*s<=n||(r=t-(this.x+this.width-i))*r+s*s<=n||r*r+(s=e-(this.y+this.height-i))*s<=n||(r=t-(this.x+i))*r+s*s<=n)return!0}return!1}}eG.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class eH{constructor(t=1,e=0,i=0,r=1,s=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=s,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,s,n){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=s,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new eN;let i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.t
8y,e}applyInverse(t,e){e=e||new eN;let i=1/(this.a*this.d+-(this.c*this.b)),r=t.x,s=t.y;return e.x=this.d*i*r+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*s+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),r=this.a,s=this.c,n=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,r=this.c,s=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this}setTransform(t,e,i,r,s,n,a,o,h){return this.a=Math.cos(a+h)*s,this.b=Math.sin(a+h)*s,this.c=-Math.sin(a-o)*n,this.d=Math.cos(a-o)*n,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this}prepend(t){let e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){let i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,r=this.c,s=this.d,n=t.pivot,a=-Math.atan2(-r,s),o=Math.atan2(i,e),h=Math.abs(a+o);return h<1e-5||1e-5>Math.abs(eC-h)?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=o),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+s*s),t.position.x=this.tx+(n.x*e+n.y*r),t.position.y=this.ty+(n.x*i+n.y*s),t}invert(){let t=this.a,e=this.b,i=this.c,r=this.d,s=this.tx,n=t*r-e*i;return this.a=r/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-r*s)/n,this.ty=-(t*this.ty-e*s)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new eH;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 eH}static get TEMP_MATRIX(){return new eH}}eH.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}]`};let eX=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ez=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],eV=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],eW=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ej=[],eY=[],e$=Math.sign;!function(){for(let t=0;t<16;t++){let e=[];ej.push(e);for(let i=0;i<16;i++){let r=e$(eX[t]*eX[i]+eV[t]*ez[i]),s=e$(ez[t]*eX[i]+eW[t]*ez[i]),n=e$(eX[t]*eV[i]+eV[t]*eW[i]),a=e$(ez[t]*eV[i]+eW[t]*eW[i]);for(let o=0;o<16;o++)if(eX[o]===r&&ez[o]===s&&eV[o]===n&&eW[o]===a){e.push(o);break}}}for(let h=0;h<16;h++){let l=new eH;l.set(eX[h],ez[h],eV[h],eW[h],0,0),eY.push(l)}}();let eq={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>eX[t],uY:t=>ez[t],vX:t=>eV[t],vY:t=>eW[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>ej[t][e],sub:(t,e)=>ej[t][eq.inv(e)],rotate180:t=>4^t,isVertical:t=>(3&t)==2,byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?eq.S:eq.N:2*Math.abs(e)<=Math.abs(t)?t>0?eq.E:eq.W:e>0?t>0?eq.SE:eq.SW:t>0?eq.NE:eq.NW,matrixAppendRotationInv(t,e,i=0,r=0){let s=eY[eq.inv(e)];s.tx=i,s.ty=r,t.append(s)}};class eK{constructor(t,e,i=0,r=0){this._x=i,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new eK(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))}}eK.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};let eZ=class{constructor(){this.worldTransform=new eH,this.localTransform=new eH,this.position=new eK(this.onChange,this,0,0),this.scale=new eK(this.onChange,this,1,1),this.pivot=new eK(this.onChange,this,0,0),this.skew=new eK(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(){let t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){let e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){let i=t.worldTransform,r=this.worldTransform;r.a=e.a*i.a+e.b*i.c,r.b=e.a*i.b+e.b*i.d,r.c=e.c*i.a+e.d*i.c,r.d=e.c*i.b+e.d*i.d,r.tx=e.tx*i.a+e.ty*i.c+i.tx,r.ty=e.tx*i.b+e.ty*i.d+i.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};eZ.IDENTITY=new eZ;let eQ=eZ;eQ.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var eJ=`varying vec2 vTextureCoord; 9 10uniform sampler2D uSampler; 11 12void main(void){ 13 gl_FragColor *= texture2D(uSampler, vTextureCoord); 14}
14`,e0=`attribute vec2 aVertexPosition; 15attribute vec2 aTextureCoord; 16 17uniform mat3 projectionMatrix; 18 19varying vec2 vTextureCoord; 20 21void main(void){ 22 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 23 vTextureCoord = aTextureCoord; 24} 25`;let e1=[{test:t=>"float"===t.type&&1===t.size&&!t.isArray,code:t=>` 26 if(uv["${t}"] !== ud["${t}"].value) 27 { 28 ud["${t}"].value = uv["${t}"] 29 gl.uniform1f(ud["${t}"].location, uv["${t}"]) 30 } 31 `},{test:(t,e)=>("sampler2D"===t.type||"samplerCube"===t.type||"sampler2DArray"===t.type)&&1===t.size&&!t.isArray&&(null==e||void 0!==e.castToBaseTexture),code:t=>`t = syncData.textureCount++; 32 33 renderer.texture.bind(uv["${t}"], t); 34 35 if(ud["${t}"].value !== t) 36 { 37 ud["${t}"].value = t; 38 gl.uniform1i(ud["${t}"].location, t); 39; // eslint-disable-line max-len 40 }`},{test:(t,e)=>"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a,code:t=>` 41 gl.uniformMatrix3fv(ud["${t}"].location, false, uv["${t}"].toArray(true)); 42 `,codeUbo:t=>` 43 var ${t}_matrix = uv.${t}.toArray(true); 44 45 data[offset] = ${t}_matrix[0]; 46 data[offset+1] = ${t}_matrix[1]; 47 data[offset+2] = ${t}_matrix[2]; 48 49 data[offset + 4] = ${t}_matrix[3]; 50 data[offset + 5] = ${t}_matrix[4]; 51 data[offset + 6] = ${t}_matrix[5]; 52 53 data[offset + 8] = ${t}_matrix[6]; 54 data[offset + 9] = ${t}_matrix[7]; 55 data[offset + 10] = ${t}_matrix[8]; 56 `},{test:(t,e)=>"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x,code:t=>` 57 cv = ud["${t}"].value; 58 v = uv["${t}"]; 59 60 if(cv[0] !== v.x || cv[1] !== v.y) 61 { 62 cv[0] = v.x; 63 cv[1] = v.y; 64 gl.uniform2f(ud["${t}"].location, v.x, v.y); 65 }`,codeUbo:t=>` 66 v = uv.${t}; 67 68 data[offset] = v.x; 69 data[offset+1] = v.y; 70 `},{test:t=>"vec2"===t.type&&1===t.size&&!t.isArray,code:t=>` 71 cv = ud["${t}"].value; 72 v = uv["${t}"]; 73 74 if(cv[0] !== v[0] || cv[1] !== v[1]) 75 { 76 cv[0] = v[0]; 77 cv[1] = v[1]; 78 gl.uniform2f(ud["${t}"].location, v[0], v[1]); 79 } 80 `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width,code:t=>` 81 cv = ud["${t}"].value; 82 v = uv["${t}"]; 83 84 if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) 85 { 86 cv[0] = v.x; 87 cv[1] = v.y; 88 cv[2] = v.width; 89 cv[3] = v.height; 90 gl.uniform4f(ud["${t}"].location, v.x, v.y, v.width, v.height) 91 }`,codeUbo:t=>` 92 v = uv.${t}; 93 94 data[offset] = v.x; 95 data[offset+1] = v.y; 96 data[offset+2] = v.width; 97 data[offset+3] = v.height; 98 `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>` 99 cv = ud["${t}"].value; 100 v = uv["${t}"]; 101 102 if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) 103 { 104 cv[0] = v.red; 105 cv[1] = v.green; 106 cv[2] = v.blue; 107 cv[3] = v.alpha; 108 gl.uniform4f(ud["${t}"].location, v.red, v.green, v.blue, v.alpha) 109 }`,codeUbo:t=>` 110 v = uv.${t}; 111 112 data[offset] = v.red; 113 data[offset+1] = v.green; 114 data[offset+2] = v.blue; 115 data[offset+3] = v.alpha; 116 `},{test:(t,e)=>"vec3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>` 117 cv = ud["${t}"].value; 118 v = uv["${t}"]; 119 120 if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) 121 { 122 cv[0] = v.red; 123 cv[1] = v.green; 124 cv[2] = v.blue; 125 126 gl.uniform3f(ud["${t}"].location, v.red, v.green, v.blue) 127 }`,codeUbo:t=>` 128 v = uv.${t}; 129 130 data[offset] = v.red; 131 data[offset+1] = v.green; 132 data[offset+2] = v.blue; 133 `},{test:t=>"vec4"===t.type&&1===t.size&&!t.isArray,code:t=>` 134 cv = ud["${t}"].value; 135 v = uv["${t}"]; 136 137 if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 138 { 139 cv[0] = v[0]; 140 cv[1] = v[1]; 141 cv[2] = v[2]; 142 cv[3] = v[3]; 143 144 gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3]) 145 }`}],e2={float:` 146 if (cv !== v) 147 { 148 cu.value = v; 149 gl.uniform1f(location, v); 150 }`,vec2:` 151 if (cv[0] !== v[0] || cv[1] !== v[1]) 152 { 153 cv[0] = v[0]; 154 cv[1] = v[1]; 155 156 gl.uniform2f(location, v[0], v[1]) 157 }`,vec3:` 158 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 159 { 160 cv[0] = v[0]; 161 cv[1] = v[1]; 162 cv[2] = v[2]; 163 164 gl.uniform3f(location, v[0], v[1], v[2]) 165 }`,vec4:` 166 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 167 { 168 cv[0] = v[0]; 169 cv[1] = v[1]; 170 cv[2] = v[2]; 171 cv[3] = v[3]; 172 173 gl.uniform4f(location, v[0], v[1], v[2], v[3]); 174 }`,int:` 175 if (cv !== v) 176 { 177 cu.value = v; 178 179 gl.uniform1i(location, v); 180 }`,ivec2:` 181 if (cv[0] !== v[0] || cv[1] !== v[1]) 182 { 183 cv[0] = v[0]; 184 cv[1] = v[1]; 185 186 gl.uniform2i(location, v[0], v[1]); 187 }`,ivec3:` 188 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 189 { 190 cv[0] = v[0]; 191 cv[1] = v[1]; 192 cv[2] = v[2]; 193 194 gl.uniform3i(location, v[0], v[1], v[2]); 195 }`,ivec4:` 196 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 197 { 198 cv[0] = v[0]; 199 cv[1] = v[1]; 200 cv[2] = v[2]; 201 cv[3] = v[3]; 202 203 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 204 }`,uint:` 205 if (cv !== v) 206 { 207 cu.value = v; 208 209 gl.uniform1ui(location, v); 210 }`,uvec2:` 211 if (cv[0] !== v[0] || cv[1] !== v[1]) 212 { 213 cv[0] = v[0]; 214 cv[1] = v[1]; 215 216 gl.uniform2ui(location, v[0], v[1]); 217 }`,uvec3:` 218 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 219 { 220 cv[0] = v[0]; 221 cv[1] = v[1]; 222 cv[2] = v[2]; 223 224 gl.uniform3ui(location, v[0], v[1], v[2]); 225 }`,uvec4:` 226 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 227 { 228 cv[0] = v[0]; 229 cv[1] = v[1]; 230 cv[2] = v[2]; 231 cv[3] = v[3]; 232 233 gl.uniform4ui(location, v[0], v[1], v[2], v[3]); 234 }`,bool:` 235 if (cv !== v) 236 { 237 cu.value = v; 238 gl.uniform1i(location, v); 239 }`,bvec2:` 240 if (cv[0] != v[0] || cv[1] != v[1]) 241 { 242 cv[0] = v[0]; 243 cv[1] = v[1]; 244 245 gl.uniform2i(location, v[0], v[1]); 246 }`,bvec3:` 247 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 248 { 249 cv[0] = v[0]; 250 cv[1] = v[1]; 251 cv[2] = v[2]; 252 253 gl.uniform3i(location, v[0], v[1], v[2]); 254 }`,bvec4:` 255 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 256 { 257 cv[0] = v[0]; 258 cv[1] = v[1]; 259 cv[2] = v[2]; 260 cv[3] = v[3]; 261 262 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 263 }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` 264 if (cv !== v) 265 { 266 cu.value = v; 267 268 gl.uniform1i(location, v); 269 }`,samplerCube:` 270 if (cv !== v) 271 { 272 cu.value = v; 273 274 gl.uniform1i(location, v); 275 }`,sampler2DArray:` 276 if (cv !== v) 277 { 278 cu.value = v; 279 280 gl.uniform1i(location, v); 281 }`},e3={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)"},e4={},e5=e4,e8,e6={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},e7=null,e9={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 it(t,e){if(!e7){let i=Object.keys(e9);e7={};for(let r=0;r<i.length;++r){let s=i[r];e7[t[s]]=e9[s]}}return e7[e]}function ie(t,e,i){if("precision"!==t.substring(0,9)){let r=e;return e===x.HIGH&&i!==x.HIGH&&(r=x.MEDIUM),`precision ${r} float; 282${t}`}return i!==x.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}let ii=0,ir={},is=class t{constructor(e,i,r="pixi-shader",n={}){this.extra={},this.id=ii++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=i||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=n,"#version"!==this.vertexSrc.substring(0,8)&&(ir[r=r.replace(/\s+/g,"-")]?(ir[r]++,r+=`-${ir[r]}`):ir[r]=1,this.vertexSrc=`#define SHADER_NAME ${r} 283${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r} 284${this.fragmentSrc}`,this.vertexSrc=ie(this.vertexSrc,t.defaultVertexPrecision,x.HIGH),this.fragmentSrc=ie(this.fragmentSrc,t.defaultFragmentPrecision,function(){if(!e8){e8=x.MEDIUM;let t=function(){if(e5===e4||e5?.isContextLost()){let t=A.ADAPTER.createCanvas(),e;A.PREFER_ENV>=s.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),e5=e}return e5}();if(t&&t.getShaderPrecisionFormat){let e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);e&&(e8=e.precision?x.HIGH:x.MEDIUM)}}return e8}())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return e0}static get defaultFragmentSrc(){return eJ}static from(e,i,r){let s=e+i,n=tU[s];return n||(tU[s]=n=new t(e,i,r)),n}};is.defaultVertexPrecision=x.HIGH,is.defaultFragmentPrecision=z.apple.device?x.HIGH:x.MEDIUM;let ia=is,io=0;class ih{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=io++,this.static=!!e,this.ubo=!!i,t instanceof eb?(this.buffer=t,this.buffer.type=T.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new eb(ne
284w Float32Array(1)),this.buffer.type=T.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(this.ubo)throw Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[t]=new ih(e,i)}static from(t,e,i){return new ih(t,e,i)}static uboFrom(t,e){return new ih(t,e??!0,!0)}}class il{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ih?this.uniformGroup=e:this.uniformGroup=new ih(e):this.uniformGroup=new ih({}),this.disposeRunner=new ef("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let i in e.uniforms){let r=e.uniforms[i];if(!0===r.group&&this.checkUniformExists(t,r))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){let r=ia.from(t,e);return new il(r,i)}}class iu{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let e=new Int32Array(t);for(let i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=ih.from({uSamplers:e},!0);let r=this.fragTemplate;r=(r=r.replace(/%count%/gi,`${t}`)).replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new ia(this.vertexSrc,r)}let s={tint:new Float32Array([1,1,1,1]),translationMatrix:new eH,default:this.defaultGroupCache[t]};return new il(this.programCache[t],s)}generateSampleSrc(t){let e="";e+=` 285`,e+=` 286`;for(let i=0;i<t;i++)i>0&&(e+=` 287else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=` 288{`,e+=` 289 color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=` 290}`;return e+=` 291`,e+=` 292`}}class id{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}class ic{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var ip=`varying vec2 vTextureCoord; 293varying vec4 vColor; 294varying float vTextureId; 295uniform sampler2D uSamplers[%count%]; 296 297void main(void){ 298 vec4 color; 299 %forloop% 300 gl_FragColor = color * vColor; 301} 302`,im=`precision highp float; 303attribute vec2 aVertexPosition; 304attribute vec2 aTextureCoord; 305attribute vec4 aColor; 306attribute float aTextureId; 307 308uniform mat3 projectionMatrix; 309uniform mat3 translationMatrix; 310uniform vec4 tint; 311 312varying vec2 vTextureCoord; 313varying vec4 vColor; 314varying float vTextureId; 315 316void main(void){ 317 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
317)).xy, 0.0, 1.0); 318 319 vTextureCoord = aTextureCoord; 320 vTextureId = aTextureId; 321 vColor = aColor * tint; 322} 323`;let ig=class t extends ic{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=eI,this.vertexSize=6,this.state=eu.for2d(),this.size=4*t.defaultBatchSize,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??function(t){let e=!0,i=A.ADAPTER.getNavigator();if(z.tablet||z.phone){if(z.apple.device){let r=i.userAgent.match(/OS (\d+)_(\d+)?/);r&&11>parseInt(r[1],10)&&(e=!1)}if(z.android.device){let s=i.userAgent.match(/Android\s([0-9.]*)/);s&&7>parseInt(s[1],10)&&(e=!1)}}return e?32:4}(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??!z.apple.device,this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return Y("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return im}static get defaultFragmentTemplate(){return ip}setShaderGenerator({vertex:e=t.defaultVertexSrc,fragment:i=t.defaultFragmentTemplate}={}){this.shaderGenerator=new iu(e,i)}contextChange(){let e=this.renderer.gl;A.PREFER_ENV===s.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),t.defaultMaxTextures),this.maxTextures=function(t,e){if(0===t)throw Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let i=e.createShader(e.FRAGMENT_SHADER);for(;;){let r=eh.replace(/%forloop%/gi,el(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}return t}(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:e,_textureArrayPool:i}=t,r=this.size/4,s=Math.floor(r/this.maxTextures)+1;for(;e.length<r;)e.push(new ex);for(;i.length<s;)i.push(new id);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:e,maxTextures:i}=this,r=t._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count,o=++ev._globalBatch,h=0,l=r[0],u=0;s.copyBoundTextures(n,i);for(let d=0;d<this._bufferSize;++d){let c=e[d];e[d]=null,c._batchEnabled!==o&&(l.count>=i&&(s.boundArray(l,n,o,i),this.buildDrawCalls(l,u,d),u=d,l=r[++h],++o),c._batchEnabled=o,c.touched=a,l.elements[l.count++]=c)}l.count>0&&(s.boundArray(l,n,o,i),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let f=0;f<n.length;f++)n[f]=null;ev._globalBatch=o}buildDrawCalls(e,i,r){let{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:a,vertexSize:o}=this,h=t._drawCallPool,l=this._dcIndex,u=this._aIndex,d=this._iIndex,c=h[l];c.start=this._iIndex,c.texArray=e;for(let f=i;f<r;++f){let p=s[f],m=p._texture.baseTexture,g=tI[m.alphaMode?1:0][p.blendMode];s[f]=null,i<f&&c.blend!==g&&(c.size=d-c.start,i=f,(c=h[++l]).texArray=e,c.start=d),this.packInterleavedGeometry(p,n,a,u,d),u+=p.vertexData.length/2*o,d+=p.indices.length,c.blend=g}i<r&&(c.size=d-c.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=d}bindAndClearTexArray(t){let e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){let{_packedGeometries:e,_attributeBuffer:i,_indexBuffer:r}=this;t.canUploadSameBuffer?(e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let e=this._dcIndex,{gl:i,state:r}=this.renderer,s=t._drawCallPool,n=null;for(let a=0;a<e;a++){let{texArray:o,type:h,size:l,start:u,blend:d}=s[a];n!==o&&(n=o,this.bindAndClearTexArray(o)),this.state.blendMode=d,r.set(this.state),i.drawElements(h,l,i.UNSIGNED_SHORT,2*u)}}flush(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),t.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=tP(Math.ceil(t/8)),i=tB(e),r=8*e;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let s=this._aBuffers[r];return s||(this._aBuffers[r]=s=new eo(r*this.vertexSize*4)),s}getIndexBuffer(t){let e=tP(Math.ceil(t/12)),i=tB(e);this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._iBuffers[i];return r||(this._iBuffers[i]=r=new Uint16Array(12*e)),r}packInterleavedGeometry(t,e,i,r,s){let{uint32View:n,float32View:a}=e,o=r/this.vertexSize,h=t.uvs,l=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,c=Math.min(t.worldAlpha,1),f=tR.shared.setValue(t._tintRGB).toPremultiplied(c,t._texture.baseTexture.alphaMode>0);for(let p=0;p<u.length;p+=2)a[r++]=u[p],a[r++]=u[p+1],a[r++]=h[p],a[r++]=h[p+1],n[r++]=f,a[r++]=d;for(let m=0;m<l.length;m++)i[s++]=o+l[m]}};ig.defaultBatchSize=4096,ig.extension={name:"batch",type:er.RendererPlugin},ig._drawCallPool=[],ig._textureArrayPool=[];let i_=ig;ea.add(i_);var iv=`varying vec2 vTextureCoord; 324 325uniform sampler2D uSampler; 326 327void main(void){ 328 gl_FragColor = texture2D(uSampler, vTextureCoord); 329} 330`,ix=`attribute vec2 aVertexPosition; 331 332uniform mat3 projectionMatrix; 333 334varying vec2 vTextureCoord; 335 336uniform vec4 inputSize; 337uniform vec4 outputFrame; 338 339vec4 filterVertexPosition( void ) 340{ 341 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 342
343 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 344} 345 346vec2 filterTextureCoord( void ) 347{ 348 return aVertexPosition * (outputFrame.zw * inputSize.zw); 349} 350 351void main(void) 352{ 353 gl_Position = filterVertexPosition(); 354 vTextureCoord = filterTextureCoord(); 355} 356`;let iy=class t extends il{constructor(e,i,r){let s=ia.from(e||t.defaultVertexSrc,i||t.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=t.defaultResolution,this.multisample=t.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new eu}apply(t,e,i,r,s){t.applyFilter(this,e,i,r)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return ix}static get defaultFragmentSrc(){return iv}};iy.defaultResolution=1,iy.defaultMultisample=E.NONE;let ib=iy;class iE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new tR(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:r}=t,s=i??e;void 0!==s&&(this.color=s),this.alpha=r}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}iE.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},iE.extension={type:[er.RendererSystem,er.CanvasRendererSystem],name:"background"},ea.add(iE);class iT{constructor(t){this.renderer=t,this.emptyRenderer=new ic(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,i,r){let{elements:s,ids:n,count:a}=t,o=0;for(let h=0;h<a;h++){let l=s[h],u=l._batchLocation;if(u>=0&&u<r&&e[u]===l){n[h]=u;continue}for(;o<r;){let d=e[o];if(d&&d._batchEnabled===i&&d._batchLocation===o){o++;continue}n[h]=o,l._batchLocation=o,e[o]=l;break}}}destroy(){this.renderer=null}}iT.extension={type:er.RendererSystem,name:"batch"},ea.add(iT);let iA=0;class iS{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=iA++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=iA++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;void 0!==e.addEventListener&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(A.PREFER_ENV>=s.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{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")};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(){let 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){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}iS.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},iS.extension={type:er.RendererSystem,name:"context"},ea.add(iS);class iw{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw 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 ef("disposeFramebuffer"),this.multisample=E.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ev(null,{scaleMode:f.NEAREST,resolution:1,mipmap:m.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ev(null,{scaleMode:f.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:m.OFF,format:l.DEPTH_COMPONENT,type:d.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 Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let r=this.colorTextures[i],s=r.resolution;r.setSize(t/s,e/s)}if(this.depthTexture){let n=this.depthTexture.resolution;this.depthTexture.setSize(t/n,e/n)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class iR extends ev{constructor(t={}){if("number"==typeof t){let e=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3];t={width:e,height:i,scaleMode:r,resolution:s}}t.width=t.width??100,t.height=t.height??100,t.multisample,t.multisample=E.NONE,super(null,t),this.mipmap=m.OFF,this.valid=!0,this._clear=new tR([0,0,0,0]),this.framebuffer=new iw(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.he
356ight)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class iI extends ep{constructor(t){let e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;super(e,i),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){void 0!==i||e.startsWith("data:")?!1!==i&&(t.crossOrigin="string"==typeof i?i:"anonymous"):t.crossOrigin=function(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location;let i=new URL(t,document.baseURI);return i.hostname!==e.hostname||i.port!==e.port||i.protocol!==e.protocol?"anonymous":""}(e)}upload(t,e,i,r){let s=t.gl,n=e.realWidth,a=e.realHeight;if(r=r||this.source,"u">typeof HTMLImageElement&&r instanceof HTMLImageElement){if(!r.complete||0===r.naturalWidth)return!1}else if("u">typeof HTMLVideoElement&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===g.UNPACK),this.noSubImage||e.target!==s.TEXTURE_2D||i.width!==n||i.height!==a?(i.width=n,i.height=a,s.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)):s.texSubImage2D(s.TEXTURE_2D,0,0,0,e.format,i.type,r),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class iC extends iI{constructor(t,e){if(e=e||{},"string"==typeof t){let i=new Image;iI.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??A.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.bitmap=null,this._load=null,!1!==e.autoLoad&&this.load()}load(t){return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise((t,e)=>{let i=this.source;this.url=i.src;let r=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};i.complete&&i.src?r():(i.onload=r,i.onerror=t=>{e(t),this.onError.emit(t)})})),this._load}process(){let t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(t=>t.blob()).then(i=>e(i,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===g.UNPACK?"premultiply":"none"})).then(t=>this.destroyed?Promise.reject():(this.bitmap=t,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let r=!0,s=e._glTextures;for(let n in s){let a=s[n];if(a!==i&&a.dirtyId!==e.dirtyId){r=!1;break}}r&&(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"u">typeof HTMLImageElement&&("string"==typeof t||t instanceof HTMLImageElement)}}class iM{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let r=e.width,s=e.height;if(i){let n=t.width/2/r,a=t.height/2/s,o=t.x/r+n,h=t.y/s+a;i=eq.add(i,eq.NW),this.x0=o+n*eq.uX(i),this.y0=h+a*eq.uY(i),i=eq.add(i,2),this.x1=o+n*eq.uX(i),this.y1=h+a*eq.uY(i),i=eq.add(i,2),this.x2=o+n*eq.uX(i),this.y2=h+a*eq.uY(i),i=eq.add(i,2),this.x3=o+n*eq.uX(i),this.y3=h+a*eq.uY(i)}else this.x0=t.x/r,this.y0=t.y/s,this.x1=(t.x+t.width)/r,this.y1=t.y/s,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/s,this.x3=t.x/r,this.y3=(t.y+t.height)/s;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}}iM.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}]`};let iP=new iM;function iD(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}class iB extends V{constructor(t,e,i,r,s,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new eL(0,0,1,1)),t instanceof iB&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=iP,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(s||0),!0===s)this._rotate=2;else if(this._rotate%2!=0)throw Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new eN(n.x,n.y):new eN(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update(
356)}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){let{resource:e}=this.baseTexture;e?.url&&tG[e.url]&&iB.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,iB.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new iB(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===iP&&(this._uvs=new iM),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=A.STRICT_TEXTURE_CACHE){let r="string"==typeof t,s=null;if(r)s=t;else if(t instanceof ev){if(!t.cacheId){let n=e?.pixiIdPrefix||"pixiid";t.cacheId=`${n}-${tF()}`,ev.addToCache(t,t.cacheId)}s=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${tF()}`}s=t._pixiId}let o=tG[s];if(r&&i&&!o)throw Error(`The cacheId "${s}" does not exist in TextureCache.`);return o||t instanceof ev?!o&&t instanceof ev&&(o=new iB(t),iB.addToCache(o,s)):(e.resolution||(e.resolution=tW(t)),(o=new iB(new ev(t,e))).baseTexture.cacheId=s,ev.addToCache(o.baseTexture,s),iB.addToCache(o,s)),o}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),r=iB.from(t,Object.assign({resourceOptions:i},e),!1),s=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):s.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,i,r){return new iB(ev.fromBuffer(t,e,i,r))}static fromLoader(t,e,i,r){let s=new ev(t,Object.assign({scaleMode:ev.defaultOptions.scaleMode,resolution:tW(e)},r)),{resource:n}=s;n instanceof iC&&(n.url=e);let a=new iB(s);return i||(i=e),ev.addToCache(a.baseTexture,i),iB.addToCache(a,i),i!==e&&(ev.addToCache(a.baseTexture,e),iB.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(t=>{a.baseTexture.once("loaded",()=>t(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),tG[e]&&tG[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),tG[e]=t)}static removeFromCache(t){if("string"==typeof t){let e=tG[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete tG[t],e}}else if(t?.textureCacheIds){for(let r=0;r<t.textureCacheIds.length;++r)tG[t.textureCacheIds[r]]===t&&delete tG[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:r,height:s}=t,n=e+r>this.baseTexture.width,a=i+s>this.baseTexture.height;if(n||a){let o=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,h=`Y: ${i} + ${s} = ${i+s} > ${this.baseTexture.height}`;throw Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${o} ${n&&a?"and":"or"} ${h}`)}this.valid=r&&s&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}
356static get EMPTY(){return iB._EMPTY||(iB._EMPTY=new iB(new ev),iD(iB._EMPTY),iD(iB._EMPTY.baseTexture)),iB._EMPTY}static get WHITE(){if(!iB._WHITE){let t=A.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),iB._WHITE=new iB(ev.from(t)),iD(iB._WHITE),iD(iB._WHITE.baseTexture)}return iB._WHITE}}class iN extends iB{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let r=this.baseTexture.resolution,s=Math.round(t*r)/r,n=Math.round(e*r)/r;this.valid=s>0&&n>0,this._frame.width=this.orig.width=s,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(s,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new iN(new iR(t))}}class iO{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=E.NONE){let r=new iR(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new iN(r)}getOptimalTexture(t,e,i=1,r=E.NONE){let s;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?s=r>1?-r:-1:(t=tP(t),e=tP(e),s=((65535&t)<<16|65535&e)>>>0,r>1&&(s+=4294967296*r)),this.texturePool[s]||(this.texturePool[s]=[]);let n=this.texturePool[s].pop();return n||(n=this.createTexture(t,e,r)),n.filterPoolKey=s,n.setResolution(i),n}getFilterTexture(t,e,i){let r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||E.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!1!==t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){for(let e in this.enableFullScreen=t.width>0&&t.height>0,this.texturePool){if(!(0>Number(e)))continue;let i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}iO.SCREEN_KEY=-1;class iL extends eR{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class iF extends eR{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new eb(this.vertices),this.uvBuffer=new eb(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class ik{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=E.NONE,this.sourceFrame=new eL,this.destinationFrame=new eL,this.bindingSourceFrame=new eL,this.bindingDestinationFrame=new eL,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}let iU=[new eN,new eN,new eN,new eN],iG=new eH;class iH{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new iO,this.statePool=[],this.quad=new iL,this.quadUv=new iF,this.tempRect=new eL,this.activeState={},this.globalUniforms=new ih({outputFrame:new eL,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}
356init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,r=this.defaultFilterStack,s=this.statePool.pop()||new ik,n=i.renderTexture,a,o;if(n.current){let h=n.current;a=h.resolution,o=h.multisample}else a=i.resolution,o=i.multisample;let l=e[0].resolution||a,u=e[0].multisample??o,d=e[0].padding,c=e[0].autoFit,f=e[0].legacy??!0;for(let p=1;p<e.length;p++){let m=e[p];l=Math.min(l,m.resolution||a),u=Math.min(u,m.multisample??o),d=this.useMaxPadding?Math.max(d,m.padding):d+m.padding,c=c&&m.autoFit,f=f||(m.legacy??!0)}1===r.length&&(this.defaultFilterStack[0].renderTexture=n.current),r.push(s),s.resolution=l,s.multisample=u,s.legacy=f,s.target=t,s.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),s.sourceFrame.pad(d);let g=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(iG.copyFrom(i.projection.transform).invert(),g),c?(s.sourceFrame.fit(g),(s.sourceFrame.width<=0||s.sourceFrame.height<=0)&&(s.sourceFrame.width=0,s.sourceFrame.height=0)):s.sourceFrame.intersects(g)||(s.sourceFrame.width=0,s.sourceFrame.height=0),this.roundFrame(s.sourceFrame,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),s.renderTexture=this.getOptimalFilterTexture(s.sourceFrame.width,s.sourceFrame.height,l,u),s.filters=e,s.destinationFrame.width=s.renderTexture.width,s.destinationFrame.height=s.renderTexture.height;let _=this.tempRect;_.x=0,_.y=0,_.width=s.sourceFrame.width,_.height=s.sourceFrame.height,s.renderTexture.filterFrame=s.sourceFrame,s.bindingSourceFrame.copyFrom(n.sourceFrame),s.bindingDestinationFrame.copyFrom(n.destinationFrame),s.transform=i.projection.transform,i.projection.transform=null,n.bind(s.renderTexture,s.sourceFrame,_),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;let s=r.inputSize,n=r.inputPixel,a=r.inputClamp;if(s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],n[0]=Math.round(s[0]*e.resolution),n[1]=Math.round(s[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*s[2]-.5*n[2],a[3]=e.sourceFrame.height*s[3]-.5*n[3],e.legacy){let o=r.filterArea;o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=e.sourceFrame.x,o[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,e.renderTexture,h.renderTexture,_.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let d=0;for(d=0;d<i.length-1;++d){1===d&&e.multisample>1&&((u=this.getOptimalFilterTexture(l.width,l.height,e.resolution)).filterFrame=l.filterFrame),i[d].apply(this,l,u,_.CLEAR,e);let c=l;l=u,u=c}i[d].apply(this,l,h.renderTexture,_.BLEND,e),d>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=_.CLEAR){let{renderTexture:i,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let s=this.tempRect;s.x=0,s.y=0,s.width=t.filterFrame.width,s.height=t.filterFrame.height,i.bind(t,t.filterFrame,s)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let n=1&r.stateId||this.forceClear;(e===_.CLEAR||e===_.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,r){let s=this.renderer;s.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(h.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(h.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:r}=this.activeState,{orig:s}=e._texture,n=t.set(r.width,0,0,r.height,i.x,i.y),a=e.worldTransform.copyTo(eH.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/s.width,1/s.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,r=E.NONE){return this.texturePool.getOptimalTexture(t,e,i,r)}getFilterTexture(t,e,i){if("number"==typeof t){let r=t;t=e,e=r}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||E.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}
356resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=iU[0],r=iU[1],s=iU[2],n=iU[3];i.set(e.left,e.top),r.set(e.left,e.bottom),s.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(s,s),t.apply(n,n);let a=Math.min(i.x,r.x,s.x,n.x),o=Math.min(i.y,r.y,s.y,n.y),h=Math.max(i.x,r.x,s.x,n.x),l=Math.max(i.y,r.y,s.y,n.y);e.x=a,e.y=o,e.width=h-a,e.height=l-o}roundFrame(t,e,i,r,s){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(s){let{a:n,b:a,c:o,d:h}=s;if((Math.abs(a)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(h)>1e-4))return}(s=s?iG.copyFrom(s):iG.identity()).translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}}}iH.extension={type:er.RendererSystem,name:"filter"},ea.add(iH);class iX{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=E.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}let iz=new eL;class iV{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new iw(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new eL,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;A.PREFER_ENV===s.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:r}=this;if(t){let s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=i),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let o=e.width>>i,h=e.height>>i,l=o/e.width;this.setViewport(e.x*l,e.y*l,o,h)}else{let u=t.width>>i,d=t.height>>i;this.setViewport(0,0,u,d)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,r){let s=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),(s.width!==i||s.height!==r||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=i,s.height=r,this.gl.viewport(t,e,i,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,r,s=a.COLOR|a.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,r),n.clear(s)}initFramebuffer(t){let{gl:e}=this,i=new iX(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let r;r=1===this.renderer.context.webGLVersion?e.DEPTH_STENCIL:t.depth&&t.stencil?e.DEPTH24_STENCIL8:t.depth?e.DEPTH_COMPONENT24:e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,r,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,r,t.width,t.height)}let s=t.colorTextures,n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){let o=s[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0),0===a&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,r=t.glFramebuffers[this.CONTEXT_UID],s=t.colorTextures,n=s.length;i.drawBuffers||(n=Math.min(n,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer():r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));let a=[];for(let o=0;o<n;o++){let h=s[o],l=h.parentTextureArray||h;this.renderer.texture.bind(l,0),0===o&&r.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+o,h.target,l._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+o))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let u=t.depthTexture;this.renderer.texture.bind(u,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,u._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||i.createRenderbuffer();let d,c;1===this.renderer.context.webGLVersion?(d=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH_STENCIL):t.depth&&t.stencil?(d=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH24_STENCIL8):t.depth?(d=i.DEPTH_ATTACHMENT,c=i.DEPTH_COMPONENT24):(d=i.STENCIL_ATTACHMENT,c=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,c,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,c,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,d,i.RENDERBUFFER,r.stencil)}else r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=E.NONE;if(t<=1||null===e)return i;for(let r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return 1===i&&(i=E.NONE),i}blit(t,e,i){let{current:r,renderer:s,gl:n,CONTEXT_UID:a}=this;if(2!==s.context.webGLVersion||!r)return;let o=r.glFramebuffers[a];if(!o)return;if(!t){if(!o.msaaBuffer)return;let h=r.colorTextures[0];if(!h)return;o.blitFramebuffer||(o.blitFramebuffer=new iw(r.width,r.height),o.blitFramebuffer.addColorTexture(0,h)),(t=o.blitFramebuffer).colorTextures[0]!==h&&(t.colorTextures[0]=h,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||((e=iz).width=r.width,e.height=r.height),i||(i=e);let l=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,o.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let s=this.managedFramebuffers.indexOf(t);s>
356=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,r=t.height,s=this.gl,n=e.stencil=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,n);let a,o;1===this.renderer.context.webGLVersion?(a=s.DEPTH_STENCIL_ATTACHMENT,o=s.DEPTH_STENCIL):t.depth?(a=s.DEPTH_STENCIL_ATTACHMENT,o=s.DEPTH24_STENCIL8):(a=s.STENCIL_ATTACHMENT,o=s.STENCIL_INDEX8),e.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,e.multisample,o,i,r):s.renderbufferStorage(s.RENDERBUFFER,o,i,r),s.framebufferRenderbuffer(s.FRAMEBUFFER,a,s.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new eL}destroy(){this.renderer=null}}iV.extension={type:er.RendererSystem,name:"framebuffer"},ea.add(iV);let iW={5126:4,5123:2,5121:1};class ij{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){let i=this.renderer.context.extensions.vertexArrayObject;A.PREFER_ENV===s.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=t=>i.bindVertexArrayOES(t),t.deleteVertexArray=t=>i.deleteVertexArrayOES(t)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(t,e)=>r.vertexAttribDivisorANGLE(t,e),t.drawElementsInstanced=(t,e,i,s,n)=>r.drawElementsInstancedANGLE(t,e,i,s,n),t.drawArraysInstanced=(t,e,i,s)=>r.drawArraysInstancedANGLE(t,e,i,s)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,r=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},s=!0);let n=r[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let r=t.buffers[i];e.update(r)}}checkCompatibility(t,e){let i=t.attributes,r=e.attributeData;for(let s in r)if(!i[s])throw Error(`shader and geometry incompatible, geometry missing the "${s}" attribute`)}getSignature(t,e){let i=t.attributes,r=e.attributeData,s=["g",t.id];for(let n in i)r[n]&&s.push(n,r[n].location);return s.join("-")}initGeometryVao(t,e,i=!0){let r=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[s]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let o=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID],l=h[o];if(l)return h[a.id]=l,l;let u=t.buffers,d=t.attributes,c={},f={};for(let p in u)c[p]=0,f[p]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),c[d[m].buffer]+=d[m].size*iW[d[m].type];for(let g in d){let _=d[g],v=_.size;void 0===_.stride&&(c[_.buffer]===v*iW[_.type]?_.stride=0:_.stride=c[_.buffer]),void 0===_.start&&(_.start=f[_.buffer],f[_.buffer]+=v*iW[_.type])}l=r.createVertexArray(),r.bindVertexArray(l);for(let x=0;x<u.length;x++){let y=u[x];n.bind(y),i&&y._glBuffers[s].refCount++}return this.activateVao(t,a),h[a.id]=l,h[o]=l,r.bindVertexArray(null),n.unbind(T.ARRAY_BUFFER),l}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,s=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),i){if(n)for(let a=0;a<s.length;a++){let o=s[a]._glBuffers[this.CONTEXT_UID];o&&(o.refCount--,0!==o.refCount||e||n.dispose(s[a],e))}if(!e){for(let h in i)if("g"===h[0]){let l=i[h];this._activeVao===l&&this.unbind(),r.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,r=this.CONTEXT_UID,s=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let o=null;for(let h in a){let l=a[h],u=n[l.buffer],d=u._glBuffers[r];if(e.attributeData[h]){o!==d&&(s.bind(u),o=d);let c=e.attributeData[h].location;if(i.enableVertexAttribArray(c),i.vertexAttribPointer(c,l.size,l.type||i.FLOAT,l.
356normalized,l.stride,l.start),l.instance){if(this.hasInstance)i.vertexAttribDivisor(c,l.divisor);else throw Error("geometry error, GPU Instancing is not supported on this device")}}}}draw(t,e,i,r){let{gl:s}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,o=2===a?s.UNSIGNED_SHORT:s.UNSIGNED_INT;2===a||4===a&&this.canUseUInt32ElementIndex?n.instanced?s.drawElementsInstanced(t,e||n.indexBuffer.data.length,o,(i||0)*a,r||1):s.drawElements(t,e||n.indexBuffer.data.length,o,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?s.drawArraysInstanced(t,i,e||n.getSize(),r||1):s.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}ij.extension={type:er.RendererSystem,name:"geometry"},ea.add(ij);let iY=new eH;class i${constructor(t,e){this._texture=t,this.mapCoord=new eH,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);let i=this.mapCoord;for(let r=0;r<t.length;r+=2){let s=t[r],n=t[r+1];e[r]=s*i.a+n*i.c+i.tx,e[r+1]=s*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let r=e.orig,s=e.trim;s&&(iY.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(iY));let n=e.baseTexture,a=this.uClampFrame,o=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+o+h)/n.width,a[1]=(e._frame.y+o+h)/n.height,a[2]=(e._frame.x+e._frame.width-o+h)/n.width,a[3]=(e._frame.y+e._frame.height-o+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&0===e.rotate,!0}}var iq=`varying vec2 vMaskCoord; 357varying vec2 vTextureCoord; 358 359uniform sampler2D uSampler; 360uniform sampler2D mask; 361uniform float alpha; 362uniform float npmAlpha; 363uniform vec4 maskClamp; 364 365void main(void) 366{ 367 float clip = step(3.5, 368 step(maskClamp.x, vMaskCoord.x) + 369 step(maskClamp.y, vMaskCoord.y) + 370 step(vMaskCoord.x, maskClamp.z) + 371 step(vMaskCoord.y, maskClamp.w)); 372 373 vec4 original = texture2D(uSampler, vTextureCoord);
374 vec4 masky = texture2D(mask, vMaskCoord); 375 float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); 376 377 original *= (alphaMul * masky.r * alpha * clip); 378 379 gl_FragColor = original; 380} 381`,iK=`attribute vec2 aVertexPosition; 382attribute vec2 aTextureCoord; 383 384uniform mat3 projectionMatrix; 385uniform mat3 otherMatrix; 386 387varying vec2 vMaskCoord; 388varying vec2 vTextureCoord; 389 390void main(void) 391{ 392 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 393 394 vTextureCoord = aTextureCoord; 395 vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy; 396} 397`;class iZ extends ib{constructor(t,e,i){let r=null;"string"!=typeof t&&void 0===e&&void 0===i&&(r=t,t=void 0,e=void 0,i=void 0),super(t||iK,e||iq,i),this.maskSprite=r,this.maskMatrix=new eH}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,r){let s=this._maskSprite,n=s._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new i$(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,s).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=s.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,r))}}class iQ{constructor(t=null){this.type=y.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ib.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=y.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class iJ{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let r=this.maskDataPool.pop()||new iQ;r.pooled=!0,r.maskObject=e,i=r}let s=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==y.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case y.SCISSOR:this.renderer.scissor.push(i);break;case y.STENCIL:this.renderer.stencil.push(i);break;case y.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case y.COLOR:this.pushColorMask(i)}i.type===y.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case y.SCISSOR:this.renderer.scissor.pop(e);break;case y.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case y.SPRITE:this.popSpriteMask(e);break;case y.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){let i=this.maskStack[this.maskStack.length-1];i.type===y.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=y.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=y.SCISSOR:t.type=y.STENCIL:t.type=y.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex])||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new iZ]),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;let s=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,r),i.filterArea=s,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((1&i)!=0,(2&i)!=0,(4&i)!=0,(8&i)!=0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((1&i)!=0,(2&i)!=0,(4&i)!=0,(8&i)!=0)}destroy(){this.renderer=null}}iJ.extension={type:er.RendererSystem,name:"mask"},ea.add(iJ);class i0{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let r=this.getStackLength();r!==i&&(0===r?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}let i1=new eH,i2=[],i3=class t extends i0{constructor(t){super(t),this.glConst=A.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}
397calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:r}=this,s=r.renderTexture,n=i.getBounds(!0,i2.pop()??new eL);this.roundFrameToPixels(n,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:r,d:s}=t;return(Math.abs(i)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(e){let{maskObject:i}=e;if(!i.isFastRect||!i.isFastRect()||t.isMatrixRotated(i.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let r=e._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(e,i,r,s,n){t.isMatrixRotated(n)||((n=n?i1.copyFrom(n):i1.identity()).translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,e),e.fit(s),e.x=Math.round(e.x*i),e.y=Math.round(e.y*i),e.width=Math.round(e.width*i),e.height=Math.round(e.height*i))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&i2.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,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)}};i3.extension={type:er.RendererSystem,name:"scissor"},ea.add(i3);class i4 extends i0{constructor(t){super(t),this.glConst=A.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,r=t._stencilCounter;0===r&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let s=t._colorMask;0!==s&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==s&&(t._colorMask=s,i.colorMask((1&s)!=0,(2&s)!=0,(4&s)!=0,(8&s)!=0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{let i=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;0!==r&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==r&&(i._colorMask=r,e.colorMask((1&r)!=0,(2&r)!=0,(4&r)!=0,(8&r)!=0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}i4.extension={type:er.RendererSystem,name:"stencil"},ea.add(i4);class i5{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(Y("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(Y("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(Y("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events)}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}i5.extension={type:[er.RendererSystem,er.CanvasRendererSystem],name:"_plugin"},ea.add(i5);class i8{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new eH,this.transform=null}update(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);let s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)}
397calculateProjection(t,e,i,r){let s=this.projectionMatrix,n=r?-1:1;s.identity(),s.a=1/e.width*2,s.d=n*(1/e.height*2),s.tx=-1-e.x*s.a,s.ty=-n-e.y*s.d}setTransform(t){}destroy(){this.renderer=null}}i8.extension={type:er.RendererSystem,name:"projection"},ea.add(i8);let i6=new eQ,i7=new eL;class i9{constructor(t){this.renderer=t,this._tempMatrix=new eH}generateTexture(t,e){let{region:i,...r}=e||{},s=i?.copyTo(i7)||t.getLocalBounds(i7,!0),n=r.resolution||this.renderer.resolution;s.width=Math.max(s.width,1/n),s.height=Math.max(s.height,1/n),r.width=s.width,r.height=s.height,r.resolution=n,r.multisample,r.multisample=this.renderer.multisample;let a=iN.create(r);this._tempMatrix.tx=-s.x,this._tempMatrix.ty=-s.y;let o=t.transform;return t.transform=i6,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,a}destroy(){}}i9.extension={type:[er.RendererSystem,er.CanvasRendererSystem],name:"textureGenerator"},ea.add(i9);let rt=new eL,re=new eL;class ri{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new eL,this.destinationFrame=new eL,this.viewportFrame=new eL}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let r=this.renderer;this.current=t;let s,n,a;t?(a=(s=t.baseTexture).resolution,e||(rt.width=t.frame.width,rt.height=t.frame.height,e=rt),i||(re.x=t.frame.x,re.y=t.frame.y,re.width=e.width,re.height=e.height,i=re),n=s.framebuffer):(a=r.resolution,e||(rt.width=r._view.screen.width,rt.height=r._view.screen.height,e=rt),i||((i=rt).width=e.width,i.height=e.height));let o=this.viewportFrame;o.x=i.x*a,o.y=i.y*a,o.width=i.width*a,o.height=i.height*a,t||(o.y=r.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(n,o),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=tR.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);let s=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=s.width!==n.width||s.height!==n.height;if(a){let{x:o,y:h,width:l,height:u}=this.viewportFrame;o=Math.round(o),h=Math.round(h),l=Math.round(l),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,h,l,u)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}ri.extension={type:er.RendererSystem,name:"renderTexture"},ea.add(ri);class rr{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 rs(t,e,i){let r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),r}function rn(t){let e=Array(t);for(let i=0;i<e.length;i++)e[i]=!1;return e}function ra(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return rn(2*e);case"bvec3":return rn(3*e);case"bvec4":return rn(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}function ro(t,e){let i=t.getShaderSource(e).split(` 398`).map((t,e)=>`${e}: ${t}`),r=t.getShaderInfoLog(e),s=r.split(` 399`),n={},a=s.map(t=>
399parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(t=>!!t&&!n[t]&&(n[t]=!0,!0)),o=[""];a.forEach(t=>{i[t-1]=`%c${i[t-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=i.join(` 400`);o[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function rh(t,e,i,r,s){i.buffer.update(s)}let rl={float:` 401 data[offset] = v; 402 `,vec2:` 403 data[offset] = v[0]; 404 data[offset+1] = v[1]; 405 `,vec3:` 406 data[offset] = v[0]; 407 data[offset+1] = v[1]; 408 data[offset+2] = v[2]; 409 410 `,vec4:` 411 data[offset] = v[0]; 412 data[offset+1] = v[1]; 413 data[offset+2] = v[2]; 414 data[offset+3] = v[3]; 415 `,mat2:` 416 data[offset] = v[0]; 417 data[offset+1] = v[1]; 418 419 data[offset+4] = v[2]; 420 data[offset+5] = v[3]; 421 `,mat3:` 422 data[offset] = v[0]; 423 data[offset+1] = v[1]; 424 data[offset+2] = v[2]; 425 426 data[offset + 4] = v[3]; 427 data[offset + 5] = v[4]; 428 data[offset + 6] = v[5]; 429 430 data[offset + 8] = v[6]; 431 data[offset + 9] = v[7]; 432 data[offset + 10] = v[8]; 433 `,mat4:` 434 for(var i = 0; i < 16; i++) 435 { 436 data[offset + i] = v[i]; 437 } 438 `},ru={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},rd,rc=0,rf={textureCount:0,uboCount:0};class rp{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=rc++}systemCheck(){if(!function(){if("boolean"==typeof rd)return rd;try{rd=!0===Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")}catch{rd=!1}return rd}())throw 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;let i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(rf.textureCount=0,rf.uboCount=0,this.syncUniformGroup(t.uniformGroup,rf)),r}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();t.static&&t.dirtyId===i.uniformDirtyGroups[t.id]||(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){let i=[` 439 var v = null; 440 var cv = null; 441 var cu = null; 442 var t = 0; 443 var gl = renderer.gl; 444 `];for(let r in t.uniforms){let s=e[r];if(!s){t.uniforms[r]?.group===!0&&(t.uniforms[r].ubo?i.push(` 445 renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}'); 446 `):i.push(` 447 renderer.shader.syncUniformGroup(uv.${r}, syncData); 448 `));continue}let n=t.uniforms[r],a=!1;for(let o=0;o<e1.length;o++)if(e1[o].test(s,n)){i.push(e1[o].code(r,n)),a=!0;break}if(!a){let h=(1!==s.size||s.isArray?e3:e2)[s.type].replace("location",`ud["${r}"].location`);i.push(` 449 cu = ud["${r}"]; 450 cv = cu.value; 451 v = uv["${r}"]; 452 ${h};`)}}return Function("ud","uv","renderer","syncData",i.join(` 453`))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||0!==t.dirtyId||!i.uniformGroups[t.id]){t.dirtyId=0;let r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,rf,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}
453createSyncBufferGroup(t,e,i){let{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);let s=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=function(t,e){if(!t.autoManage)return{size:0,syncFunc:rh};let i=function(t,e){let i=[];for(let r in t)e[r]&&i.push(e[r]);return i.sort((t,e)=>t.index-e.index),i}(t.uniforms,e),{uboElements:r,size:s}=function(t){let e=t.map(t=>({data:t,offset:0,dataLen:0,dirty:0})),i=0,r=0,s=0;for(let n=0;n<e.length;n++){let a=e[n];if(i=ru[a.data.type],a.data.size>1&&(i=Math.max(i,16)*a.data.size),a.dataLen=i,r%i!=0&&r<16){let o=r%i%16;r+=o,s+=o}r+i>16?(s=16*Math.ceil(s/16),a.offset=s,s+=i,r=i):(a.offset=s,r+=i,s+=i)}return{uboElements:e,size:s=16*Math.ceil(s/16)}}(i),n=[` 454 var v = null; 455 var v2 = null; 456 var cv = null; 457 var t = 0; 458 var gl = renderer.gl 459 var index = 0; 460 var data = buffer.data; 461 `];for(let a=0;a<r.length;a++){let o=r[a],h=t.uniforms[o.data.name],l=o.data.name,u=!1;for(let d=0;d<e1.length;d++){let c=e1[d];if(c.codeUbo&&c.test(o.data,h)){n.push(`offset = ${o.offset/4};`,e1[d].codeUbo(o.data.name,h)),u=!0;break}}if(!u){if(o.data.size>1){var f;let p=e6[f=o.data.type],m=Math.max(ru[o.data.type]/16,1),g=p/m,_=(4-g%4)%4;n.push(` 462 cv = ud.${l}.value; 463 v = uv.${l}; 464 offset = ${o.offset/4}; 465 466 t = 0; 467 468 for(var i=0; i < ${o.data.size*m}; i++) 469 { 470 for(var j = 0; j < ${g}; j++) 471 { 472 data[offset++] = v[t++]; 473 } 474 offset += ${_}; 475 } 476 477 `)}else{let v=rl[o.data.type];n.push(` 478 cv = ud.${l}.value; 479 v = uv.${l}; 480 offset = ${o.offset/4}; 481 ${v}; 482 `)}}}return n.push(` 483 renderer.buffer.update(buffer); 484 `),{size:s,syncFunc:Function("ud","uv","renderer","syncData","buffer",n.join(` 485`))}}(t,this.shader.program.uniformData)),t.autoManage){let o=new Float32Array(a.size/4);t.buffer.update(o)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let r=t.uniforms,s=[`${i}-`];for(let n in r)s.push(n),e[n]&&s.push(e[n].type);return s.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,r=function(t,e){var i,r,s,n;let a=rs(t,t.VERTEX_SHADER,e.vertexSrc),o=rs(t,t.FRAGMENT_SHADER,e.fragmentSrc),h=t.createProgram();t.attachShader(h,a),t.attachShader(h,o);let l=e.extra?.transformFeedbackVaryings;if(l&&("function"!=typeof t.transformFeedbackVaryings?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(h,l.names,"separate"===l.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(h),t.getProgramParameter(h,t.LINK_STATUS)||t.getProgramParameter(h,t.LINK_STATUS)||(t.getShaderParameter(a,t.COMPILE_STATUS)||ro(t,a),t.getShaderParameter(o,t.COMPILE_STATUS)||ro(t,o),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(h)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(h))),e.attributeData=function(t,e){let i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){var n;let a=e.getActiveAttrib(t,s);if(a.name.startsWith("gl_"))continue;let o=it(e,a.type),h={type:o,name:a.name,size:e6[o],location:e.getAttribLocation(t,a.name)};i[a.name]=h}return i}(h,t),e.uniformData=function(t,e){let i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let n=e.getActiveUniform(t,s),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),h=it(e,n.type);i[a]={name:a,index:s,type:h,size:n.size,isArray:o,value:ra(h,n.size)}}return i}(h,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){let u=Object.keys(e.attributeData);u.sort((t,e)=>t>e?1:-1);for(let d=0;d<u.length;d++)e.attributeData[u[d]].location=d,t.bindAttribLocation(h,d,u[d]);t.linkProgram(h)}t.deleteShader(a),t.deleteShader(o);let c={};for(let f in e.uniformData){let p=e.uniformData[f];c[f]={location:t.getUniformLocation(h,f),value:ra(p.type,p.size)}}return new rr(h,c)}(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}rp.extension={type:er.RendererSystem,name:"shader"},ea.add(rp);class rm{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}rm.defaultOptions={hello:!1},rm.extension={type:[er.RendererSystem,er.CanvasRendererSystem],name:"startup"},ea.add(rm);let rg=class t{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=o.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new eu,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=function(t,e=[]){return e[o.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.ADD]=[t.ONE,t.ONE],e[o.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.NONE]=[0,0],e[o.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[o.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[o.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[o.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[o.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[o.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[o.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[o.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[o.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[o.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)1&e&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let i=0;i<this.checks.length;i++)this.checks[i](this,t);this.stateId=t.data}setBlend(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;
4852===e.length?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&-1===i?this.checks.push(t):e||-1===i||this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};rg.extension={type:er.RendererSystem,name:"state"},ea.add(rg);class r_ extends V{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(e=>t.systems[e]),i=[...e,...Object.keys(t.systems).filter(t=>!e.includes(t))];for(let r of i)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(t=>{this.runners[t]=new ef(t)})}addSystem(t,e){let i=new t(this);if(this[e])throw Error(`Whoops! The name "${e}" is already in use`);for(let r in this[e]=i,this._systemsHash[e]=i,this.runners)this.runners[r].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(r=>{let s=i.find(t=>this._systemsHash[t]===r);r[t.name](e[s])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}let rv=class t{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=t.defaultMaxIdle,this.checkCountMax=t.defaultCheckCountMax,this.mode=t.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==v.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let r=0;r<e.length;r++){let s=e[r];s.resource&&this.count-s.touched>
485this.maxIdle&&(t.destroyTexture(s,!0),e[r]=null,i=!0)}if(i){let n=0;for(let a=0;a<e.length;a++)null!==e[a]&&(e[n++]=e[a]);e.length=n}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};rv.defaultMode=v.AUTO,rv.defaultMaxIdle=3600,rv.defaultCheckCountMax=600,rv.extension={type:er.RendererSystem,name:"textureGC"};let rx=rv;ea.add(rx);class ry{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=d.UNSIGNED_BYTE,this.internalFormat=l.RGBA,this.samplerType=0}}class rb{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ev,this.hasIntegerTextures=!1}contextChange(){var t,e;let i=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats="WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?{[d.UNSIGNED_BYTE]:{[l.RGBA]:i.RGBA8,[l.RGB]:i.RGB8,[l.RG]:i.RG8,[l.RED]:i.R8,[l.RGBA_INTEGER]:i.RGBA8UI,[l.RGB_INTEGER]:i.RGB8UI,[l.RG_INTEGER]:i.RG8UI,[l.RED_INTEGER]:i.R8UI,[l.ALPHA]:i.ALPHA,[l.LUMINANCE]:i.LUMINANCE,[l.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[d.BYTE]:{[l.RGBA]:i.RGBA8_SNORM,[l.RGB]:i.RGB8_SNORM,[l.RG]:i.RG8_SNORM,[l.RED]:i.R8_SNORM,[l.RGBA_INTEGER]:i.RGBA8I,[l.RGB_INTEGER]:i.RGB8I,[l.RG_INTEGER]:i.RG8I,[l.RED_INTEGER]:i.R8I},[d.UNSIGNED_SHORT]:{[l.RGBA_INTEGER]:i.RGBA16UI,[l.RGB_INTEGER]:i.RGB16UI,[l.RG_INTEGER]:i.RG16UI,[l.RED_INTEGER]:i.R16UI,[l.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[d.SHORT]:{[l.RGBA_INTEGER]:i.RGBA16I,[l.RGB_INTEGER]:i.RGB16I,[l.RG_INTEGER]:i.RG16I,[l.RED_INTEGER]:i.R16I},[d.UNSIGNED_INT]:{[l.RGBA_INTEGER]:i.RGBA32UI,[l.RGB_INTEGER]:i.RGB32UI,[l.RG_INTEGER]:i.RG32UI,[l.RED_INTEGER]:i.R32UI,[l.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[d.INT]:{[l.RGBA_INTEGER]:i.RGBA32I,[l.RGB_INTEGER]:i.RGB32I,[l.RG_INTEGER]:i.RG32I,[l.RED_INTEGER]:i.R32I},[d.FLOAT]:{[l.RGBA]:i.RGBA32F,[l.RGB]:i.RGB32F,[l.RG]:i.RG32F,[l.RED]:i.R32F,[l.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[d.HALF_FLOAT]:{[l.RGBA]:i.RGBA16F,[l.RGB]:i.RGB16F,[l.RG]:i.RG16F,[l.RED]:i.R16F},[d.UNSIGNED_SHORT_5_6_5]:{[l.RGB]:i.RGB565},[d.UNSIGNED_SHORT_4_4_4_4]:{[l.RGBA]:i.RGBA4},[d.UNSIGNED_SHORT_5_5_5_1]:{[l.RGBA]:i.RGB5_A1},[d.UNSIGNED_INT_2_10_10_10_REV]:{[l.RGBA]:i.RGB10_A2,[l.RGBA_INTEGER]:i.RGB10_A2UI},[d.UNSIGNED_INT_10F_11F_11F_REV]:{[l.RGB]:i.R11F_G11F_B10F},[d.UNSIGNED_INT_5_9_9_9_REV]:{[l.RGB]:i.RGB9_E5},[d.UNSIGNED_INT_24_8]:{[l.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[d.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[l.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:{[d.UNSIGNED_BYTE]:{[l.RGBA]:i.RGBA,[l.RGB]:i.RGB,[l.ALPHA]:i.ALPHA,[l.LUMINANCE]:i.LUMINANCE,[l.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[d.UNSIGNED_SHORT_5_6_5]:{[l.RGB]:i.RGB},[d.UNSIGNED_SHORT_4_4_4_4]:{[l.RGBA]:i.RGBA},[d.UNSIGNED_SHORT_5_5_5_1]:{[l.RGBA]:i.RGBA}},this.samplerTypes="WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?{[i.RGB]:c.FLOAT,[i.RGBA]:c.FLOAT,[i.ALPHA]:c.FLOAT,[i.LUMINANCE]:c.FLOAT,[i.LUMINANCE_ALPHA]:c.FLOAT,[i.R8]:c.FLOAT,[i.R8_SNORM]:c.FLOAT,[i.RG8]:c.FLOAT,[i.RG8_SNORM]:c.FLOAT,[i.RGB8]:c.FLOAT,[i.RGB8_SNORM]:c.FLOAT,[i.RGB565]:c.FLOAT,[i.RGBA4]:c.FLOAT,[i.RGB5_A1]:c.FLOAT,[i.RGBA8]:c.FLOAT,[i.RGBA8_SNORM]:c.FLOAT,[i.RGB10_A2]:c.FLOAT,[i.RGB10_A2UI]:c.FLOAT,[i.SRGB8]:c.FLOAT,[i.SRGB8_ALPHA8]:c.FLOAT,[i.R16F]:c.FLOAT,[i.RG16F]:c.FLOAT,[i.RGB16F]:c.FLOAT,[i.RGBA16F]:c.FLOAT,[i.R32F]:c.FLOAT,[i.RG32F]:c.FLOAT,[i.RGB32F]:c.FLOAT,[i.RGBA32F]:c.FLOAT,[i.R11F_G11F_B10F]:c.FLOAT,[i.RGB9_E5]:c.FLOAT,[i.R8I]:c.INT,[i.R8UI]:c.UINT,[i.R16I]:c.INT,[i.R16UI]:c.UINT,[i.R32I]:c.INT,[i.R32UI]:c.UINT,[i.RG8I]:c.INT,[i.RG8UI]:c.UINT,[i.RG16I]:c.INT,[i.RG16UI]:c.UINT,[i.RG32I]:c.INT,[i.RG32UI]:c.UINT,[i.RGB8I]:c.INT,[i.RGB8UI]:c.UINT,[i.RGB16I]:c.INT,[i.RGB16UI]:c.UINT,[i.RGB32I]:c.INT,[i.RGB32UI]:c.UINT,[i.RGBA8I]:c.INT,[i.RGBA8UI]:c.UINT,[i.RGBA16I]:c.INT,[i.RGBA16UI]:c.UINT,[i.RGBA32I]:c.INT,[i.RGBA32UI]:c.UINT,[i.DEPTH_COMPONENT16]:c.FLOAT,[i.DEPTH_COMPONENT24]:c.FLOAT,[i.DEPTH_COMPONENT32F]:c.FLOAT,[i.DEPTH_STENCIL]:c.FLOAT,[i.DEPTH24_STENCIL8]:c.FLOAT,[i.DEPTH32F_STENCIL8]:c.FLOAT}:{[i.RGB]:c.FLOAT,[i.RGBA]:c.FLOAT,[i.ALPHA]:c.FLOAT,[i.LUMINANCE]:c.FLOAT,[i.LUMINANCE_ALPHA]:c.FLOAT,[i.DEPTH_STENCIL]:c.FLOAT};let r=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=r;for(let s=0;s<r;s++)this.boundTextures[s]=null;this.emptyTextures={};let n=new ry(i.createTexture());i.bindTexture(i.TEXTURE_2D,n.texture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[i.TEXTURE_2D]=n,this.emptyTextures[i.TEXTURE_CUBE_MAP]=new ry(i.createTexture()),i.bindTexture(i.TEXTURE_CUBE_MAP,this.emptyTextures[i.TEXTURE_CUBE_MAP].texture);for(let a=0;a<6;a++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,null);i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MIN_FILTER,i.LINEAR);for(let o=0;o<this.boundTextures.length;o++)this.bind(null,o)}bind(t,e=0){let{gl:i}=this;if((t=t?.castToBaseTexture())?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(i)for(let s=t-1;s>=0;--s){let n=e[s];n&&n._glTextures[r].samplerType!==c.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new ry(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??c.FLOAT,2===this.webGLVersion&&t.type===d.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==c.FLOAT&&(this.hasIntegerTextures=!0);else{let r=t.realWidth,s=t.realHeight,n=i.gl;(e.width!==r||e.height!==s||e.dirtyId<0)&&(e.width=r,e.height=s,n.texImage2D(t.target,0,e.internalFormat,r,s,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let r=this.managedTextures.indexOf(t);-1!==r&&tN(this.managedTextures,r,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==m.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=p.CLAMP,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==m.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===f.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===f.LINEAR){let s=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===f.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===f.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}rb.extension={type:er.RendererSystem,name:"texture"},ea.add(rb);class rE{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,r=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:r}=this;e&&r.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:r}=this,s=e.createTransformFeedback();t._glTransformFeedbacks[r]=s,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),s}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;
485t.disposeRunner.remove(this);let s=this.renderer.buffer;if(s)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let o=a._glBuffers[this.CONTEXT_UID];o&&(o.refCount--,0!==o.refCount||e||s.dispose(a,e))}i&&(e||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}rE.extension={type:er.RendererSystem,name:"transformFeedback"},ea.add(rE);class rT{constructor(t){this.renderer=t}init(t){this.screen=new eL(0,0,t.width,t.height),this.element=t.view||A.ADAPTER.createCanvas(),this.resolution=t.resolution||A.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}rT.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},rT.extension={type:[er.RendererSystem,er.CanvasRendererSystem],name:"_view"},ea.add(rT),A.PREFER_ENV=s.WEBGL2,A.STRICT_TEXTURE_CACHE=!1,A.RENDER_OPTIONS={...iS.defaultOptions,...iE.defaultOptions,...rT.defaultOptions,...rm.defaultOptions},Object.defineProperties(A,{WRAP_MODE:{get:()=>ev.defaultOptions.wrapMode,set(t){Y("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ev.defaultOptions.wrapMode=t}},SCALE_MODE:{get:()=>ev.defaultOptions.scaleMode,set(t){Y("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ev.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get:()=>ev.defaultOptions.mipmap,set(t){Y("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ev.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get:()=>ev.defaultOptions.anisotropicLevel,set(t){Y("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ev.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get:()=>(Y("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ib.defaultResolution),set(t){ib.defaultResolution=t}},FILTER_MULTISAMPLE:{get:()=>(Y("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ib.defaultMultisample),set(t){ib.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get:()=>i_.defaultMaxTextures,set(t){Y("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),i_.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get:()=>i_.defaultBatchSize,set(t){Y("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),i_.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get:()=>i_.canUploadSameBuffer,set(t){Y("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),i_.canUploadSameBuffer=t}},GC_MODE:{get:()=>rx.defaultMode,set(t){Y("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),rx.defaultMode=t}},GC_MAX_IDLE:{get:()=>rx.defaultMaxIdle,set(t){Y("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),rx.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get:()=>rx.defaultCheckCountMax,set(t){Y("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),rx.defaultCheckCountMax=t}},PRECISION_VERTEX:{get:()=>ia.defaultVertexPrecision,set(t){Y("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),ia.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get:()=>ia.defaultFragmentPrecision,set(t){Y("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),ia.defaultFragmentPrecision=t}}});var rA=((sS=rA||{})[sS.INTERACTION=50]="INTERACTION",sS[sS.HIGH=25]="HIGH",sS[sS.NORMAL=0]="NORMAL",sS[sS.LOW=-25]="LOW",sS[sS.UTILITY=-50]="UTILITY",sS);class rS{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}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));let 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.
485next,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);let e=this.next;return this.next=t?null:e,this.previous=null,e}}let rw=class t{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 rS(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.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,i=rA.NORMAL){return this._addListener(new rS(t,e,i))}addOnce(t,e,i=rA.NORMAL){return this._addListener(new rS(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let i;if(e>this.lastTime){if((i=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){let r=e-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=e-r%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*t.targetFPMS;let s=this._head,n=s.next;for(;n;
485)n=n.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let i=Math.min(this.maxFPS,e),r=Math.min(Math.max(0,i)/1e3,t.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(0===t)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!t._shared){let e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){let e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};rw.targetFPMS=.06;let rR=rw;Object.defineProperties(A,{TARGET_FPMS:{get:()=>rR.targetFPMS,set(t){Y("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),rR.targetFPMS=t}}});class rI{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,rA.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?rR.shared:new rR,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}}rI.extension=er.Application,ea.add(rI);let rC=[];ea.handleByList(er.Renderer,rC);var rM=`attribute vec2 aVertexPosition; 486attribute vec2 aTextureCoord; 487 488uniform mat3 projectionMatrix; 489 490varying vec2 vTextureCoord; 491 492void main(void) 493{ 494 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
494)).xy, 0.0, 1.0); 495 vTextureCoord = aTextureCoord; 496}`,rP=`attribute vec2 aVertexPosition; 497 498uniform mat3 projectionMatrix; 499 500varying vec2 vTextureCoord; 501 502uniform vec4 inputSize; 503uniform vec4 outputFrame; 504 505vec4 filterVertexPosition( void ) 506{ 507 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 508 509 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 510} 511 512vec2 filterTextureCoord( void ) 513{ 514 return aVertexPosition * (outputFrame.zw * inputSize.zw); 515} 516 517void main(void) 518{ 519 gl_Position = filterVertexPosition(); 520 vTextureCoord = filterTextureCoord(); 521} 522`;class rD{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=E.HIGH?this.multisample=E.HIGH:e>=E.MEDIUM?this.multisample=E.MEDIUM:e>=E.LOW?this.multisample=E.LOW:this.multisample=E.NONE}destroy(){}}rD.extension={type:er.RendererSystem,name:"_multisample"},ea.add(rD);class rB{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class rN{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){let{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){let s=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,i){let{gl:r,CONTEXT_UID:s}=this;i=i||0;let n=t._glBuffers[s]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,n.buffer,256*i,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==r.updateID){if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let s=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,s)}}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new rB(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}rN.extension={type:er.RendererSystem,name:"buffer"},ea.add(rN);class rO{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,r,s,n,a;if(e&&(r=e.renderTexture,s=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(r||(this.lastObjectRendered=t),!a){let o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(s??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(e.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}rO.extension={type:er.RendererSystem,name:"objectRenderer"},ea.add(rO);let rL=class t extends r_{constructor(e){super(),this.type=n.WEBGL,e=Object.assign({},A.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ih({projectionMatrix:new eH},!0);let i={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:t.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};
522this.setup(i),"useContextAlpha"in e&&(Y("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&"notMultiplied"!==e.useContextAlpha,e.backgroundAlpha=!1===e.useContextAlpha?1:e.backgroundAlpha),this._plugin.rendererPlugins=t.__plugins,this.options=e,this.startup.run(this.options)}static test(t){return!t?.forceCanvas&&(typeof J>"u"&&(J=function(){let t={stencil:!0,failIfMajorPerformanceCaveat:A.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!A.ADAPTER.getWebGLRenderingContext())return!1;let e=A.ADAPTER.createCanvas(),i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),r=!!i?.getContextAttributes()?.stencil;if(i){let s=i.getExtension("WEBGL_lose_context");s&&s.loseContext()}return i=null,r}catch{return!1}}()),J)}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 Y("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Y("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Y("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Y("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){Y("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return Y("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){Y("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return Y("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};rL.extension={type:er.Renderer,priority:1},rL.__plugins={},rL.__systems={},ea.handleByMap(er.RendererPlugin,rL.__plugins),ea.handleByMap(er.RendererSystem,rL.__systems),ea.add(rL);class rF extends ep{constructor(t,e){let{width:i,height:r}=e||{};super(i,r),this.items=[],this.itemDirtyIds=[];for(let s=0;s<t;s++){let n=new ev;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof ep?this.addResourceAt(t[i],i):this.addResourceAt(ec(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(null!==this.baseTexture)throw Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(t).then(()=>{let{realWidth:t,realHeight:e}=this.items[0];return this.resize(t,e),this.update(),Promise.resolve(this)}),this._load}}let rk=class t extends rF{constructor(e,i){let{width:r,height:s,autoLoad:n,linkBaseTexture:a}=i||{};if(e&&e.length!==t.SIDES)throw Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:r,height:s});for(let o=0;o<t.SIDES;o++)this.items[o].target=u.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=!1!==a,e&&this.initFromArray(e,i),!1!==n&&this.load()}bind(t){super.bind(t),t.target=u.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(void 0===i&&(i=this.linkBaseTexture),!this.items[e])throw Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(t.resource)this.addResourceAt(t.resource,e);else throw Error("CubeResource does not support copying of renderTexture.")}else t.target=u.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(e,i,r){let s=this.itemDirtyIds;for(let n=0;n<t.SIDES;n++){let a=this.items[n];(s[n]<a.dirtyId||r.dirtyId<i.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(e,a,r),s[n]=a.dirtyId):s[n]<-1&&(e.gl.texImage2D(a.target,0,r.internalFormat,i.realWidth,i.realHeight,0,i.format,r.type,null),s[n]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===t.SIDES}};rk.SIDES=6;class rU extends iI{constructor(t,e){e=e||{};let i,r,s;"string"==typeof t?(i=rU.EMPTY,r=t,s=!0):(i=t,r=null,s=!1),super(i),this.url=r,this.crossOrigin=e.crossOrigin??!0,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??s,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise(async(t,e)=>{if(null===this.url){t(this);return}try{let i=await A.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let r=await i.blob();if(this.destroyed)return;let s=await createImageBitmap(r,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===g.UNPACK?"premultiply":"none"});if(this.destroyed){s.close();return}this.source=s,this.update(),t(this)}catch(n){if(this.destroyed)return;e(n),this.onError.emit(n)}})),this._load}upload(t,e,i){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&"u">typeof ImageBitmap&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){return rU._EMPTY=rU._EMPTY??A.ADAPTER.createCanvas(0,0),rU._EMPTY}}let rG=class t extends iI{constructor(t,e){e=e||{},super(A.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(e=>{if(this._resolve=()=>{this.update(),e(this)},t.SVG_XML.test(this.svg.trim())){if(!btoa)throw 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(){let t=new Image;iI.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>
522{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,s=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/i*e,s=this._overrideHeight||this._overrideWidth/e*i),r=Math.round(r),s=Math.round(s);let n=this.source;n.width=r,n.height=s,n._pixiId=`canvas_${tF()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,r,s),this._resolve(),this._resolve=null}}static getSize(e){let i=t.SVG_SIZE.exec(e),r={};return i&&(r[i[1]]=Math.round(parseFloat(i[3])),r[i[5]]=Math.round(parseFloat(i[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,i){return"svg"===i||"string"==typeof e&&e.startsWith("data:image/svg+xml")||"string"==typeof e&&t.SVG_XML.test(e)}};rG.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,rG.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let rH=class t extends iI{constructor(e,i){if(i=i||{},!(e instanceof HTMLVideoElement)){let r=document.createElement("video");!1!==i.autoLoad&&r.setAttribute("preload","auto"),!1!==i.playsinline&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),!0===i.muted&&(r.setAttribute("muted",""),r.muted=!0),!0===i.loop&&r.setAttribute("loop",""),!1!==i.autoPlay&&r.setAttribute("autoplay",""),"string"==typeof e&&(e=[e]);let s=e[0].src||e[0];iI.crossOrigin(r,s,i.crossorigin);for(let n=0;n<e.length;++n){let a=document.createElement("source"),{src:o,mime:h}=e[n];if((o=o||e[n]).startsWith("data:"))h=o.slice(5,o.indexOf(";"));else if(!o.startsWith("blob:")){let l=o.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||t.MIME_TYPES[u]||`video/${u}`}a.src=o,h&&(a.type=h),r.appendChild(a)}e=r}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=i.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==i.autoPlay,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==i.autoLoad&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=rR.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let 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(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let 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();let 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&&(rR.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||(rR.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(rR.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,i){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.includes(i)}};rH.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],rH.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},ed.push(rU,iC,class extends iI{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return!!e&&t instanceof e||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}},rH,rG,em,rk,class extends rF{constructor(t,e){let{width:i,height:r}=e||{},s,n;Array.isArray(t)?(s=t,n=t.length):n=t,super(n,{width:i,height:r}),s&&this.initFromArray(s,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);
vendor: 5,062 bytes, line 522
522else throw Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=u.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:r,itemDirtyIds:s,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,e.format,i.type,null);for(let o=0;o<r;o++){let h=n[o];s[o]<h.dirtyId&&(s[o]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,o,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}});class rX{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?eL.EMPTY:((t=t||new eL(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){let{a:i,b:r,c:s,d:n,tx:a,ty:o}=t,h=i*e.x+s*e.y+a,l=r*e.x+n*e.y+o;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(t){let e=this.minX,i=this.minY,r=this.maxX,s=this.maxY,n=t[0],a=t[1];e=n<e?n:e,i=a<i?a:i,r=n>r?n:r,s=a>s?a:s,n=t[2],a=t[3],e=n<e?n:e,i=a<i?a:i,r=n>r?n:r,s=a>s?a:s,n=t[4],a=t[5],e=n<e?n:e,i=a<i?a:i,r=n>r?n:r,s=a>s?a:s,n=t[6],a=t[7],e=n<e?n:e,i=a<i?a:i,r=n>r?n:r,s=a>s?a:s,this.minX=e,this.minY=i,this.maxX=r,this.maxY=s}addFrame(t,e,i,r,s){this.addFrameMatrix(t.worldTransform,e,i,r,s)}addFrameMatrix(t,e,i,r,s){let n=t.a,a=t.b,o=t.c,h=t.d,l=t.tx,u=t.ty,d=this.minX,c=this.minY,f=this.maxX,p=this.maxY,m=n*e+o*i+l,g=a*e+h*i+u;d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,m=n*r+o*i+l,g=a*r+h*i+u,d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,m=n*e+o*s+l,g=a*e+h*s+u,d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,m=n*r+o*s+l,g=a*r+h*s+u,d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,this.minX=d,this.minY=c,this.maxX=f,this.maxY=p}addVertexData(t,e,i){let r=this.minX,s=this.minY,n=this.maxX,a=this.maxY;for(let o=e;o<i;o+=2){let h=t[o],l=t[o+1];r=h<r?h:r,s=l<s?l:s,n=h>n?h:n,a=l>a?l:a}this.minX=r,this.minY=s,this.maxX=n,this.maxY=a}addVertices(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)}addVerticesMatrix(t,e,i,r,s=0,n=s){let a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,d=t.ty,c=this.minX,f=this.minY,p=this.maxX,m=this.maxY;for(let g=i;g<r;g+=2){let _=e[g],v=e[g+1],x=a*_+h*v+u,y=l*v+o*_+d;c=Math.min(c,x-s),p=Math.max(p,x+s),f=Math.min(f,y-n),m=Math.max(m,y+n)}this.minX=c,this.minY=f,this.maxX=p,this.maxY=m}addBounds(t){let e=this.minX,i=this.minY,r=this.maxX,s=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>s?t.maxY:s}addBoundsMask(t,e){let i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,s=t.maxX<e.maxX?t.maxX:e.maxX,n=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=s&&r<=n){let a=this.minX,o=this.minY,h=this.maxX,l=this.maxY;this.minX=i<a?i:a,this.minY=r<o?r:o,this.maxX=s>h?s:h,this.maxY=n>l?n:l}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){let i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,s=t.maxX<e.x+e.width?t.maxX:e.x+e.width,n=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=s&&r<=n){let a=this.minX,o=this.minY,h=this.maxX,l=this.maxY;this.minX=i<a?i:a,this.minY=r<o?r:o,this.maxX=s>h?s:h,this.maxY=n>l?n:l}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,r,s,n){t-=s,e-=n,i+=s,r+=n,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class rz extends V{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new eQ,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 rX,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){let e=Object.keys(t);for(let i=0;i<e.length;++i){let r=e[i];Object.defineProperty(rz.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&
522(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new eL),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new eL),t=this._localBoundsRect),this._localBounds||(this._localBounds=new rX);let e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=i?.worldAlpha??1,this.transform=this._tempDisplayObjectParent.transform;let r=this._bounds,s=this._boundsID;this._bounds=this._localBounds;let n=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-s,n}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){this.parent?.removeChild(this)}setTransform(t=0,e=0,i=1,r=1,s=0,n=0,a=0,o=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=s,this.skew.x=n,this.skew.y=a,this.pivot.x=o,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new rV),this.tempDisplayObjectParent}enableTempParent(){let t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*eM}set angle(t){this.transform.rotation=t*eP}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){let e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,0===e._maskRefCount&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){let i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(0===i._maskRefCount&&(i.renderable=!1,i.isMask=!0),i._maskRefCount++)}}}}class rV extends rz{constructor(){super(...arguments),this.sortDirty=null}}rz.prototype.displayObjectUpdateTransform=rz.prototype.updateTransform;let rW=new eH;function rj(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}let rY=class t extends rz{constructor(){super(),this.children=[],this.sortableChildren=t.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{let i=t[0];i.parent&&i.parent.removeChild(i),i.parent=this,this.sortDirty=!0,i.transform._parentID=-1,this.children.push(i),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit
522("childAdded",i,this,this.children.length-1),i.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw 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;let i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}getChildIndex(t){let e=this.children.indexOf(t);if(-1===e)throw Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw Error(`The index ${e} supplied is out of bounds ${this.children.length}`);let i=this.getChildIndex(t);tN(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{let i=t[0],r=this.children.indexOf(i);if(-1===r)return null;i.parent=null,i.transform._parentID=-1,tN(this.children,r,1),this._boundsID++,this.onChildrenChange(r),i.emit("removed",this),this.emit("childRemoved",i,this,r)}return t[0]}removeChildAt(t){let e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,tN(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){let i=e-t,r;if(i>0&&i<=e){r=this.children.splice(t,i);for(let s=0;s<r.length;++s)r[s].parent=null,r[s].transform&&(r[s].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let n=0;n<r.length;++n)r[n].emit("removed",this),this.emit("childRemoved",r[n],this,n);return r}if(0===i&&0===this.children.length)return[];throw RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){let r=this.children[e];r._lastSortedIndex=e,t||0===r.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(rj),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){let i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){let e=this.children[t];if(!(!e.visible||!e.renderable)){if(e.calculateBounds(),e._mask){let i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){let i=super.getLocalBounds(t);if(!e)for(let r=0,s=this.children.length;r<s;++r){let n=this.children[r];n.visible&&n.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){let i=e.renderTexture.sourceFrame;if(!(i.width>0&&i.height>0))return;let r,s;this.cullArea?(r=this.cullArea,s=this.worldTransform):this._render!==t.prototype._render&&(r=this.getBounds(!0));let n=e.projection.transform;if(n&&(s?(s=rW.copyFrom(s)).prepend(n):s=n),r&&i.intersects(r,s))this._render(e);else if(this.cullArea)return;for(let a=0,o=this.children.length;a<o;++a){let h=this.children[a],l=h.cullable;h.cullable=l||!this.cullArea,h.render(e),h.cullable=l}}render(t){if(!(!this.visible||this.worldAlpha<=0||!this.renderable)){if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}}}renderAdvanced(t){let e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let r=0;r<e.length;r++)e[r].enabled&&this._enabledFilters.push(e[r])}let s=e&&this._enabledFilters?.length||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==y.NONE));if(s&&t.batch.flush(),e&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let n=0,a=this.children.length;n<a;++n)this.children[n].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;let e="boolean"==typeof t?t:t?.children,i=this.removeChildren(0,this.children.length);if(e)for(let r=0;r<i.length;++r)i[r].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){let e=this.getLocalBounds().width;0!==e?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){let e=this.getLocalBounds().height;0!==e?this.scale.y=t/e:this.scale.y=1,this._height=t}};rY.defaultSortableChildren=!1;let r$=rY;r$.prototype.containerUpdateTransform=r$.prototype.updateTransform,Object.defineProperties(A,{SORTABLE_CHILDREN:{get:()=>r$.defaultSortableChildren,set(t){Y("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),r$.defaultSortableChildren=t}}});let rq=new eN,rK=new Uint16Array([0,1,2,0,2,3]);class rZ extends r${constructor(t){super(),this._anchor=new eK(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 tR(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=o.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||iB.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=rK,this.pluginName="batch",this.isSprite=!0,this._roundPixels=A.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=tO(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=tO(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){let 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;let e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,n=e.d,a=e.tx,o=e.ty,h=this.vertexData,l=t.trim,u=t.orig,d=this._anchor,c=0,f=0,p=0,m=0;if(l?(c=(f=l.x-d._x*u.width)+l.width,p=(m=l.y-d._y*u.height)+l.he
522ight):(c=(f=-d._x*u.width)+u.width,p=(m=-d._y*u.height)+u.height),h[0]=i*f+s*m+a,h[1]=n*m+r*f+o,h[2]=i*c+s*m+a,h[3]=n*m+r*c+o,h[4]=i*c+s*p+a,h[5]=n*p+r*c+o,h[6]=i*f+s*p+a,h[7]=n*p+r*f+o,this._roundPixels){let g=A.RESOLUTION;for(let _=0;_<h.length;++_)h[_]=Math.round(h[_]*g)/g}}calculateTrimmedVertices(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;let t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,s=this.transform.worldTransform,n=s.a,a=s.b,o=s.c,h=s.d,l=s.tx,u=s.ty,d=-r._x*i.width,c=d+i.width,f=-r._y*i.height,p=f+i.height;if(e[0]=n*d+o*f+l,e[1]=h*f+a*d+u,e[2]=n*c+o*f+l,e[3]=h*f+a*c+u,e[4]=n*c+o*p+l,e[5]=h*p+a*c+u,e[6]=n*d+o*p+l,e[7]=h*p+a*d+u,this._roundPixels){let m=A.RESOLUTION;for(let g=0;g<e.length;++g)e[g]=Math.round(e[g]*m)/m}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){let t=this._texture.trim,e=this._texture.orig;t&&(t.width!==e.width||t.height!==e.height)?(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)):(this.calculateVertices(),this._bounds.addQuad(this.vertexData))}getLocalBounds(t){return 0===this.children.length?(this._localBounds||(this._localBounds=new rX),this._localBounds.minX=-(this._texture.orig.width*this._anchor._x),this._localBounds.minY=-(this._texture.orig.height*this._anchor._y),this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new eL),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,rq);let e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,s=0;return rq.x>=r&&rq.x<r+e&&(s=-i*this.anchor.y,rq.y>=s&&rq.y<s+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof t?t:t?.texture){let e="boolean"==typeof t?t:t?.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){let i=t instanceof iB?t:iB.from(t,e);return new rZ(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){let e=tO(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){let e=tO(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||iB.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}let rQ=new eH;rz.prototype._cacheAsBitmap=!1,rz.prototype._cacheData=null,rz.prototype._cacheAsBitmapResolution=null,rz.prototype._cacheAsBitmapMultisample=null;class rJ{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(rz.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){if(this._cacheAsBitmap===t)return;this._cacheAsBitmap=t;let e;t?(this._cacheData||(this._cacheData=new rJ),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}),rz.prototype._renderCached=function(t){this.visible&&!(this.worldAlpha<=0)&&this.renderable&&(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},rz.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;let e=this.alpha;this.alpha=1,t.batch.flush();let i=this.getLocalBounds(new eL,!0);if(this.filters?.length){let r=this.filters[0].padding;i.pad(r)}let s=this.cacheAsBitmapResolution||t.resolution;i.ceil(s),i.width=Math.max(i.width,1/s),i.height=Math.max(i.height,1/s);let n=t.renderTexture.current,a=t.renderTexture.sourceFrame.clone(),o=t.renderTexture.destinationFrame.clone(),h=t.projection.transform,l=iN.create({width:i.width,height:i.height,resolution:s,multisample:this.cacheAsBitmapMultisample??t.multisample}),u=`cacheAsBitmap_${tF()}`;this._cacheData.textureCacheId=u,ev.addToCache(l.baseTexture,u),iB.addToCache(l,u);let d=this.transform.localTransform.copyTo(rQ).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:l,clear:!0,transform:d,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=h,t.renderTexture.bind(n,a,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;let c=new rZ(l);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(i.x/i.width),c.anchor.y=-(i.y/i.height),c.alpha=e,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},rz.prototype._renderCachedCanvas=function(t){this.visible&&!(this.worldAlpha<=0)&&this.renderable&&(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},rz.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;let e=this.getLocalBounds(new eL,!0),i=this.alpha;this.alpha=1;let r=t.canvasContext.activeContext,s=t._projTransform,n=this.cacheAsBitmapResolution||t.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);let a=iN.create({width:e.width,height:e.height,resolution:n}),o=`cacheAsBitmap_${tF()}`;this._cacheData.textureCacheId=o,ev.addToCache(a.baseTexture,o),iB.addToCache(a,o);let h=rQ;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),t.canvasContext.activeContext=r,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;let l=new rZ(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(e.x/e.width),l.anchor.y=-(e.y/e.height),l.alpha=i,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},rz.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},rz.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},rz.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ev.removeFromCache(this._cacheData.textureCacheId),iB.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},rz.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},rz.prototype.name=null,r$.prototype.getChildByName=function(t,e){for(let i=0,r=this.children.length;i<r;i++)if(this.children[i].name===t)return this.children[i];if(e)for(let s=0,n=this.children.length;s<n;s++){let a=this.children[s];if(!a.getChildByName)continue;let o=a.getChildByName(t,!0);if(o)return o}return null},rz.prototype.getGlobalPosition=function(t=new eN,e=!1){return this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};var r0=`varying vec2 vTextureCoord; 523 524uniform sampler2D uSampler; 525uniform float uAlpha; 526 527void main(void) 528{ 529 gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; 530} 531`;let r1={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},r2=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(` 532`),r3=` 533 attribute vec2 aVertexPosition; 534 535 uniform mat3 projectionMatrix; 536 537 uniform float strength; 538 539 varying vec2 vBlurTexCoords[%size%]; 540 541 uniform vec4 inputSize; 542 uniform vec4 outputFrame; 543 544 vec4 filterVertexPosition( void ) 545 { 546 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 547
548 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 549 } 550 551 vec2 filterTextureCoord( void ) 552 { 553 return aVertexPosition * (outputFrame.zw * inputSize.zw); 554 } 555 556 void main(void) 557 { 558 gl_Position = filterVertexPosition(); 559 560 vec2 textureCoord = filterTextureCoord(); 561 %blur% 562 }`;class r4 extends ib{constructor(t,e=8,i=4,r=ib.defaultResolution,s=5){let n=function(t,e){let i=Math.ceil(t/2),r=r3,s="",n;n=e?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<t;a++){let o=n.replace("%index%",a.toString());s+=o=o.replace("%sampleIndex%",`${a-(i-1)}.0`),s+=` 563`}return(r=r.replace("%blur%",s)).replace("%size%",t.toString())}(s,t),a=function(t){let e=r1[t],i=e.length,r=r2,s="",n;for(let a=0;a<t;a++){let o="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",a.toString());n=a,a>=i&&(n=t-a-1),s+=o=o.replace("%value%",e[n].toString()),s+=` 564`}return(r=r.replace("%blur%",s)).replace("%size%",t.toString())}(s);super(n,a),this.horizontal=t,this.resolution=r,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,r){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,i,r);else{let s=t.getFilterTexture(),n=t.renderer,a=e,o=s;this.state.blend=!1,t.applyFilter(this,a,o,_.CLEAR);for(let h=1;h<this.passes-1;h++){t.bindAndClear(a,_.BLIT),this.uniforms.uSampler=o;let l=o;o=a,a=l,n.shader.bind(this),n.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,i,r),t.returnFilterTexture(s)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}var r5=`varying vec2 vTextureCoord; 565uniform sampler2D uSampler; 566uniform float m[20]; 567uniform float uAlpha; 568 569void main(void) 570{ 571 vec4 c = texture2D(uSampler, vTextureCoord); 572 573 if (uAlpha == 0.0) { 574 gl_FragColor = c; 575 return; 576 } 577 578 // Un-premultiply alpha before applying the color matrix. See issue #3539. 579 if (c.a > 0.0) { 580 c.rgb /= c.a; 581 } 582 583 vec4 result; 584 585 result.r = (m[0] * c.r); 586 result.r += (m[1] * c.g); 587 result.r += (m[2] * c.b); 588 result.r += (m[3] * c.a); 589 result.r += m[4]; 590 591 result.g = (m[5] * c.r); 592 result.g += (m[6] * c.g); 593 result.g += (m[7] * c.b); 594 result.g += (m[8] * c.a); 595 result.g += m[9]; 596 597 result.b = (m[10] * c.r); 598 result.b += (m[11] * c.g); 599 result.b += (m[12] * c.b); 600 result.b += (m[13] * c.a); 601 result.b += m[14]; 602 603 result.a = (m[15] * c.r); 604 result.a += (m[16] * c.g); 605 result.a += (m[17] * c.b); 606 result.a += (m[18] * c.a); 607 result.a += m[19]; 608 609 vec3 rgb = mix(c.rgb, result.rgb, uAlpha); 610 611 // Premultiply alpha again. 612 rgb *= result.a; 613 614 gl_FragColor = vec4(rgb, result.a); 615} 616`;class r8 extends ib{constructor(){let t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(rP,r5,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){let 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){let[i,r,s]=tR.shared.setValue(t).toArray();this._loadMatrix([i,0,0,0,0,0,r,0,0,0,0,0,s,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;let i=Math.cos(t),r=Math.sin(t),s=1/3,n=(0,Math.sqrt)(s);this._loadMatrix([i+(1-i)*s,s*(1-i)-n*r,s*(1-i)+n*r,0,0,s*(1-i)+n*r,i+s*(1-i),s*(1-i)-n*r,0,0,s*(1-i)-n*r,s*(1-i)+n*r,i+s*(1-i),0,0,0,0,0,1,0],e)}contrast(t,e){let i=(t||0)+1,r=-.5*(i-1);this._loadMatrix([i,0,0,0,r,0,i,0,0,r,0,0,i,0,r,0,0,0,1,0],e)}saturate(t=0,e){let i=2*t/3+1,r=-((i-1)*.5);this._loadMatrix([i,r,r,0,0,r,i,r,0,0,r,r,i,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,-.091555084827
61655585,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,i,r,s){t=t||.2,e=e||.15,i=i||16770432,r=r||3375104;let n=tR.shared,[a,o,h]=n.setValue(i).toArray(),[l,u,d]=n.setValue(r).toArray(),c=[.3,.59,.11,0,0,a,o,h,t,0,l,u,d,e,0,a-l,o-u,h-d,0,0];this._loadMatrix(c,s)}night(t,e){t=t||.1;let i=[-2*t,-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(i,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}}r8.prototype.grayscale=r8.prototype.greyscale;var r6=`varying vec2 vFilterCoord; 617varying vec2 vTextureCoord; 618 619uniform vec2 scale; 620uniform mat2 rotation; 621uniform sampler2D uSampler; 622uniform sampler2D mapSampler; 623 624uniform highp vec4 inputSize; 625uniform vec4 inputClamp; 626 627void main(void) 628{ 629 vec4 map = texture2D(mapSampler, vFilterCoord); 630 631 map -= 0.5; 632 map.xy = scale * inputSize.zw * (rotation * map.xy); 633 634 gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); 635} 636`,r7=`attribute vec2 aVertexPosition; 637 638uniform mat3 projectionMatrix; 639uniform mat3 filterMatrix; 640 641varying vec2 vTextureCoord; 642varying vec2 vFilterCoord; 643 644uniform vec4 inputSize; 645uniform vec4 outputFrame; 646 647vec4 filterVertexPosition( void ) 648{ 649 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 650 651 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 652} 653 654vec2 filterTextureCoord( void ) 655{ 656 return aVertexPosition * (outputFrame.zw * inputSize.zw); 657} 658 659void main(void) 660{ 661 gl_Position = filterVertexPosition(); 662 vTextureCoord = filterTextureCoord(); 663 vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; 664} 665`,r9=`varying vec2 v_rgbNW; 666varying vec2 v_rgbNE; 667varying vec2 v_rgbSW; 668varying vec2 v_rgbSE; 669varying vec2 v_rgbM; 670 671varying vec2 vFragCoord; 672uniform sampler2D uSampler; 673uniform highp vec4 inputSize; 674 675 676/** 677 Basic FXAA implementation based on the code on geeks3d.com with the 678 modification that the texture2DLod stuff was removed since it's 679 unsupported by WebGL. 680 681 -- 682 683 From: 684 https://github.com/mitsuhiko/webgl-meincraft 685 686 Copyright (c) 2011 by Armin Ronacher. 687 688 Some rights reserved. 689 690 Redistribution and use in source and binary forms, with or without 691 modification, are permitted provided that the following conditions are 692 met: 693 694 * Redistributions of source code must retain the above copyright 695 notice, this list of conditions and the following disclaimer. 696 697 * Redistributions in binary form must reproduce the above 698 copyright notice, this list of conditions and the following 699 disclaimer in the documentation and/or other materials provided 700 with the distribution. 701 702 * The names of the contributors may not be used to endorse or 703 promote products derived from this software without specific 704 prior written permission. 705 706 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 707 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 708 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 709 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 710 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
711 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 712 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 713 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 714 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 715 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 716 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 717 */ 718 719#ifndef FXAA_REDUCE_MIN 720#define FXAA_REDUCE_MIN (1.0/ 128.0) 721#endif 722#ifndef FXAA_REDUCE_MUL 723#define FXAA_REDUCE_MUL (1.0 / 8.0) 724#endif 725#ifndef FXAA_SPAN_MAX 726#define FXAA_SPAN_MAX 8.0 727#endif 728 729//optimized version for mobile, where dependent 730//texture reads can be a bottleneck 731vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, 732 vec2 v_rgbNW, vec2 v_rgbNE, 733 vec2 v_rgbSW, vec2 v_rgbSE, 734 vec2 v_rgbM) { 735 vec4 color; 736 vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; 737 vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; 738 vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; 739 vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; 740 vec4 texColor = texture2D(tex, v_rgbM); 741 vec3 rgbM = texColor.xyz; 742 vec3 luma = vec3(0.299, 0.587, 0.114); 743 float lumaNW = dot(rgbNW, luma); 744 float lumaNE = dot(rgbNE, luma); 745 float lumaSW = dot(rgbSW, luma); 746 float lumaSE = dot(rgbSE, luma); 747 float lumaM = dot(rgbM, luma); 748 float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); 749 float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); 750 751 mediump vec2 dir; 752 dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); 753 dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); 754 755 float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * 756 (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); 757 758 float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); 759 dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), 760 max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), 761 dir * rcpDirMin)) * inverseVP; 762 763 vec3 rgbA = 0.5 * ( 764 texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + 765 texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); 766 vec3 rgbB = rgbA * 0.5 + 0.25 * ( 767 texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + 768 texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); 769 770 float lumaB = dot(rgbB, luma); 771 if ((lumaB < lumaMin) || (lumaB > lumaMax)) 772 color = vec4(rgbA, texColor.a); 773 else 774 color = vec4(rgbB, texColor.a); 775 return color; 776} 777 778void main() { 779 780 vec4 color; 781 782 color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); 783 784 gl_FragColor = color; 785} 786`,st=` 787attribute vec2 aVertexPosition; 788 789uniform mat3 projectionMatrix; 790 791varying vec2 v_rgbNW; 792varying vec2 v_rgbNE; 793varying vec2 v_rgbSW; 794varying vec2 v_rgbSE; 795varying vec2 v_rgbM; 796 797varying vec2 vFragCoord; 798 799uniform vec4 inputSize; 800uniform vec4 outputFrame; 801 802vec4 filterVertexPosition( void ) 803{ 804 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 805 806 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 807} 808 809void texcoords(vec2 fragCoord, vec2 inverseVP, 810 out vec2 v_rgbNW, out vec2 v_rgbNE, 811 out vec2 v_rgbSW, out vec2 v_rgbSE, 812 out vec2 v_rgbM) { 813 v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; 814 v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; 815 v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; 816 v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; 817 v_rgbM = vec2(fragCoord * inverseVP); 818} 819 820void main(void) { 821 822 gl_Position = filterVertexPosition(); 823 824 vFragCoord = aVertexPosition * outputFrame.zw; 825 826 texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); 827} 828`,se=`precision highp float; 829 830varying vec2 vTextureCoord; 831varying vec4 vColor; 832 833uniform float uNoise; 834uniform float uSeed; 835uniform sampler2D uSampler; 836 837float rand(vec2 co) 838{ 839 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); 840} 841 842void main() 843{ 844 vec4 color = texture2D(uSampler, vTextureCoord); 845 float randomValue = rand(gl_FragCoord.xy * uSeed); 846 float diff = (randomValue - 0.5) * uNoise; 847 848 // Un-premultiply alpha before applying the color matrix. See issue #3539. 849 if (color.a > 0.0) { 850 color.rgb /= color.a; 851 } 852 853 color.r += diff; 854 color.g += diff; 855 color.b += diff; 856 857 // Premultiply alpha again. 858 color.rgb *= color.a; 859 860 gl_FragColor = color; 861} 862`;let si={AlphaFilter:class extends ib{constructor(t=1){super(rM,r0,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}},BlurFilter:class extends ib{constructor(t=8,e=4,i=ib.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new r4(!0,t,e,i,r),this.blurYFilter=new r4(!1,t,e,i,r),this.resolution=i,this.qual
862ity=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,r){let s=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(s&&n){let a=t.getFilterTexture();this.blurXFilter.apply(t,e,a,_.CLEAR),this.blurYFilter.apply(t,a,i,r),t.returnFilterTexture(a)}else n?this.blurYFilter.apply(t,e,i,r):this.blurXFilter.apply(t,e,i,r)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}},BlurFilterPass:r4,ColorMatrixFilter:r8,DisplacementFilter:class extends ib{constructor(t,e){let i=new eH;t.renderable=!1,super(r7,r6,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,null==e&&(e=20),this.scale=new eN(e,e)}apply(t,e,i,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;let s=this.maskSprite.worldTransform,n=Math.sqrt(s.a*s.a+s.b*s.b),a=Math.sqrt(s.c*s.c+s.d*s.d);0!==n&&0!==a&&(this.uniforms.rotation[0]=s.a/n,this.uniforms.rotation[1]=s.b/n,this.uniforms.rotation[2]=s.c/a,this.uniforms.rotation[3]=s.d/a),t.applyFilter(this,e,i,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}},FXAAFilter:class extends ib{constructor(){super(st,r9)}},NoiseFilter:class extends ib{constructor(t=.5,e=Math.random()){super(rP,se,{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(si).forEach(([t,e])=>{Object.defineProperty(si,t,{get:()=>(Y("7.1.0",`filters.${t} has moved to ${t}`),e)})});let sr=new class{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||(rR.system.add(this.tickerUpdate,this,rA.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(rR.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let 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._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())}};class ss{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ss.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new eN,this.page=new eN,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,r,s){throw Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}
862stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class sn extends ss{constructor(){super(...arguments),this.client=new eN,this.movement=new eN,this.offset=new eN,this.global=new eN,this.screen=new eN}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,s,n,a,o,h,l,u,d,c,f,p){throw Error("Method not implemented.")}}class sa extends sn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw Error("getPredictedEvents is not supported!")}}class so extends sn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}so.DOM_DELTA_PIXEL=0,so.DOM_DELTA_LINE=1,so.DOM_DELTA_PAGE=2;let sh=new eN,sl=new eN;class su{constructor(t){this.dispatch=new V,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((t,e)=>t.priority-e.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,r=e.length;i<r;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}
862hitTest(t,e){sr.pauseUpdate=!0;let i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[i](this.rootTarget,this.rootTarget.eventMode,sh.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,s=i.length-1;r<s;r++)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(0===i.length)return;t.eventPhase=t.BUBBLING_PHASE;let r=Array.isArray(e)?e:[e];for(let s=i.length-1;s>=0;s--)r.forEach(e=>{t.currentTarget=i[s],this.notifyTarget(t,e)})}propagationPath(t){let e=[t];for(let i=0;i<2048&&t!==this.rootTarget;i++){if(!t.parent)throw Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,r,s,n=!1){let a=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(sr.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children;for(let h=o.length-1;h>=0;h--){let l=o[h],u=this.hitTestMoveRecursive(l,this._isInteractive(e)?e:l.eventMode,i,r,s,n||s(t,i));if(u){if(u.length>0&&!u[u.length-1].parent)continue;let d=t.isInteractive();(u.length>0||d)&&(d&&this._allInteractiveElements.push(t),u.push(t)),0===this._hitElements.length&&(this._hitElements=u),a=!0}}}let c=this._isInteractive(e),f=t.isInteractive();return c&&f&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:c&&!s(t,i)&&r(t,i)?f?[t]:[]:null}hitTestRecursive(t,e,i,r,s){if(this._interactivePrune(t)||s(t,i))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(sr.pauseUpdate=!1),t.interactiveChildren&&t.children){let n=t.children;for(let a=n.length-1;a>=0;a--){let o=n[a],h=this.hitTestRecursive(o,this._isInteractive(e)?e:o.eventMode,i,r,s
862);if(h){if(h.length>0&&!h[h.length-1].parent)continue;let l=t.isInteractive();return(h.length>0||l)&&h.push(t),h}}}let u=this._isInteractive(e),d=t.isInteractive();return u&&r(t,i)?d?[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){if(t.hitArea&&(t.worldTransform.applyInverse(e,sl),!t.hitArea.contains(sl.x,sl.y)))return!0;if(t._mask){let i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!i.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){e=e??t.type;let i=`on${e}`;t.currentTarget[i]?.(t);let r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof sa)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){let i=2===e.button;this.dispatchEvent(e,i?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof sa)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i="mouse"===e.pointerType||"pen"===e.pointerType,r=this.trackingData(t.pointerId),s=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&s!==e.target){let n="mousemove"===t.type?"mouseout":"pointerout",a=this.createPointerEvent(t,n,s);if(this.dispatchEvent(a,"pointerout"),i&&this.dispatchEvent(a,"mouseout"),!e.composedPath().includes(s)){let o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&!e.composedPath().includes(o.target);)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;this.freeEvent(o)}this.freeEvent(a)}if(s!==e.target){let h="mousemove"===t.type?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let u=s?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==s&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let c=[],f=this.enableGlobalMoveEvents??!0;this.moveOnAll?c.push("pointermove"):this.dispatchEvent(e,"pointermove"),f&&c.push("globalpointermove"),"touch"===e.pointerType&&(this.moveOnAll?c.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),f&&c.push("globaltouchmove")),i&&(this.moveOnAll?c.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),f&&c.push("globalmousemove"),this.cursor=e.target?.cursor),c.length>0&&this.all(e,c),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof sa)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r="mouse"===i.pointerType||"pen"===i.pointerType;this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),"mouse"===i.pointerType&&(this.cursor=i.target?.cursor);let s=this.clonePointerEvent(i,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof sa)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i="mouse"===t.pointerType||"pen"===t.pointerType,r=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");let n=this.createPointerEvent(t,"pointerleave",r);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof sa)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),"touch"===i.pointerType)this.dispatchEvent(i,"touchend");else if("mouse"===i.pointerType||"pen"===i.pointerType){let r=2===i.button;this.dispatchEvent(i,r?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]),a=n;if(n&&!i.composedPath().includes(n)){let o=n;for(;o&&!i.composedPath().includes(o);){if(i.currentTarget=o,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType)this.notifyTarget(i,"touchendoutside");else if("mouse"===i.pointerType||"pen"===i.pointerType){let h=2===i.button;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete s.pressTargetsByButton[t.button],a=o}if(a){let l=this.clonePointerEvent(i,"click");l.target=a,l.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:l.target,timeStamp:e});let u=s.clicksByButton[t.button];if(u.target===l.target&&e-u.timeStamp<200?++u.clickCount:u.clickCount=1,u.target=l.target,u.timeStamp=e,l.detail=u.clickCount,"mouse"===l.pointerType){let d=2===l.button;this.dispatchEvent(l,d?"rightclick":"click")}else"touch"===l.pointerType&&this.dispatchEvent(l,"tap");this.dispatchEvent(l,"pointertap"),this.freeEvent(l)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof sa)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let s=i;for(;s;)r.currentTarget=s,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):("mouse"===r.pointerType||"pen"===r.pointerType)&&this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof so)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let r=this.allocateEvent(sa);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],"string"==typeof e&&(r.type=e),r}createWheelEvent(t){let e=this.allocateEvent(so);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(sa);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof sa&&e instanceof sa&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.t
862iltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof sn&&e instanceof sn&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){let i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive()){if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,s=i.length;r<s&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}}let sd={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},sc=class t{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new su(null),sr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new sa(null),this.rootWheelEvent=new so(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...t.defaultEventFeatures},{set:(t,e,i)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=i),t[e]=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(e){let{view:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,t._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i)}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;let e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,r=e.length;i<r;i++){let s=e[i],n=this.bootstrapEvent(this.rootPointerEvent,s);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,sr.pointerMoved();let e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){let s=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let s=0,n=r.length;s<n;s++){let a=this.bootstrapEvent(this.rootPointerEvent,r[s]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){let s=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,sr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;sr.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;sr.removeTickerListener();let t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){let r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(e-r.left)*(this.domElement.width/r.width)*s,t.y=(i-r.top)*(this.domElement.height/r.height)*s}normalizeToPointerData(t){let e=[];
862if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,r=t.changedTouches.length;i<r;i++){let s=t.changedTouches[i];typeof s.button>"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=1===t.touches.length&&"touchstart"===t.type),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=t.type,e.push(s)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let n=t;typeof n.isPrimary>"u"&&(n.isPrimary=!0),typeof n.width>"u"&&(n.width=1),typeof n.height>"u"&&(n.height=1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="mouse"),typeof n.pointerId>"u"&&(n.pointerId=1),typeof n.pressure>"u"&&(n.pressure=.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),n.isNormalized=!0,e.push(n)}else e.push(t);return e}normalizeWheelEvent(t){let 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=sd[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}};function sf(t){return"dynamic"===t||"static"===t}sc.extension={name:"events",type:[er.RendererSystem,er.CanvasRendererSystem]},sc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},ea.add(sc),rz.mixin({onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??sf(sc.defaultEventMode)},set interactive(value){Y("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=value,this.eventMode=value?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??sc.defaultEventMode},set eventMode(value){this._internalInteractive=sf(value),this._internalEventMode=value},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,i){let r="boolean"==typeof i&&i||"object"==typeof i&&i.capture,s="function"==typeof e?void 0:e;t=r?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,s)},removeEventListener(t,e,i){let r="boolean"==typeof i&&i||"object"==typeof i&&i.capture,s="function"==typeof e?void 0:e;t=r?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,s)},dispatchEvent(t){if(!(t instanceof ss))throw Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}),rz.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});class sp{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,(z.tablet||z.phone)&&this.createTouchHook();let e=document.createElement("div");
862e.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(){let 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(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);let e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){let t=performance.now();if(z.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);let{x:e,y:i,width:r,height:s}=this.renderer.view.getBoundingClientRect(),{width:n,height:a,resolution:o}=this.renderer,h=r/n*o,l=s/a*o,u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${n}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){let c=this.children[d];if(c.renderId!==this.renderId)c._accessibleActive=!1,tN(this.children,d,1),this.div.removeChild(c._accessibleDiv),this.pool.push(c._accessibleDiv),c._accessibleDiv=null,d--;else{u=c._accessibleDiv;let f=c.hitArea,p=c.worldTransform;c.hitArea?(u.style.left=`${(p.tx+f.x*p.a)*h}px`,u.style.top=`${(p.ty+f.y*p.d)*l}px`,u.style.width=`${f.width*p.a*h}px`,u.style.height=`${f.height*p.d*l}px`):(f=c.getBounds(),this.capHitArea(f),u.style.left=`${f.x*h}px`,u.style.top=`${f.y*l}px`,u.style.width=`${f.width*h}px`,u.style.height=`${f.height*l}px`,u.title!==c.accessibleTitle&&null!==c.accessibleTitle&&(u.title=c.accessibleTitle),u.getAttribute("aria-label")!==c.accessibleHint&&null!==c.accessibleHint&&u.setAttribute("aria-label",c.accessibleHint)),(c.accessibleTitle!==u.title||c.tabIndex!==u.tabIndex)&&(u.title=c.accessibleTitle,u.tabIndex=c.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||((e=document.createElement("button")).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){let{displayObject:i}=t.target,r=this.renderer.events.rootBoundary,s=Object.assign(new ss(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(t=>r.dispatchEvent(s,t))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}sp.extension={name:"accessibility",type:[er.RendererPlugin,er.CanvasRendererPlugin]},ea.add(sp);let sm=class t{constructor(e){this.stage=new r$,e=Object.assign({forceCanvas:!1},e),this.renderer=function(t){for(let e of rC)if(e.test(t))return new e(t);throw Error("Unable to auto-detect a suitable renderer.")}(e),t._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(e,i){let r=t._plugins.slice(0);r.reverse(),r.forEach(t=>{t.destroy.call(this)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null}};sm._plugins=[];let sg=sm;ea.handleByList(er.Application,sg._plugins);class s_{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let t,e;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{let{clientWidth:i,clientHeight:r}=this._resizeTo;t=i,e=r}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}s_.extension=er.Application,ea.add(s_);let sv={loader:er.LoadParser,resolver:er.ResolveParser,cache:er.CacheParser,detection:er.DetectionParser};ea.handle(er.Asset,t=>{let e=t.ref;Object.entries(sv).filter(([t])=>
862!!e[t]).forEach(([t,i])=>ea.add(Object.assign(e[t],{extension:e[t].extension??i})))},t=>{let e=t.ref;Object.keys(sv).filter(t=>!!e[t]).forEach(t=>ea.remove(e[t]))});class sx{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function sy(t,e){let i=t.split("?")[0],r=K.extname(i).toLowerCase();return Array.isArray(e)?e.includes(r):r===e}let sb=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(t=>"string"==typeof t||i?e(t):t):t),sE=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=sb(t),r;for(let s=0;s<this.parsers.length;s++){let n=this.parsers[s];if(n.test(e)){r=n.getCacheableAssets(i,e);break}}r||(r={},i.forEach(t=>{r[t]=e}));let a=Object.keys(r),o={cacheKeys:a,keys:i};i.forEach(t=>{this._cacheMap.set(t,o)}),a.forEach(t=>{this._cache.has(t)&&this._cache.get(t)!==e&&console.warn("[Cache] already has key:",t),this._cache.set(t,r[t])}),e instanceof iB&&i.forEach(t=>{e.baseTexture!==iB.EMPTY.baseTexture&&ev.addToCache(e.baseTexture,t),iB.addToCache(e,t)})}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(t=>{this._cache.delete(t)}),e.keys.forEach(t=>{this._cacheMap.delete(t)})}get parsers(){return this._parsers}},sT=t=>!Array.isArray(t);class sA{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let r=null,s=null;if(e.loadParser&&((s=this._parserHash[e.loadParser])||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!s){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){s=a;break}}if(!s)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await s.load(t,e,this),i.parser=s;for(let o=0;o<this.parsers.length;o++){let h=this.parsers[o];h.parse&&h.parse&&await h.testParse?.(r,e,this)&&(r=await h.parse(r,e,this)||r,i.parser=h)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,r={},s=sT(t),n=sb(t,t=>({alias:[t],src:t})),a=n.length,o=n.map(async t=>{let s=K.toAbsolute(t.src);if(!r[t.src])try{this.promiseCache[s]||(this.promiseCache[s]=this._getLoadPromiseAndParser(s,t)),r[t.src]=await this.promiseCache[s].promise,e&&e(++i/a)}catch(n){throw delete this.promiseCache[s],delete r[t.src],Error(`[Loader.load] Failed to load ${s}. 863${n}`)}});return await Promise.all(o),s?r[n[0].src]:r}async unload(t){let e=sb(t,t=>({alias:[t],src:t})).map(async t=>{let e=K.toAbsolute(t.src),i=this.promiseCache[e];if(i){let r=await i.promise;delete this.promiseCache[e],i.parser?.unload?.(r,t,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var sS,sw,sR=((sw=sR||{})[sw.Low=0]="Low",sw[sw.Normal=1]="Normal",sw[sw.High=2]="High",sw);function sI(t,e){if(Array.isArray(e)){for(let i of e)if(t.startsWith(`data:${i}`))return!0;return!1}return t.startsWith(`data:${e}`)}let sC={extension:{type:er.LoadParser,priority:sR.Low}
863,name:"loadJson",test:t=>sI(t,"application/json")||sy(t,".json"),load:async t=>await (await A.ADAPTER.fetch(t)).json()};ea.add(sC);let sM={name:"loadTxt",extension:{type:er.LoadParser,priority:sR.Low},test:t=>sI(t,"text/plain")||sy(t,".txt"),load:async t=>await (await A.ADAPTER.fetch(t)).text()};ea.add(sM);let sP=["normal","bold","100","200","300","400","500","600","700","800","900"],sD=[".ttf",".otf",".woff",".woff2"],sB=["font/ttf","font/otf","font/woff","font/woff2"],sN=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i,sO=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function sL(t){return sO.test(t)?t:encodeURI(t)}let sF={extension:{type:er.LoadParser,priority:sR.Low},name:"loadWebFont",test:t=>sI(t,sB)||sy(t,sD),async load(t,e){let i=A.ADAPTER.getFontFaceSet();if(i){let r=[],s=e.data?.family??function(t){let e=K.extname(t),i=K.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)),r=i.length>0;for(let s of i)if(!s.match(sN)){r=!1;break}let n=i.join(" ");return r||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}(t),n=e.data?.weights?.filter(t=>sP.includes(t))??["normal"],a=e.data??{};for(let o=0;o<n.length;o++){let h=n[o],l=new FontFace(s,`url(${sL(t)})`,{...a,weight:h});await l.load(),i.add(l),r.push(l)}return 1===r.length?r[0]:r}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(t){(Array.isArray(t)?t:[t]).forEach(t=>A.ADAPTER.getFontFaceSet().delete(t))}};ea.add(sF);let sk=0,sU,sG={id:"checkImageBitmap",code:` 864 async function checkImageBitmap() 865 { 866 try 867 { 868 if (typeof createImageBitmap !== 'function') return false; 869 870 const response = await fetch('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII='); 871 const imageBlob = await response.blob(); 872 const imageBitmap = await createImageBitmap(imageBlob); 873 874 return imageBitmap.width === 1 && imageBitmap.height === 1; 875 } 876 catch (e) 877 { 878 return false; 879 } 880 } 881 checkImageBitmap().then((result) => { self.postMessage(result); }); 882 `},sH={id:"loadImageBitmap",code:` 883 async function loadImageBitmap(url) 884 { 885 const response = await fetch(url); 886 887 if (!response.ok) 888 { 889 throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \` 890 + \`\${response.status} \${response.statusText}\`); 891 } 892 893 const imageBlob = await response.blob(); 894 const imageBitmap = await createImageBitmap(imageBlob); 895 896 return imageBitmap; 897 } 898 self.onmessage = async (event) => 899 { 900 try 901 { 902 const imageBitmap = await loadImageBitmap(event.data.data[0]); 903 904 self.postMessage({ 905 data: imageBitmap, 906 uuid: event.data.uuid, 907 id: event.data.id, 908 }, [imageBitmap]); 909 } 910 catch(e) 911 { 912 self.postMessage({ 913 error: e, 914 uuid: event.data.uuid, 915 id: event.data.id, 916 }); 917 } 918 };`},sX,sz=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise(t=>{let e=URL.createObjectURL(new Blob([sG.code],{type:"application/javascript"})),i=new Worker(e);i.addEventListener("message",r=>{i.terminate(),URL.revokeObjectURL(e),t(r.data)})})),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===sU&&(sU=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<sU&&(sX||(sX=URL.createObjectURL(new Blob([sH.code],{type:"application/javascript"}))),this._createdWorkers++,(t=new Worker(sX)).addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((i,r)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:r})});return this.next(),i}next(){if(!this.queue.length)return;let t=this.getWorker();if(!t)return;let e=this.queue.pop(),i=e.id;this.resolveHash[sk]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:sk++,id:i})}};function sV(t,e,i){t.resource.internal=!0;let r=new iB(t),s=()=>{delete e.promiseCache[i],sE.has(i)&&sE.remove(i)};return r.baseTexture.once("destroyed",()=>{i in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),r.once("destroyed",()=>{t.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}let sW=[".jpeg",".jpg",".png",".webp",".avif"],sj=["image/jpeg","image/png","image/webp","image/avif"];async function sY(t){let e=await A.ADAPTER.fetch(t);if(!e.ok)throw Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);let i=await e.blob();return await createImageBitmap(i)}let s$={name:"loadTextures",extension:{type:er.LoadParser,priority:sR.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>sI(t,sj)||sy(t,sW),async load(t,e,i){let r=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap,s;s=r?this.config.preferWorkers&&await sz.isImageBitmapSupported()?await sz.loadImageBitmap(t):await sY(t):await new Promise((e,i)=>{let r=new Image;r.crossOrigin=this.config.crossOrigin,r.src=t,r.complete?e(r):(r.onload=()=>e(r),r.onerror=t=>i(t))});let n={...e.data};n.resolution,n.resolution=tW(t),r&&n.resourceOptions?.ownsImageBitmap===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);let a=new ev(s,n);return a.resource.src=t,sV(a,i,t)},unload(t){t.destroy(!0)}};ea.add(s$);let sq={extension:{type:er.LoadParser,priority:sR.High},name:"loadSVG",test:t=>sI(t,"image/svg+xml")||sy(t,".svg"),testParse:async t=>rG.test(t),async parse(t,e,i){let r=new rG(t,e?.data?.resourceOptions);await r.load();let s=new ev(r,{resolution:tW(t),...e?.data});return s.resource.src=e.src,sV(s,i,e.src)},load:async(t,e)=>(await A.ADAPTER.fetch(t)).text(),unload:s$.unload};ea.add(sq);let sK=[".mp4",".m4v",".webm",".ogv"],sZ=["video/mp4","video/webm","video/ogg"],sQ={name:"loadVideo",extension:{type:er.LoadParser,priority:sR.High},config:{defaultAutoPlay:!0},test:t=>sI(t,sZ)||sy(t,sK),async load(t,e,i){let r,s=await (await A.ADAPTER.fetch(t)).blob(),n=URL.createObjectURL(s);try{let a={autoPlay:this.config.defaultAutoPlay,...e?.data?.resourceOptions},o=new rH(n,a);await o.load();let h=new ev(o,{alphaMode:await Q(),resolution:tW(t),...e?.data});h.resource.src=t,(r=sV(h,i,t)).baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(l){throw URL.revokeObjectURL(n),l}return r},unload(t){t.destroy(!0)}};ea.add(sQ);class sJ{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.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){"string"==typeof t?this._defaultSearchParams=t:this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}getAlias(t){let{alias:e,name:i,src:r,srcs:s}=t;return sb(e||i||r||s,t=>"string"==typeof t?t:Array.isArray(t)?t.map(t=>t?.src??t?.srcs??t):t?.src||t?.srcs?t.src??t.srcs:t,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEac
918h(t=>{this.addBundle(t.name,t.assets)})}addBundle(t,e){let i=[];Array.isArray(e)?e.forEach(e=>{let r=e.src??e.srcs,s=e.alias??e.name,n;if("string"==typeof s){let a=this._createBundleAssetId(t,s);i.push(a),n=[s,a]}else{let o=s.map(e=>this._createBundleAssetId(t,e));i.push(...o),n=[...s,...o]}this.add({...e,alias:n,src:r})}):Object.keys(e).forEach(r=>{let s=[r,this._createBundleAssetId(t,r)];if("string"==typeof e[r])this.add({alias:s,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:s,src:e[r]});else{let n=e[r],a=n.src??n.srcs;this.add({...n,alias:s,src:Array.isArray(a)?a:[a]})}i.push(...s)}),this._bundles[t]=i}add(t,e,i,r,s){let n=[];"string"==typeof t||Array.isArray(t)&&"string"==typeof t[0]?(Y("7.2.0",`Assets.add now uses an object instead of individual parameters. 919Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),n.push({alias:t,src:e,data:i,format:r,loadParser:s})):Array.isArray(t)?n.push(...t):n.push(t);let a;a=t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)},sb(n).forEach(t=>{let{src:e,srcs:i}=t,{data:r,format:s,loadParser:n}=t,o=sb(e||i).map(t=>"string"==typeof t?function(t){let e=t.match(/\{(.*?)\}/g),i=[];if(e){let r=[];e.forEach(t=>{let e=t.substring(1,t.length-1).split(",");r.push(e)}),function t(e,i,r,s,n){let a=i[r];for(let o=0;o<a.length;o++){let h=a[o];r<i.length-1?t(e.replace(s[r],h),i,r+1,s,n):n.push(e.replace(s[r],h))}}(t,r,0,e,i)}else i.push(t);return i}(t):Array.isArray(t)?t:[t]),h=this.getAlias(t);Array.isArray(h)?h.forEach(a):a(h);let l=[];o.forEach(t=>{t.forEach(t=>{let e={};if("object"!=typeof t){e.src=t;for(let i=0;i<this._parsers.length;i++){let a=this._parsers[i];if(a.test(t)){e=a.parse(t);break}}}else r=t.data??r,s=t.format??s,n=t.loadParser??n,e={...e,...t};if(!h)throw Error(`[Resolver] alias is undefined for this asset: ${e.src}`);e=this.buildResolvedAsset(e,{aliases:h,data:r,format:s,loadParser:n}),l.push(e)})}),h.forEach(t=>{this._assetMap[t]=l})})}resolveBundle(t){let e=sT(t);t=sb(t);let i={};return t.forEach(t=>{let e=this._bundles[t];if(e){let r=this.resolve(e),s={};for(let n in r){let a=r[n];s[this._extractAssetIdFromBundle(t,n)]=a}i[t]=s}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if("string"!=typeof t){let i={};for(let r in e)i[r]=e[r].src;return i}return e.src}resolve(t){let e=sT(t);t=sb(t);let i={};return t.forEach(t=>{if(!this._resolverHash[t]){if(this._assetMap[t]){let e=this._assetMap[t],r=e[0],s=this._getPreferredOrder(e);s?.priority.forEach(t=>{s.params[t].forEach(i=>{let r=e.filter(e=>!!e[t]&&e[t]===i);r.length&&(e=r)})}),this._resolverHash[t]=e[0]??r}else this._resolverHash[t]=this.buildResolvedAsset({alias:[t],src:t},{})}i[t]=this._resolverHash[t]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[0],r=this._preferredOrder.find(t=>t.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){let{aliases:i,data:r,loadParser:s,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=K.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=s??t.loadParser,t.format=n??K.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}let s0=new class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new sJ,this.loader=new sA,this.cache=sE,this._backgroundLoader=new sx(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}let i=t.texturePreference?.resolution??1,r=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:"number"==typeof i?[i]:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,r,s){this.resolver.add(t,e,i,r,s)}async load(t,e){this._initialized||await this.init();let i=sT(t),r=sb(t).map(t=>{if("string"!=typeof t){let e=this.resolver.getAlias(t);return e.some(t=>!this.resolver.hasKey(t))&&this.add(t),Array.isArray(e)?e[0]:e}return this.resolver.hasKey(t)||this.add({alias:t,src:t}),t}),s=this.resolver.resolve(r),n=await this._mapLoadToResolve(s,e);return i?n[r[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;"string"==typeof t&&(i=!0,t=[t]);let r=this.resolver.resolveBundle(t),s={},n=Object.keys(r),a=0,o=0,h=()=>{e?.(++a/o)},l=n.map(t=>{let e=r[t];return o+=Object.keys(e).length,this._mapLoadToResolve(e,h).then(e=>{s[t]=e})});return await Promise.all(l),i?s[t[0]]:s}
919async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(t=>{this._backgroundLoader.add(Object.values(t))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return sE.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=sE.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let n={};return i.forEach((t,e)=>{let i=s[t.src],a=[t.src];t.alias&&a.push(...t.alias),n[r[e]]=i,sE.set(a,i)}),n}async unload(t){this._initialized||await this.init();let e=sb(t).map(t=>"string"!=typeof t?t.src:t),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=sb(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(t=>this._unloadFromResolved(e[t]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(t=>{sE.remove(t.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];for(let i of(t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]),t.detections))t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((t,i)=>e.indexOf(t)===i)}get detections(){return this._detections}get preferWorkers(){return s$.config.preferWorkers}set preferWorkers(t){Y("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(e=>e in t).forEach(i=>{e.config[i]=t[i]})})}};ea.handleByList(er.LoadParser,s0.loader.parsers).handleByList(er.ResolveParser,s0.resolver.parsers).handleByList(er.CacheParser,s0.cache.parsers).handleByList(er.DetectionParser,s0.detections);let s1={extension:er.CacheParser,test:t=>Array.isArray(t)&&t.every(t=>t instanceof iB),getCacheableAssets(t,e){let i={};return t.forEach(t=>{e.forEach((e,r)=>{i[t+(0===r?"":r+1)]=e})}),i}};async function s2(t){if("Image"in globalThis)return new Promise(e=>{let i=new Image;i.onload=()=>{e(!0)},i.onerror=()=>{e(!1)},i.src=t});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await (await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}ea.add(s1);let s3={extension:{type:er.DetectionParser,priority:1},test:async()=>s2("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter(t=>"avif"!==t)};ea.add(s3);let s4={extension:{type:er.DetectionParser,priority:0},test:async()=>s2("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter(t=>"webp"!==t)};ea.add(s4);let s5=["png","jpg","jpeg"],s8={extension:{type:er.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...s5],remove:async t=>t.filter(t=>!s5.includes(t))};ea.add(s8);let s6="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function s7(t){return!s6&&""!==document.createElement("video").canPlayType(t)}let s9={extension:{type:er.DetectionParser,priority:0},test:async()=>s7("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter(t=>"webm"!==t)};ea.add(s9);let nt={extension:{type:er.DetectionParser,priority:0},test:async()=>s7("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter(t=>"mp4"!==t&&"m4v"!==t)};ea.add(nt);let ne={extension:{type:er.DetectionParser,priority:0},test:async()=>s7("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter(t=>"ogv"!==t)};ea.add(ne);let ni={extension:er.ResolveParser,test:s$.test,parse:t=>({resolution:parseFloat(A.RETINA_PREFIX.exec(t)?.[1]??"1"),format:K.extname(t).slice(1),src:t})};ea.add(ni);let nr=(t,e)=>{let i=e.split("?")[1];return i&&(t+=`?${i}`),t};var ns,nn=((ns=nn||{})[ns.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",ns[ns.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",ns[ns.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",ns[ns.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",ns[ns.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",ns[ns.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",ns[ns.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",ns[ns.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",ns[ns.COMPRESSED_R11_
919EAC=37488]="COMPRESSED_R11_EAC",ns[ns.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",ns[ns.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",ns[ns.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",ns[ns.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",ns[ns.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",ns[ns.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",ns[ns.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",ns[ns.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",ns[ns.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",ns[ns.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",ns[ns.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",ns[ns.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",ns[ns.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",ns[ns.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",ns[ns.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",ns[ns.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",ns[ns.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",ns[ns.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",ns);let na={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},no,nh;function nl(){nh={s3tc:no.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:no.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:no.getExtension("WEBGL_compressed_texture_etc"),etc1:no.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:no.getExtension("WEBGL_compressed_texture_pvrtc")||no.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:no.getExtension("WEBGL_compressed_texture_atc"),astc:no.getExtension("WEBGL_compressed_texture_astc")}}let nu={extension:{type:er.DetectionParser,priority:2},async test(){let t=A.ADAPTER.createCanvas().getContext("webgl");return t?(no=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},async add(t){nh||nl();let e=[];for(let i in nh)nh[i]&&e.push(i);return[...e,...t]},remove:async t=>(nh||nl(),t.filter(t=>!(t in nh)))};ea.add(nu);class nd extends em{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,r;"string"==typeof t?(i=t,r=new Uint8Array):(i=null,r=t),super(r,e),this.origin=i,this.buffer=r?new eo(r):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 eo(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this))),this._load}}class nc extends nd{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=nc._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||nc._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){let r=t.gl;if(!t.context.extensions[this._extension])throw Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let s=0,n=this.levels;s<n;s++){let{levelID:a,levelWidth:o,levelHeight:h,levelBuffer:l}=this._levelBuffers[s];r.compressedTexImage2D(r.TEXTURE_2D,a,this.format,o,h,0,l)}return!0}onBlobLoaded(){this._levelBuffers=nc._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,i,r,s,n,a){let o=Array(i),h=t.byteOffset,l=n,u=a,d=l+r-1&~(r-1),c=u+s-1&~(s-1),f=d*c*na[e];for(let p=0;p<i;p++)o[p]={levelID:p,levelWidth:i>1?l:d,levelHeight:i>1?u:c,levelBuffer:new Uint8Array(t.buffer,h,f)},h+=f,u=u>>1||1,f=(d=(l=l>>1||1)+r-1&~(r-1))*(c=u+s-1&~(s-1))*na[e];return o}}let nf={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},np={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},nm={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},ng={827611204:nn.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:nn.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:nn.COMPRESSED_RGBA_S3TC_DXT5_EXT},n_={70:nn.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:nn.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:nn.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:nn.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:nn.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:nn.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:nn.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:nn.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:nn.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT},nv=[171,75,84,88,32,49,49,187,13,10,26,10],nx={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ny={[d.UNSIGNED_BYTE]:1,[d.UNSIGNED_SHORT]:2,[d.INT]:4,[d.UNSIGNED_INT]:4,[d.FLOAT]:4,[d.HALF_FLOAT]:8},nb={[l.RGBA]:4,[l.RGB]:3,[l.RG]:2,[l.RED]:1,[l.LUMINANCE]:1,[l.LUMINANCE_ALPHA]:2,[l.ALPHA]:1},nE={[d.UNSIGNED_SHORT_4_4_4_4]:2,[d.UNSIGNED_SHORT_5_5_5_1]:2,[d.UNSIGNED_SHORT_5_6_5]:2},nT={extension:{type:er.LoadParser,priority:sR.High},name:"loadDDS",test:t=>sy(t,".dds"),async load(t,e,i){let r=await (await A.ADAPTER.fetch(t)).arrayBuffer(),s=(function(t){let e=new Uint32Array(t);if(542327876!==e[0])throw Error("Invalid DDS file magic word");let i=new Uint32Array(t,0,124/Uint32Array.BYTES_PER_ELEMENT),r=i[nf.HEIGHT],s=i[nf.WIDTH],n=i[nf.MIPMAP_COUNT],a=new Uint32Array(t,nf.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=a[1];if(4&o){let h=a[np.FOURCC];if(808540228!==h){let l=ng[h],u=new Uint8Array(t,128);return[new nc(u,{format:l,width:s,height:r,levels:n})]}let d=new Uint32Array(e.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),c=d[nm.DXGI_FORMAT],f=d[nm.RESOURCE_DIMENSION],p=d[nm.MISC_FLAG],m=d[nm.ARRAY_SIZE],g=n_[c];if(void 0===g)throw Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(4===p)throw Error("DDSParser does not support cubemap textures");if(6===f)throw Error("DDSParser does not supported 3D texture data");let _=[];
919if(1===m)_.push(new Uint8Array(t,148));else{let v=na[g],x=0,y=s,b=r;for(let E=0;E<n;E++){let T=Math.max(1,y+3&-4),A=Math.max(1,b+3&-4),S=T*A*v;x+=S,y>>>=1,b>>>=1}let w=148;for(let R=0;R<m;R++)_.push(new Uint8Array(t,w,x)),w+=x}return _.map(t=>new nc(t,{format:g,width:s,height:r,levels:n}))}throw 64&o?Error("DDSParser does not support uncompressed texture data."):512&o?Error("DDSParser does not supported YUV uncompressed texture data."):131072&o?Error("DDSParser does not support single-channel (lumninance) texture data!"):2&o?Error("DDSParser does not support single-channel (alpha) texture data!"):Error("DDSParser failed to load a texture file due to an unknown reason!")})(r).map(r=>{let s=new ev(r,{mipmap:m.OFF,alphaMode:g.NO_PREMULTIPLIED_ALPHA,resolution:tW(t),...e.data});return sV(s,i,t)});return 1===s.length?s[0]:s},unload(t){Array.isArray(t)?t.forEach(t=>t.destroy(!0)):t.destroy(!0)}};ea.add(nT);let nA={extension:{type:er.LoadParser,priority:sR.High},name:"loadKTX",test:t=>sy(t,".ktx"),async load(t,e,i){let r=await (await A.ADAPTER.fetch(t)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:a}=function(t,e,i=!1){let r=new DataView(e);if(!function(t,e){for(let i=0;i<nv.length;i++)if(e.getUint8(i)!==nv[i])return console.error(`${t} is not a valid *.ktx file!`),!1;return!0}(t,r))return null;let s=67305985===r.getUint32(nx.ENDIANNESS,!0),n=r.getUint32(nx.GL_TYPE,s),a=r.getUint32(nx.GL_FORMAT,s),o=r.getUint32(nx.GL_INTERNAL_FORMAT,s),h=r.getUint32(nx.PIXEL_WIDTH,s),u=r.getUint32(nx.PIXEL_HEIGHT,s)||1,c=r.getUint32(nx.PIXEL_DEPTH,s)||1,f=r.getUint32(nx.NUMBER_OF_ARRAY_ELEMENTS,s)||1,p=r.getUint32(nx.NUMBER_OF_FACES,s),m=r.getUint32(nx.NUMBER_OF_MIPMAP_LEVELS,s),g=r.getUint32(nx.BYTES_OF_KEY_VALUE_DATA,s);if(0===u||1!==c)throw Error("Only 2D textures are supported");if(1!==p)throw Error("CubeTextures are not supported by KTXLoader yet!");if(1!==f)throw Error("WebGL does not support array textures");let _=h+3&-4,v=u+3&-4,x=Array(f),y=h*u;0===n&&(y=_*v);let b;if(void 0===(b=0!==n?ny[n]?ny[n]*nb[a]:nE[n]:na[o]))throw Error("Unable to resolve the pixel format stored in the *.ktx file!");let E=i?function(t,e,i){let r=new Map,s=0;for(;s<e;){let n=t.getUint32(64+s,i),a=64+s+4,o=3-(n+3)%4;if(0===n||n>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&0!==t.getUint8(a+h);h++);if(-1===h){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}let l=new TextDecoder().decode(new Uint8Array(t.buffer,a,h)),u=new DataView(t.buffer,a+h+1,n-h-1);r.set(l,u),s+=4+n+o}return r}(r,g,s):null,T=y*b,A=h,S=u,w=_,R=v,I=64+g;for(let C=0;C<m;C++){let M=r.getUint32(I,s),P=I+4;for(let D=0;D<f;D++){let B=x[D];B||(B=x[D]=Array(m)),B[C]={levelID:C,levelWidth:m>1||0!==n?A:w,levelHeight:m>1||0!==n?S:R,levelBuffer:new Uint8Array(e,P,T)},P+=T}I+=M+4,I=I%4!=0?I+4-I%4:I,S=S>>1||1,T=(w=(A=A>>1||1)+4-1&-4)*(R=S+4-1&-4)*b}return 0!==n?{uncompressed:x.map(t=>{let e=t[0].levelBuffer,i=!1;return n===d.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):n===d.UNSIGNED_INT?(i=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):n===d.INT&&(i=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new em(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:n,format:i?function(t){switch(t){case l.RGBA:return l.RGBA_INTEGER;case l.RGB:return l.RGB_INTEGER;case l.RG:return l.RG_INTEGER;case l.RED:return l.RED_INTEGER;default:return t}}(a):a}}),kvData:E}:{compressed:x.map(t=>new nc(null,{format:o,width:h,height:u,levels:m,levelBuffers:t})),kvData:E}}(t,r),o=s??n,h={mipmap:m.OFF,alphaMode:g.NO_PREMULTIPLIED_ALPHA,resolution:tW(t),...e.data},u=o.map(e=>{o===n&&Object.assign(h,{type:e.type,format:e.format});let r=e.resource??e,s=new ev(r,h);return s.ktxKeyValueData=a,sV(s,i,t)});return 1===u.length?u[0]:u},unload(t){Array.isArray(t)?t.forEach(t=>t.destroy(!0)):t.destroy(!0)}};ea.add(nA);let nS={extension:er.ResolveParser,test(t){let e=K.extname(t).slice(1);return["basis","ktx","dds"].includes(e)},parse(t){let e=K.extname(t).slice(1);if("ktx"===e){let i=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(i.some(e=>t.endsWith(e)))return{resolution:parseFloat(A.RETINA_PREFIX.exec(t)?.[1]??"1"),format:i.find(e=>t.endsWith(e)),src:t}}return{resolution:parseFloat(A.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e,src:t}}};ea.add(nS);let nw=new eL,nR=class t{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,r){let s=new Image;return s.src=await this.base64(t,e,i,r),s}async base64(t,e,i,r){let s=this.canvas(t,r);if(void 0!==s.toBlob)return new Promise((t,r)=>{s.toBlob(e=>{if(!e){r(Error("ICanvas.toBlob failed!"));return}let i=new FileReader;i.onload=()=>t(i.result),i.onerror=r,i.readAsDataURL(e)},e,i)});if(void 0!==s.toDataURL)return s.toDataURL(e,i);if(void 0!==s.convertToBlob){let n=await s.convertToBlob({type:e,quality:i});return new Promise((t,e)=>{let i=new FileReader;i.onload=()=>t(i.result),i.onerror=e,i.readAsDataURL(n)})}throw Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,i){let{pixels:r,width:s,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,i);a&&t._flipY(r,s,n),o&&t._unpremultiplyAlpha(r);let h=new tX(s,n,1),l=new ImageData(new Uint8ClampedArray(r.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(e,i){let{pixels:r,width:s,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,i);return a&&t._flipY(r,s,n),o&&t._unpremultiplyAlpha(r),r}_rawPixels(t,e){let i=this.renderer;if(!i)throw Error("The Extract has already been destroyed");let r,s=!1,n=!1,a,o=!1;t&&(t instanceof iN?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),o=!0,e&&(nw.width=e.width,nw.height=e.height,e=nw)));let h=i.gl;if(a){if(r=a.baseTexture.resolution,e=e??a.frame,s=!1,n=a.baseTexture.alphaMode>0&&a.baseTexture.format===l.RGBA,!o){i.renderTexture.bind(a);let u=a.framebuffer.glFramebuffers[i.CONTEXT_UID];u.blitFramebuffer&&i.framebuffer.bind(u.blitFramebuffer)}}else r=i.resolution,e||((e=nw).width=i.width/r,e.height=i.height/r),s=!0,n=this._rendererPremultipliedAlpha,i.renderTexture.bind();let d=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),f=new Uint8Array(4*d*c);return h.readPixels(Math.round(e.x*r),Math.round(e.y*r),d,c,h.RGBA,h.UNSIGNED_BYTE,f),o&&a?.destroy(!0),{pixels:f,width:d,height:c,flipY:s,premultipliedAlpha:n}}destroy(){this.renderer=null}static _flipY(t,e,i){let r=e<<2,s=i>>1,n=new Uint8Array(r);for(let a=0;a<s;a++){let o=a*r,h=(i-a-1)*r;n.set(t.subarray(o,o+r)),t.copyWithin(o,h,h+r),t.set(n,h)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));let e=t.length;for(let i=0;i<e;i+=4){let r=t[i+3];if(0!==r){let s=255.001/r;t[i]=t[i]*s+.5,t[i+1]=t[i+1]*s+.5,t[i+2]=t[i+2]*s+.5}}}};nR.extension={name:"extract",type:er.RendererSystem},ea.add(nR);let nI={build(t){let e=t.points,i,r,s,n,a,o;if(t.type===eB.CIRC){let h=t.shape;i=h.x,r=h.y,a=o=h.radius,s=n=0}else if(t.type===eB.ELIP){let l=t.shape;i=l.x,r=l.y,a=l.width,o=l.height,s=n=0}else{let u=t.shape,d=u.width/2,c=u.height/2;i=u.x+d,r=u.y+c,a=o=Math.max(0,Math.min(u.radius,Math.min(d,c))),s=d-a,n=c-o}if(!(a>=0&&o>=0&&s>=0&&n>=0)){e.length=0;return}let f=Math.ceil(2.3*Math.sqrt(a+o)),p=8*f+(s?4:0)+(n?4:0);if(e.length=p,0===p)return;if(0===f){e.length=8,e[0]=e[6]=i+s,e[1]=e[3]=r+n,e[2]=e[4]=i-s,e[5]=e[7]=r-n;return}let m=0,g=4*f+(s?2:0)+2,_=g,v=p;{let x=s+a,y=n,b=i+x,E=i-x,T=r+y;if(e[m++]=b,e[m++]=T,e[--g]=T,e[--g]=E,n){let A=r-y;e[_++]=E,e[_++]=A,e[--v]=A,e[--v]=b}}for(let S=1;S<f;S++){let w=Math.PI/2*(S/f),R=s+Math.cos(w)*a,I=n+Math.sin(w)*o,C=i+R,M=i-R,P=r+I,D=r-I;e[m++]=C,e[m++]=P,e[--g]=P,e[--g]=M,e[_++]=M,e[_++]=D,e[--v]=D,e[--v]=C}{let B=s,N=n+o,O=i+B,L=i-B,F=r+N,k=r-N;
919e[m++]=O,e[m++]=F,e[--v]=k,e[--v]=O,s&&(e[m++]=L,e[m++]=F,e[--v]=k,e[--v]=L)}},triangulate(t,e){let i=t.points,r=e.points,s=e.indices;if(0===i.length)return;let n=r.length/2,a=n,o,h;if(t.type!==eB.RREC){let l=t.shape;o=l.x,h=l.y}else{let u=t.shape;o=u.x+u.width/2,h=u.y+u.height/2}let d=t.matrix;r.push(t.matrix?d.a*o+d.c*h+d.tx:o,t.matrix?d.b*o+d.d*h+d.ty:h),n++,r.push(i[0],i[1]);for(let c=2;c<i.length;c+=2)r.push(i[c],i[c+1]),s.push(n++,a,n);s.push(a+1,a,n)}};function nC(t,e=!1){let i=t.length;if(i<6)return;let r=0;for(let s=0,n=t[i-2],a=t[i-1];s<i;s+=2){let o=t[s],h=t[s+1];r+=(o-n)*(h+a),n=o,a=h}if(!e&&r>0||e&&r<=0){let l=i/2;for(let u=l+l%2;u<i;u+=2){let d=i-u-2,c=i-u-1,f=u+1;[t[d],t[u]]=[t[u],t[d]],[t[c],t[f]]=[t[f],t[c]]}}}let nM={build(t){t.points=t.shape.points.slice()},triangulate(t,e){let i=t.points,r=t.holes,s=e.points,n=e.indices;if(i.length>=6){nC(i,!1);let a=[];for(let o=0;o<r.length;o++){let h=r[o];nC(h.points,!0),a.push(i.length/2),i=i.concat(h.points)}let l=W(i,a,2);if(!l)return;let u=s.length/2;for(let d=0;d<l.length;d+=3)n.push(l[d]+u),n.push(l[d+1]+u),n.push(l[d+2]+u);for(let c=0;c<i.length;c++)s.push(i[c])}}};var nP,nD,nB=((nP=nB||{}).MITER="miter",nP.BEVEL="bevel",nP.ROUND="round",nP),nN=((nD=nN||{}).BUTT="butt",nD.ROUND="round",nD.SQUARE="square",nD);let nO={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}};class nL{static curveTo(t,e,i,r,s,n){let a=n[n.length-2],o=n[n.length-1]-e,h=a-t,l=r-e,u=i-t,d=Math.abs(o*u-h*l);if(d<1e-8||0===s)return(n[n.length-2]!==t||n[n.length-1]!==e)&&n.push(t,e),null;let c=o*o+h*h,f=l*l+u*u,p=o*l+h*u,m=s*Math.sqrt(c)/d,g=s*Math.sqrt(f)/d,_=m*p/c,v=g*p/f,x=m*u+g*h,y=m*l+g*o;return{cx:x+t,cy:y+e,radius:s,startAngle:Math.atan2(o*(g+_)-y,h*(g+_)-x),endAngle:Math.atan2(l*(m+v)-y,u*(m+v)-x),anticlockwise:h*l>u*o}}static arc(t,e,i,r,s,n,a,o,h){let l=a-n,u=nO._segmentsCount(Math.abs(l)*s,40*Math.ceil(Math.abs(l)/eC)),d=l/(2*u),c=2*d,f=Math.cos(d),p=Math.sin(d),m=u-1,g=m%1/m;for(let _=0;_<=m;++_){let v=_+g*_,x=d+n+c*v,y=Math.cos(x),b=-Math.sin(x);h.push((f*y+p*b)*s+i,(-(f*b)+p*y)*s+r)}}}class nF{static curveLength(t,e,i,r,s,n,a,o){let h=0,l=0,u=0,d=0,c=0,f=0,p=0,m=0,g=0,_=0,v=0,x=t,y=e;for(let b=1;b<=10;++b)d=(u=(l=b/10)*l)*l,m=(p=(f=(c=1-l)*c)*c)*t+3*f*l*i+3*c*u*s+d*a,g=p*e+3*f*l*r+3*c*u*n+d*o,_=x-m,v=y-g,x=m,y=g,h+=Math.sqrt(_*_+v*v);return h}static curveTo(t,e,i,r,s,n,a){let o=a[a.length-2],h=a[a.length-1];a.length-=2;let l=nO._segmentsCount(nF.curveLength(o,h,t,e,i,r,s,n)),u=0,d=0,c=0,f=0,p=0;a.push(o,h);for(let m=1,g=0;m<=l;++m)c=(d=(u=1-(g=m/l))*u)*u,p=(f=g*g)*g,a.push(c*o+3*d*g*t+3*u*f*i+p*s,c*h+3*d*g*e+3*u*f*r+p*n)}}function nk(t,e,i,r,s,n,a,o){let h,l;a?(h=r,l=-i):(h=-r,l=i);let u=t-i*s+h,d=e-r*s+l,c=t+i*n+h,f=e+r*n+l;return o.push(u,d,c,f),2}function nU(t,e,i,r,s,n,a,o){let h=i-t,l=r-e,u=Math.atan2(h,l),d=Math.atan2(s-t,n-e);o&&u<d?u+=2*Math.PI:!o&&u>d&&(d+=2*Math.PI);let c=u,f=d-u,p=Math.sqrt(h*h+l*l),m=(15*Math.abs(f)*Math.sqrt(p)/Math.PI>>0)+1,g=f/m;if(c+=g,o){a.push(t,e,i,r);for(let _=1,v=c;_<m;_++,v+=g)a.push(t,e,t+Math.sin(v)*p,e+Math.cos(v)*p);a.push(t,e,s,n)}else{a.push(i,r,t,e);for(let x=1,y=c;x<m;x++,y+=g)a.push(t+Math.sin(y)*p,e+Math.cos(y)*p,t,e);a.push(s,n,t,e)}return 2*m}function nG(t,e){t.lineStyle.native?function(t,e){let i=0,r=t.shape,s=t.points||r.points,n=r.type!==eB.POLY||r.closeStroke;if(0===s.length)return;let a=e.points,o=e.indices,h=s.length/2,l=a.length/2,u=l;for(a.push(s[0],s[1]),i=1;i<h;i++)a.push(s[2*i],s[2*i+1]),o.push(u,u+1),u++;n&&o.push(u,l)}(t,e):function(t,e){let i=t.shape,r=t.points||i.points.slice(),s=e.closePointEps;if(0===r.length)return;let n=t.lineStyle,a=new eN(r[0],r[1]),o=new eN(r[r.length-2],r[r.length-1]),h=i.type!==eB.POLY||i.closeStroke,l=Math.abs(a.x-o.x)<s&&Math.abs(a.y-o.y)<s;if(h){r=r.slice(),l&&(r.pop(),r.pop(),o.set(r[r.length-2],r[r.length-1]));let u=(a.x+o.x)*.5,d=(o.y+a.y)*.5;r.unshift(u,d),r.push(u,d)}let c=e.points,f=r.length/2,p=r.length,m=c.length/2,g=n.width/2,_=g*g,v=n.miterLimit*n.miterLimit,x=r[0],y=r[1],b=r[2],E=r[3],T=0,A=0,S=-(y-E),w=x-b,R=0,I=0,C=Math.sqrt(S*S+w*w);S/=C,w/=C,S*=g,w*=g;let M=n.alignment,P=(1-M)*2,D=2*M;h||(n.cap===nN.ROUND?p+=nU(x-S*(P-D)*.5,y-w*(P-D)*.5,x-S*P,y-w*P,x+S*D,y+w*D,c,!0)+2:n.cap===nN.SQUARE&&(p+=nk(x,y,S,w,P,D,!0,c))),c.push(x-S*P,y-w*P,x+S*D,y+w*D);for(let B=1;B<f-1;
919++B){x=r[(B-1)*2],y=r[(B-1)*2+1],b=r[2*B],E=r[2*B+1],T=r[(B+1)*2],A=r[(B+1)*2+1],C=Math.sqrt((S=-(y-E))*S+(w=x-b)*w),S/=C,w/=C,S*=g,w*=g,C=Math.sqrt((R=-(E-A))*R+(I=b-T)*I),R/=C,I/=C,R*=g,I*=g;let N=b-x,O=y-E,L=b-T,F=A-E,k=N*L+O*F,U=O*L-F*N,G=U<0;if(Math.abs(U)<.001*Math.abs(k)){c.push(b-S*P,E-w*P,b+S*D,E+w*D),k>=0&&(n.join===nB.ROUND?p+=nU(b,E,b-S*P,E-w*P,b-R*P,E-I*P,c,!1)+4:p+=2,c.push(b-R*D,E-I*D,b+R*P,E+I*P));continue}let H=(-S+x)*(-w+E)-(-S+b)*(-w+y),X=(-R+T)*(-I+E)-(-R+b)*(-I+A),z=(N*X-L*H)/U,V=(F*H-O*X)/U,W=(z-b)*(z-b)+(V-E)*(V-E),j=b+(z-b)*P,Y=E+(V-E)*P,$=b-(z-b)*D,q=E-(V-E)*D,K=Math.min(N*N+O*O,L*L+F*F),Z=G?P:D,Q=K+Z*Z*_,J=W<=Q,tt=n.join;if(tt===nB.MITER&&W/_>v&&(tt=nB.BEVEL),J)switch(tt){case nB.MITER:c.push(j,Y,$,q);break;case nB.BEVEL:G?c.push(j,Y,b+S*D,E+w*D,j,Y,b+R*D,E+I*D):c.push(b-S*P,E-w*P,$,q,b-R*P,E-I*P,$,q),p+=2;break;case nB.ROUND:G?(c.push(j,Y,b+S*D,E+w*D),p+=nU(b,E,b+S*D,E+w*D,b+R*D,E+I*D,c,!0)+4,c.push(j,Y,b+R*D,E+I*D)):(c.push(b-S*P,E-w*P,$,q),p+=nU(b,E,b-S*P,E-w*P,b-R*P,E-I*P,c,!1)+4,c.push(b-R*P,E-I*P,$,q))}else{switch(c.push(b-S*P,E-w*P,b+S*D,E+w*D),tt){case nB.MITER:G?c.push($,q,$,q):c.push(j,Y,j,Y),p+=2;break;case nB.ROUND:G?p+=nU(b,E,b+S*D,E+w*D,b+R*D,E+I*D,c,!0)+2:p+=nU(b,E,b-S*P,E-w*P,b-R*P,E-I*P,c,!1)+2}c.push(b-R*P,E-I*P,b+R*D,E+I*D),p+=2}}x=r[(f-2)*2],y=r[(f-2)*2+1],b=r[(f-1)*2],C=Math.sqrt((S=-(y-(E=r[(f-1)*2+1])))*S+(w=x-b)*w),S/=C,w/=C,S*=g,w*=g,c.push(b-S*P,E-w*P,b+S*D,E+w*D),h||(n.cap===nN.ROUND?p+=nU(b-S*(P-D)*.5,E-w*(P-D)*.5,b-S*P,E-w*P,b+S*D,E+w*D,c,!1)+2:n.cap===nN.SQUARE&&(p+=nk(b,E,S,w,P,D,!1,c)));let te=e.indices,ti=nO.epsilon*nO.epsilon;for(let tr=m;tr<p+m-2;++tr)x=c[2*tr],y=c[2*tr+1],b=c[(tr+1)*2],E=c[(tr+1)*2+1],T=c[(tr+2)*2],Math.abs(x*(E-(A=c[(tr+2)*2+1]))+b*(A-y)+T*(y-E))<ti||te.push(tr,tr+1,tr+2)}(t,e)}class nH{static curveLength(t,e,i,r,s,n){let a=t-2*i+s,o=e-2*r+n,h=2*i-2*t,l=2*r-2*e,u=4*(a*a+o*o),d=4*(a*h+o*l),c=h*h+l*l,f=2*Math.sqrt(u+d+c),p=Math.sqrt(u),m=2*u*p,g=2*Math.sqrt(c),_=d/p;return(m*f+p*d*(f-g)+(4*c*u-d*d)*Math.log((2*p+_+f)/(_+g)))/(4*m)}static curveTo(t,e,i,r,s){let n=s[s.length-2],a=s[s.length-1],o=nO._segmentsCount(nH.curveLength(n,a,t,e,i,r)),h=0,l=0;for(let u=1;u<=o;++u){let d=u/o;h=n+(t-n)*d,l=a+(e-a)*d,s.push(h+(t+(i-t)*d-h)*d,l+(e+(r-e)*d-l)*d)}}}let nX={[eB.POLY]:nM,[eB.CIRC]:nI,[eB.ELIP]:nI,[eB.RECT]:{build(t){let e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,a=t.points;a.length=0,s>=0&&n>=0&&a.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate(t,e){let i=t.points,r=e.points;if(0===i.length)return;let s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},[eB.RREC]:{build(t){nI.build(t)},triangulate(t,e){nI.triangulate(t,e)}}},nz=[],nV=[];class nW{constructor(t,e=null,i=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new nW(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}class nj{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}let nY=new eN,n$=class t extends eI{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new rX,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),nV.push(this.drawCalls[t]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){let i=this.batches[e];i.reset(),nz.push(i)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,r=null){let s=new nW(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;let i=new nW(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){let e=this.graphicsData;for(let i=0;i<e.length;++i){let r=e[i];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,nY):nY.copyFrom(t),r.shape.contains(nY.x,nY.y))){let s=!1;if(r.holes){for(let n=0;n<r.holes.length;n++)if(r.holes[n].shape.contains(nY.x,nY.y)){s=!0;break}}if(!s)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;let t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(let s=this.shapeIndex;s<e.length;s++){this.shapeIndex++;let n=e[s],a=n.fillStyle,o=n.lineStyle;nX[n.type].build(n),n.matrix&&this.transformPoints(n.points,n.matrix),(a.visible||o.visible)&&this.processHoles(n.holes);for(let h=0;h<2;h++){let l=0===h?a:o;if(!l.visible)continue;let u=l.texture.baseTexture,d=this.indices.length,c=this.points.length/2;u.wrapMode=p.REPEAT,0===h?this.processFill(n):this.processLine(n);let f=this.points.length/2-c;0!==f&&(i&&!this._compareStyles(r,l)&&(i.end(d,c),i=null),i||((i=nz.pop()||new nj).begin(l,d,c),this.batches.push(i),r=l),this.addUvs(this.points,t,l.texture,c,f,l.matrix))}}let m=this.indices.length,g=this.points.length/2;if(i&&i.end(m,g),0===this.batches.length){this.batchable=!0;return}let _=g>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&_===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=_?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){let i=this.graphicsData[t],r=i.fillStyle,s=i.lineStyle;if(r&&!r.texture.baseTexture.valid||s&&!s.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);let t=this.batches;for(let e=0,i=t.length;e<i;e++){let r=t[e];for(let s=0;s<r.size;s++){let n=r.start+s;this.indicesUint16[n]=this.indicesUint16[n]-r.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;let e=this.batches;for(let i=0;i<e.length;i++)if(e[i].style.native)return!1;return this.points.length<2*t.BATCHABLE_SIZE}buildDrawCalls(){let t=++ev._globalBatch;for(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),nV.push(this.drawCalls[e]);this.drawCalls.length=0;let i=this.colors,r=this.textureIds,s=nV.pop();s||((s=new ex).texArray=new id),s.texArray.count=0,s.start=0,s.size=0,s.type=h.TRIANGLES;let n=0,a=null,o=0,l=!1,u=h.TRIANGLES,d=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){let f=this.batches[c],m=f.style,g=m.texture.baseTexture;!!m.native!==l&&(u=(l=!!m.native)?h.LINES:h.TRIANGLES,a=null,n=8,t++),a!==g&&(a=g,g._batchEnabled!==t&&(8===n&&(t++,n=0,s.size>0&&((s=nV.pop())||((s=new ex).texArray=new id),this.drawCalls.push(s)),s.start=d,s.size=0,s.texArray.count=0,s.type=u),g.touched=1,g._batchEnabled=t,g._batchLocation=n,g.wrapMode=p.REPEAT,s.texArray.elements[s.texArray.count++
919]=g,n++)),s.size+=f.size,d+=f.size,o=g._batchLocation,this.addColors(i,m.color,m.alpha,f.attribSize,f.attribStart),this.addTextureIds(r,o,f.attribSize,f.attribStart)}ev._globalBatch=t,this.packAttributes()}packAttributes(){let t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(12*t.length),n=new Float32Array(s),a=new Uint32Array(s),o=0;for(let h=0;h<t.length/2;h++)n[o++]=t[2*h],n[o++]=t[2*h+1],n[o++]=e[2*h],n[o++]=e[2*h+1],a[o++]=i[h],n[o++]=r[h];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?nM.triangulate(t,this):nX[t.type].triangulate(t,this)}processLine(t){nG(t,this);for(let e=0;e<t.holes.length;e++)nG(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){let i=t[e];nX[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){let t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){let r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}}addColors(t,e,i,r,s=0){let n=tR.shared.setValue(e).toLittleEndianNumber(),a=tR.shared.setValue(n).toPremultiplied(i);t.length=Math.max(t.length,s+r);for(let o=0;o<r;o++)t[s+o]=a}addTextureIds(t,e,i,r=0){t.length=Math.max(t.length,r+i);for(let s=0;s<i;s++)t[r+s]=e}addUvs(t,e,i,r,s,n=null){let a=0,o=e.length,h=i.frame;for(;a<s;){let l=t[(r+a)*2],u=t[(r+a)*2+1];if(n){let d=n.a*l+n.c*u+n.tx;u=n.b*l+n.d*u+n.ty,l=d}a++,e.push(l/h.width,u/h.height)}let c=i.baseTexture;(h.width<c.width||h.height<c.height)&&this.adjustUvs(e,i,o,s)}adjustUvs(t,e,i,r){let s=e.baseTexture,n=i+2*r,a=e.frame,o=a.width/s.width,h=a.height/s.height,l=a.x/a.width,u=a.y/a.height,d=Math.floor(t[i]+1e-6),c=Math.floor(t[i+1]+1e-6);for(let f=i+2;f<n;f+=2)d=Math.min(d,Math.floor(t[f]+1e-6)),c=Math.min(c,Math.floor(t[f+1]+1e-6));l-=d,u-=c;for(let p=i;p<n;p+=2)t[p]=(t[p]+l)*o,t[p+1]=(t[p+1]+u)*h}};n$.BATCHABLE_SIZE=100;class nq{constructor(){this.color=16777215,this.alpha=1,this.texture=iB.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){let t=new nq;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=iB.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class nK extends nq{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=nN.BUTT,this.join=nB.MITER,this.miterLimit=10}clone(){let t=new nK;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=nN.BUTT,this.join=nB.MITER,this.miterLimit=10}}let nZ={},nQ=class t extends r${constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new nq,this._lineStyle=new nK,this._matrix=null,this._holeMode=!1,this.state=eu.for2d(),this._geometry=t||new n$,this._geometry.refCount++,this._transformID=-1,this._tintColor=new tR(16777215),this.blendMode=o.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new t(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,r=.5,s=!1){return"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:s}),this.lineTextureStyle(t)}lineTextureStyle(t){let e={width:0,texture:iB.WHITE,color:t?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:nN.BUTT,join:nB.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();let i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){let t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new eU,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new eU,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);let i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return(r!==t||s!==e)&&i.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,i,r){this._initCurve();let s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),nH.curveTo(t,e,i,r,s),this}bezierCurveTo(t,e,i,r,s,n){return this._initCurve(),nF.curveTo(t,e,i,r,s,n,this.currentPath.points),this}arcTo(t,e,i,r,s){this._initCurve(t,e);let n=this.currentPath.points,a=nL.curveTo(t,e,i,r,s,n);if(a){let{cx:o,cy:h,radius:l,startAngle:u,endAngle:d,anticlockwise:c}=a;this.arc(o,h,l,u,d,c)}return this}arc(t,e,i,r,s,n=!1){if(r===s||(!n&&s<=r?s+=eC:n&&r<=s&&(r+=eC),s-r==0))return this;let a=t+Math.cos(r)*i,o=e+Math.sin(r)*i,h=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){let u=Math.abs(l[l.length-2]-a),d=Math.abs(l[l.length-1]-o);u<h&&d<h||l.push(a,o)}else this.moveTo(a,o),l=this.currentPath.points;return nL.arc(a,o,t,e,i,r,s,n,l),this}beginFill(t=0,e){return this.beginTextureFill({texture:iB.WHITE,color:t,alpha:e})}normalizeColor(t){let e=tR.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha,t.alpha=e.alpha}beginTextureFill(t){let e={texture:iB.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();let i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,r){return this.drawShape(new eL(t,e,i,r))}drawRoundedRect(t,e,i,r,s){return this.drawShape(new eG(t,e,i,r,s))}drawCircle(t,e,i){return this.drawShape(new eF(t,e,i))}drawEllipse(t,e,i,r){return this.drawShape(new ek(t,e,i,r))}drawPolygon(...t){let e,i=!0,r=t[0];r.points?(i=r.closeStroke,e=r.points):e=Array.isArray(t[0])?t[0]:t;let s=new eU(e);return s.closeStroke=i,this.drawShape(s),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}
919isFastRect(){let t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===eB.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();let e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){let t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let r=0;r<i;r++){let s=t.batches[r],n=s.style.color,a=new Float32Array(this.vertexData.buffer,8*s.attribStart,2*s.attribSize),o=new Float32Array(t.uvsFloat32.buffer,8*s.attribStart,2*s.attribSize),h=new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),l={vertexData:a,blendMode:e,indices:h,uvs:o,_batchRGB:tR.shared.setValue(n).toRgbArray(),_tintRGB:n,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[r]=l}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){let r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){let e=this._resolveDirectShader(t),i=this._geometry,r=this.worldAlpha,s=e.uniforms,n=i.drawCalls;s.translationMatrix=this.transform.worldTransform,tR.shared.setValue(this._tintColor).premultiply(r).toArray(s.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,o=n.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){let{texArray:i,type:r,size:s,start:n}=e,a=i.count;for(let o=0;o<a;o++)t.texture.bind(i.elements[o],o);t.geometry.draw(r,s,n)}_resolveDirectShader(t){let e=this.shader,i=this.pluginName;if(!e){if(!nZ[i]){let{maxTextures:r}=t.plugins[i],s=new Int32Array(r);for(let n=0;n<r;n++)s[n]=n;let a={tint:new Float32Array([1,1,1,1]),translationMatrix:new eH,default:ih.from({uSamplers:s},!0)},o=t.plugins[i]._shader.program;nZ[i]=new il(o,a)}e=nZ[i]}return e}_calculateBounds(){this.finishPoly();let t=this._geometry;if(!t.graphicsData.length)return;let{minX:e,minY:i,maxX:r,maxY:s}=t.bounds;this._bounds.addFrame(this.transform,e,i,r,s)}containsPoint(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){let e=this.batches[t];e._tintRGB=tR.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){let t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;let e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,n=e.d,a=e.tx,o=e.ty,h=this._geometry.points,l=this.vertexData,u=0;for(let d=0;d<h.length;d+=2){let c=h[d],f=h[d+1];l[u++]=i*c+s*f+a,l[u++]=n*f+r*c+o}}closePath(){let t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,
919super.destroy(t)}};nQ.curves=nO,nQ._TEMP_POINT=new eN;let nJ=nQ;class n0{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;let e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}let n1=new eN,n2=new eU,n3=class t extends r${constructor(t,e,i,r=h.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||eu.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=A.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(e){let i=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===h.TRIANGLES&&i.length<2*t.BATCHABLE_SIZE?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(t){let e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){let e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;let r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){let t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));let r=this.transform.worldTransform,s=r.a,n=r.b,a=r.c,o=r.d,h=r.tx,l=r.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){let c=e[2*d],f=e[2*d+1];u[2*d]=s*c+a*f+h,u[2*d+1]=n*c+o*f+l}if(this._roundPixels){let p=A.RESOLUTION;for(let m=0;m<u.length;++m)u[m]=Math.round(u[m]*p)/p}this.vertexDirty=i}calculateUvs(){let t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new n0(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,n1);let e=this.geometry.getBuffer("aVertexPosition").data,i=n2.points,r=this.geometry.getIndex().data,s=r.length,n=4===this.drawMode?3:1;for(let a=0;a+2<s;a+=n){let o=2*r[a],h=2*r[a+1],l=2*r[a+2];if(i[0]=e[o],i[1]=e[o+1],i[2]=e[h],i[3]=e[h+1],i[4]=e[l],i[5]=e[l+1],n2.contains(n1.x,n1.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};n3.BATCHABLE_SIZE=100;class n4 extends eR{constructor(t,e,i){super();let r=new eb(t),s=new eb(e,!0),n=new eb(i,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,d.FLOAT).addAttribute("aTextureCoord",s,2,!1,d.FLOAT).addIndex(n),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var n5=`varying vec2 vTextureCoord; 920uniform vec4 uColor; 921 922uniform sampler2D uSampler; 923 924void main(void) 925{ 926 gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor; 927} 928`,n8=`attribute vec2 aVertexPosition; 929attribute vec2 aTextureCoord; 930 931uniform mat3 projectionMatrix; 932uniform mat3 translationMatrix; 933uniform mat3 uTextureMatrix; 934 935varying vec2 vTextureCoord; 936 937void main(void) 938{ 939 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
939)).xy, 0.0, 1.0); 940 941 vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy; 942} 943`;class n6 extends il{constructor(t,e){let i={uSampler:t,alpha:1,uTextureMatrix:eH.IDENTITY,uColor:new Float32Array([1,1,1,1])};(e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(i,e.uniforms),super(e.program||ia.from(n8,n5),i),this._colorDirty=!1,this.uvMatrix=new i$(t),this.batchable=void 0===e.program,this.pluginName=e.pluginName,this._tintColor=new tR(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;let t=this.texture.baseTexture.alphaMode;tR.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class n7{constructor(t,e,i){this.geometry=new eR,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let s=t[r];s={attributeName:s.attributeName,size:s.size,uploadFunction:s.uploadFunction,type:s.type||d.FLOAT,offset:s.offset},e[r]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){let t=this.geometry,e=0;this.indexBuffer=new eb(function(t,e=null){let i=6*t;if((e=e||new Uint16Array(i)).length!==i)throw Error(`Out buffer length is incorrect, got ${e.length} and expected ${i}`);for(let r=0,s=0;r<i;r+=6,s+=4)e[r+0]=s+0,e[r+1]=s+1,e[r+2]=s+2,e[r+3]=s+0,e[r+4]=s+2,e[r+5]=s+3;return e}(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let i=0;i<this.dynamicProperties.length;++i){let r=this.dynamicProperties[i];r.offset=e,e+=r.size,this.dynamicStride+=r.size}let s=new ArrayBuffer(this.size*this.dynamicStride*16);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new eb(this.dynamicData,!1,!1);let n=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){let o=this.staticProperties[a];o.offset=n,n+=o.size,this.staticStride+=o.size}let h=new ArrayBuffer(this.size*this.staticStride*16);this.staticData=new Float32Array(h),this.staticDataUint32=new Uint32Array(h),this.staticBuffer=new eb(this.staticData,!0,!1);for(let l=0;l<this.dynamicProperties.length;++l){let u=this.dynamicProperties[l];t.addAttribute(u.attributeName,this.dynamicBuffer,0,u.type===d.UNSIGNED_BYTE,u.type,4*this.dynamicStride,4*u.offset)}for(let c=0;c<this.staticProperties.length;++c){let f=this.staticProperties[c];t.addAttribute(f.attributeName,this.staticBuffer,0,f.type===d.UNSIGNED_BYTE,f.type,4*this.staticStride,4*f.offset)}}uploadDynamic(t,e,i){for(let r=0;r<this.dynamicProperties.length;r++){let s=this.dynamicProperties[r];s.uploadFunction(t,e,i,s.type===d.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let r=0;r<this.staticProperties.length;r++){let s=this.staticProperties[r];s.uploadFunction(t,e,i,s.type===d.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var n9=`varying vec2 vTextureCoord; 944varying vec4 vColor; 945 946uniform sampler2D uSampler; 947 948void main(void){ 949 vec4 color = texture2D(uSampler, vTextureCoord) * vColor; 950 gl_FragColor = color; 951}`,at=`attribute vec2 aVertexPosition; 952attribute vec2 aTextureCoord; 953attribute vec4 aColor; 954 955attribute vec2 aPositionCoord; 956attribute float aRotation; 957 958uniform mat3 translationMatrix; 959uniform vec4 uColor; 960 961varying vec2 vTextureCoord; 962varying vec4 vColor; 963 964void main(void){ 965 float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation); 966 float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation); 967 968 vec2 v = vec2(x, y); 969 v = v + aPositionCoord; 970 971 gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); 972 973 vTextureCoord = aTextureCoord; 974 vColor = aColor * uColor; 975} 976`;class ae extends ic{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new eH,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:d.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=il.from(at,n9,{}),this.state=eu.for2d()}render(t){let e=t.children,i=t._maxSize,r=t._batchSize,s=this.renderer,n=e.length;if(0===n)return;n>i&&!t.autoResize&&(n=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));let o=e[0]._texture.baseTexture,h=o.alphaMode>0;this.state.blendMode=tC(t.blendMode,h),s.state.set(this.state);let l=s.gl,u=t.worldTransform.copyTo(this.tempMatrix);
976u.prepend(s.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=tR.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);let d=!1;for(let c=0,f=0;c<n;c+=r,f+=1){let p=n-c;p>r&&(p=r),f>=a.length&&a.push(this._generateOneMoreBuffer(t));let m=a[f];m.uploadDynamic(e,c,p);let g=t._bufferUpdateIDs[f]||0;(d=d||m._updateID<g)&&(m._updateID=t._updateID,m.uploadStatic(e,c,p)),s.geometry.bind(m.geometry),l.drawElements(l.TRIANGLES,6*p,l.UNSIGNED_SHORT,0)}}generateBuffers(t){let e=[],i=t._maxSize,r=t._batchSize,s=t._properties;for(let n=0;n<i;n+=r)e.push(new n7(this.properties,s,r));return e}_generateOneMoreBuffer(t){let e=t._batchSize,i=t._properties;return new n7(this.properties,i,e)}uploadVertices(t,e,i,r,s,n){let a=0,o=0,h=0,l=0;for(let u=0;u<i;++u){let d=t[e+u],c=d._texture,f=d.scale.x,p=d.scale.y,m=c.trim,g=c.orig;m?(a=(o=m.x-d.anchor.x*g.width)+m.width,h=(l=m.y-d.anchor.y*g.height)+m.height):(a=g.width*(1-d.anchor.x),o=-(g.width*d.anchor.x),h=g.height*(1-d.anchor.y),l=-(g.height*d.anchor.y)),r[n]=o*f,r[n+1]=l*p,r[n+s]=a*f,r[n+s+1]=l*p,r[n+2*s]=a*f,r[n+2*s+1]=h*p,r[n+3*s]=o*f,r[n+3*s+1]=h*p,n+=4*s}}uploadPosition(t,e,i,r,s,n){for(let a=0;a<i;a++){let o=t[e+a].position;r[n]=o.x,r[n+1]=o.y,r[n+s]=o.x,r[n+s+1]=o.y,r[n+2*s]=o.x,r[n+2*s+1]=o.y,r[n+3*s]=o.x,r[n+3*s+1]=o.y,n+=4*s}}uploadRotation(t,e,i,r,s,n){for(let a=0;a<i;a++){let o=t[e+a].rotation;r[n]=o,r[n+s]=o,r[n+2*s]=o,r[n+3*s]=o,n+=4*s}}uploadUvs(t,e,i,r,s,n){for(let a=0;a<i;++a){let o=t[e+a]._texture._uvs;o?(r[n]=o.x0,r[n+1]=o.y0,r[n+s]=o.x1,r[n+s+1]=o.y1,r[n+2*s]=o.x2,r[n+2*s+1]=o.y2,r[n+3*s]=o.x3,r[n+3*s+1]=o.y3,n+=4*s):(r[n]=0,r[n+1]=0,r[n+s]=0,r[n+s+1]=0,r[n+2*s]=0,r[n+2*s+1]=0,r[n+3*s]=0,r[n+3*s+1]=0,n+=4*s)}}uploadTint(t,e,i,r,s,n){for(let a=0;a<i;++a){let o=t[e+a],h=tR.shared.setValue(o._tintRGB).toPremultiplied(o.alpha,o.texture.baseTexture.alphaMode>0);r[n]=h,r[n+s]=h,r[n+2*s]=h,r[n+3*s]=h,n+=4*s}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}ae.extension={name:"particle",type:er.RendererPlugin},ea.add(ae);var ai=((r=ai||{})[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r);let ar={willReadFrequently:!0},as=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0!==e){let i=A.ADAPTER.getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(t,e,i,r,s,n,a,o,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=s,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=o,this.fontProperties=h}static measureText(e,i,r,s=t._canvas){r=r??i.wordWrap;let n=i.toFontString(),a=t.measureFont(n);0===a.fontSize&&(a.fontSize=i.fontSize,a.ascent=i.fontSize);let o=s.getContext("2d",ar);o.font=n;let h=(r?t.wordWrap(e,i,s):e).split(/(?:\r\n|\r|\n)/),l=Array(h.length),u=0;for(let d=0;d<h.length;d++){let c=t._measureText(h[d],i.letterSpacing,o);l[d]=c,u=Math.max(u,c)}let f=u+i.strokeThickness;i.dropShadow&&(f+=i.dropShadowDistance);let p=i.lineHeight||a.fontSize+i.strokeThickness,m=Math.max(p,a.fontSize+2*i.strokeThickness)+i.leading+(h.length-1)*(p+i.leading);return i.dropShadow&&(m+=i.dropShadowDistance),new t(e,i,f,m,h,l,p+i.leading,u,a)}static _measureText(e,i,r){let s=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(r.letterSpacing=`${i}px`,r.textLetterSpacing=`${i}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let n=r.measureText(e).width;return n>0&&(s?n-=i:n+=(t.graphemeSegmenter(e).length-1)*i),n}static wordWrap(e,i,r=t._canvas){let s=r.getContext("2d",ar),n=0,a="",o="",h=Object.create(null),{letterSpacing:l,whiteSpace:u}=i,d=t.collapseSpaces(u),c=t.collapseNewlines(u),f=!d,p=i.wordWrapWidth+l,m=t.tokenize(e);for(let g=0;g<m.length;g++){let _=m[g];if(t.isNewline(_)){if(!c){o+=t.addLine(a),f=!d,a="",n=0;continue}_=" "}if(d){let v=t.isBreakingSpace(_),x=t.isBreakingSpace(a[a.length-1]);if(v&&x)continue}let y=t.getFromCache(_,l,h,s);if(y>
976p){if(""!==a&&(o+=t.addLine(a),a="",n=0),t.canBreakWords(_,i.breakWords)){let b=t.wordWrapSplit(_);for(let E=0;E<b.length;E++){let T=b[E],A=T,S=1;for(;b[E+S];){let w=b[E+S];if(t.canBreakChars(A,w,_,E,i.breakWords))break;T+=w,A=w,S++}E+=S-1;let R=t.getFromCache(T,l,h,s);R+n>p&&(o+=t.addLine(a),f=!1,a="",n=0),a+=T,n+=R}}else{a.length>0&&(o+=t.addLine(a),a="",n=0);let I=g===m.length-1;o+=t.addLine(_,!I),f=!1,a="",n=0}}else y+n>p&&(f=!1,o+=t.addLine(a),a="",n=0),(a.length>0||!t.isBreakingSpace(_)||f)&&(a+=_,n+=y)}return o+t.addLine(a,!1)}static addLine(e,i=!0){return e=t.trimRight(e),e=i?`${e} 977`:e}static getFromCache(e,i,r,s){let n=r[e];return"number"!=typeof n&&(n=t._measureText(e,i,s)+i,r[e]=n),n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(e){if("string"!=typeof e)return"";for(let i=e.length-1;i>=0;i--){let r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e}static isNewline(e){return"string"==typeof e&&t._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,i){return"string"==typeof e&&t._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){let i=[],r="";if("string"!=typeof e)return i;for(let s=0;s<e.length;s++){let n=e[s],a=e[s+1];if(t.isBreakingSpace(n,a)||t.isNewline(n)){""!==r&&(i.push(r),r=""),i.push(n);continue}r+=n}return""!==r&&i.push(r),i}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,s){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];let i={ascent:0,descent:0,fontSize:0},r=t._canvas,s=t._context;s.font=e;let n=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(s.measureText(n).width),o=Math.ceil(s.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*o);if(o=o*t.BASELINE_MULTIPLIER|0,0===a||0===h)return t._fonts[e]=i,i;r.width=a,r.height=h,s.fillStyle="#f00",s.fillRect(0,0,a,h),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,o);let l=s.getImageData(0,0,a,h).data,u=l.length,d=4*a,c=0,f=0,p=!1;for(c=0;c<o;++c){for(let m=0;m<d;m+=4)if(255!==l[f+m]){p=!0;break}if(p)break;f+=d}for(i.ascent=o-c,f=u-d,p=!1,c=h;c>o;--c){for(let g=0;g<d;g+=4)if(255!==l[f+g]){p=!0;break}if(p)break;f-=d}return i.descent=c-o,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{let i=new OffscreenCanvas(0,0);if(i.getContext("2d",ar)?.measureText)return t.__canvas=i,i;e=A.ADAPTER.createCanvas()}catch{e=A.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",ar)),t.__context}};as.METRICS_STRING="|\xc9q\xc5",as.BASELINE_SYMBOL="M",as.BASELINE_MULTIPLIER=1.4,as.HEIGHT_MULTIPLIER=2,as.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let t=new Intl.Segmenter;return e=>[...t.segment(e)].map(t=>t.segment)}return t=>[...t]})(),as.experimentalLetterSpacing=!1,as._fonts={},as._newlines=[10,13],as._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let an=as,aa=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ao=class t{constructor(t){this.styleID=0,this.reset(),au(this,t,t)}clone(){let e={};return au(e,this,t.defaultStyle),new t(e)}reset(){au(this,t.defaultStyle,t.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){let e=al(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){let e=al(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){let e=al(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){let t="number"==typeof this.fontSize?`${this.fontSize}px`:this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let r=e[i].trim();/([\"\'])[^\'\"]+\1/.test(r)||aa.includes(r)||(r=`"${r}"`),e[i]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};ao.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ai.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 ah=ao;function al(t){let e=tR.shared,i=t=>{let i=e.setValue(t);return 1===i.alpha?i.toHex():i.toRgbaString()};return Array.isArray(t)?t.map(i):i(t)}function au(t,e,i){for(let r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}let ad={texture:!0,children:!1,baseTexture:!0},ac=class t extends rZ{constructor(e,i,r){let s=!1;r||(r=A.ADAPTER.createCanvas(),s=!0),r.width=3,r.height=3;let n=iB.from(r);n.orig=new eL,n.trim=new eL,super(n),this._ownCanvas=s,this.canvas=r,this.context=r.getContext("2d",{willReadFrequently:!0}),this._resolution=t.defaultResolution??A.RESOLUTION,this._autoResolution=t.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=i,this.localStyleID=-1}static get experimentalLetterSpacing(){return an.experimentalLetterSpacing}static set experimentalLetterSpacing(t){Y("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),an.experimentalLetterSpacing=t}updateText(t){let e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();let i=this.context,r=an.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),s=r.width,n=r.height,a=r.lines,o=r.lineHeight,h=r.lineWidths,l=r.maxLineWidth,u=r.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,s)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,n)+2*e.padding)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,c,f=e.dropShadow?2:1;for(let p=0;p<f;++p){let m=e.dropShadow&&0===p,g=m?Math.ceil(Math.max(1,n)+2*e.padding):0,_=g*this._resolution;if(m){i.fillStyle="black",i.strokeStyle="black";let v=e.dropShadowColor,x=e.dropShadowBlur*this._resolution,y=e.dropShadowDistance*this._resolution;i.shadowColor=tR.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=x,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*y,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*y+_}else i.fillStyle=this._generateFillStyle(e,a,r),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let b=(o-u.fontSize)/2;o-u.fontSize<0&&(b=0);for(let E=0;E<a.length;E++)d=e.strokeThickness/2,c=e.strokeThickness/2+E*o+u.ascent+b,"right"===e.align?d+=l-h[E]:"center"===e.align&&(d+=(l-h[E])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[E],d+e.padding,c+e.padding-g,!0),e.fill&&this.drawLetterSpacing(a[E],d+e.padding,c+e.padding-g)}this.updateTexture()}drawLetterSpacing(t,e,i,r=!1){let s=this._style.letterSpacing,n=!1;if(an.experimentalLetterSpacingSupported&&(an.experimentalLetterSpacing?(this.context.letterSpacing=`${s}px`,this.context.textLetterSpacing=`${s}px`,n=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),0===s||n){r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e,o=an.graphemeSegmenter(t),h=this.context.measureText(t).width,l=0;for(let u=0;u<o.length;++u){let d=o[u];r?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let c="";for(let f=u+1;f<o.length;++f)c+=o[f];a+=h-(l=this.context.measureText(c).width)+s,h=l}}updateTexture(){let t=this.canvas;if(this._style.trim){let e=function(t){let e=function(t){let{width:e,height:i}=t,r=t.getContext("2d",{willReadFrequently:!0});if(null===r)throw TypeError("Failed to get canvas 2D context");let s=r.getImageData(0,0,e,i).data,n=0,a=0,o=e-1,h=i-1;for(;a<i&&tz(s,e,a);)++a;if(a===i)return tk.EMPTY;for(;tz(s,e,h);)--h;for(;tV(s,e,n,a,h);)++n;for(;tV(s,e,o,a,h);)--o;return++o,++h,new tk(n,a,o,h)}(t),{width:i,height:r}=e,s=null;if(!e.isEmpty()){let n=t.getContext("2d");if(null===n)throw TypeError("Failed to get canvas 2D context");s=n.getImageData(e.left,e.top,i,r)}return{width:i,height:r,data:s}}(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}let i=this._texture,r=this._style,s=r.trim?0:r.padding,n=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-s,i.trim.y=-s,i.orig.width=i._frame.width-2*s,i.orig.height=i._frame.height-2*s,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),-1===this._textureID&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){let r=t.fill;if(!Array.isArray(r))return r;if(1===r.length)return r[0];let s,n=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,o=this.canvas.width/this._resolution-n-2*a,h=this.canvas.height/this._resolution-n-2*a,l=r.slice(),u=t.fillGradientStops.slice();if(!u.length){let d=l.length+1;for(let c=1;c<d;++c)u.push(c/d)}if(l.unshift(r[0]),u.unshift(0),l.push(r[r.length-1]),u.push(1),t.fillGradientType===ai.LINEAR_VERTICAL){s=this.context.createLinearGradient(o/2,a,o/2,h+a);let f=i.fontProperties.fontSize+t.strokeThickness;for(let p=0;p<e.length;p++){let m=i.lineHeight*(p-1)+f,g=i.lineHeight*p,_=g;p>0&&m>g&&(_=(g+m)/2);let v=g+f,x=i.lineHeight*(p+1),y=v;p+1<e.length&&x<v&&(y=(v+x)/2);let b=(y-_)/h;for(let E=0;E<l.length;E++){let T=0,A=Math.min(1,Math.max(0,_/h+("number"==typeof u[E]?u[E]:E/l.length)*b));A=Number(A.toFixed(5)),s.addColorStop(A,l[E])}}}else{s=this.context.createLinearGradient(a,h/2,o+a,h/2);let S=l.length+1,w=1;for(let R=0;R<l.length;R++){let I;I="number"==typeof u[R]?u[R]:w/S,s.addColorStop(I,l[R]),w++}}return s}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},ad,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);let e=tO(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);let e=tO(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){(t=t||{})instanceof ah?this._style=t:this._style=new ah(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};ac.defaultAutoResolution=!0;class af{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function ap(t,e){let i=!1;if(t?._textures?.length){for(let r=0;r<t._textures.length;r++)if(t._textures[r]instanceof iB){let s=t._textures[r].baseTexture;e.includes(s)||(e.push(s),i=!0)}}return i}function am(t,e){if(t.baseTexture instanceof ev){let i=t.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function ag(t,e){if(t._texture&&t._texture instanceof iB){let i=t._texture.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function a_(t,e){return e instanceof ac&&(e.updateText(!0),!0)}function av(t,e){if(e instanceof ah){let i=e.toFontString();return an.measureFont(i),!0}return!1}function ax(t,e){if(t instanceof ac){e.includes(t.style)||e.push(t.style),e.includes(t)||e.push(t);let i=t._texture.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function ay(t,e){return t instanceof ah&&(e.includes(t)||e.push(t),!0)}let ab=class t{constructor(e){this.limiter=new af(t.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(ax),this.registerFindHook(ay),this.registerFindHook(ap),this.registerFindHook(am),this.registerFindHook(ag),this.registerUploadHook(a_),t
977his.registerUploadHook(av)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,rR.system.addOnce(this.tick,this,rA.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){let t=this.queue[0],e=!1;if(t&&!t._destroyed){for(let i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)rR.system.addOnce(this.tick,this,rA.UTILITY);else{this.ticking=!1;let s=this.completes.slice(0);this.completes.length=0;for(let n=0,a=s.length;n<a;n++)s[n]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof r$)for(let r=t.children.length-1;r>=0;r--)this.add(t.children[r]);return this}destroy(){this.ticking&&rR.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}};ab.uploadsPerFrame=4;let aE=ab;function aT(t,e){return e instanceof ev&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function aA(t,e){if(!(e instanceof nJ))return!1;let{geometry:i}=e;e.finishPoly(),i.updateBatches();let{batches:r}=i;for(let s=0;s<r.length;s++){let{texture:n}=r[s].style;n&&aT(t,n.baseTexture)}return i.batchable||t.geometry.bind(i,e._resolveDirectShader(t)),!0}function aS(t,e){return t instanceof nJ&&(e.push(t),!0)}Object.defineProperties(A,{UPLOADS_PER_FRAME:{get:()=>aE.uploadsPerFrame,set(t){Y("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),aE.uploadsPerFrame=t}}});class aw extends aE{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(aS),this.registerUploadHook(aT),this.registerUploadHook(aA)}}aw.extension={name:"prepare",type:er.RendererSystem},ea.add(aw),new eN;var aR=`#version 300 es 978#define SHADER_NAME Tiling-Sprite-100 979 980precision lowp float; 981 982in vec2 vTextureCoord; 983 984out vec4 fragmentColor; 985 986uniform sampler2D uSampler; 987uniform vec4 uColor; 988uniform mat3 uMapCoord; 989uniform vec4 uClampFrame; 990uniform vec2 uClampOffset; 991 992void main(void) 993{ 994 vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord); 995 coord = (uMapCoord * vec3(coord, 1.0)).xy; 996 vec2 unclamped = coord; 997 coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); 998 999 vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0 1000 1001 fragmentColor = texSample * uColor; 1002} 1003`,aI=`#version 300 es 1004#define SHADER_NAME Tiling-Sprite-300 1005 1006precision lowp float; 1007 1008in vec2 aVertexPosition; 1009in vec2 aTextureCoord; 1010 1011uniform mat3 projectionMatrix; 1012uniform mat3 translationMatrix; 1013uniform mat3 uTransform; 1014 1015out vec2 vTextureCoord; 1016 1017void main(void) 1018{ 1019 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1019)).xy, 0.0, 1.0); 1020 1021 vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy; 1022} 1023`,aC=`#version 100 1024#ifdef GL_EXT_shader_texture_lod 1025 #extension GL_EXT_shader_texture_lod : enable 1026#endif 1027#define SHADER_NAME Tiling-Sprite-100 1028 1029precision lowp float; 1030 1031varying vec2 vTextureCoord; 1032 1033uniform sampler2D uSampler; 1034uniform vec4 uColor; 1035uniform mat3 uMapCoord; 1036uniform vec4 uClampFrame; 1037uniform vec2 uClampOffset; 1038 1039void main(void) 1040{ 1041 vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord); 1042 coord = (uMapCoord * vec3(coord, 1.0)).xy; 1043 vec2 unclamped = coord; 1044 coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); 1045 1046 #ifdef GL_EXT_shader_texture_lod 1047 vec4 texSample = unclamped == coord 1048 ? texture2D(uSampler, coord) 1049 : texture2DLodEXT(uSampler, coord, 0); 1050 #else 1051 vec4 texSample = texture2D(uSampler, coord); 1052 #endif 1053 1054 gl_FragColor = texSample * uColor; 1055} 1056`,aM=`#version 100 1057#define SHADER_NAME Tiling-Sprite-100 1058 1059precision lowp float; 1060 1061attribute vec2 aVertexPosition; 1062attribute vec2 aTextureCoord; 1063 1064uniform mat3 projectionMatrix; 1065uniform mat3 translationMatrix; 1066uniform mat3 uTransform; 1067 1068varying vec2 vTextureCoord; 1069 1070void main(void) 1071{ 1072 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1072)).xy, 0.0, 1.0); 1073 1074 vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy; 1075} 1076`,aP=`#version 100 1077#define SHADER_NAME Tiling-Sprite-Simple-100 1078 1079precision lowp float; 1080 1081varying vec2 vTextureCoord; 1082 1083uniform sampler2D uSampler; 1084uniform vec4 uColor; 1085 1086void main(void) 1087{ 1088 vec4 texSample = texture2D(uSampler, vTextureCoord); 1089 gl_FragColor = texSample * uColor; 1090} 1091`;let aD=new eH;class aB extends ic{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new iF,this.state=eu.for2d()}contextChange(){let t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=il.from(aM,aP,e),this.shader=t.context.webGLVersion>1?il.from(aI,aR,e):il.from(aM,aC,e)}render(t){let e=this.renderer,i=this.quad,r=i.vertices;r[0]=r[6]=-(t._width*t.anchor.x),r[1]=r[3]=-(t._height*t.anchor.y),r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);let s=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;(r=i.uvs)[0]=r[6]=-s,r[1]=r[3]=-n,r[2]=r[4]=1-s,r[5]=r[7]=1-n,i.invalidate();let a=t._texture,o=a.baseTexture,h=o.alphaMode>0,l=t.tileTransform.localTransform,u=t.uvMatrix,d=o.isPowerOfTwo&&a.frame.width===o.width&&a.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==p.CLAMP:o.wrapMode===p.CLAMP&&(o.wrapMode=p.REPEAT));let c=d?this.simpleShader:this.shader,f=a.width,m=a.height,g=t._width,_=t._height;aD.set(l.a*f/g,l.b*f/_,l.c*m/g,l.d*m/_,l.tx/g,l.ty/_),aD.invert(),d?aD.prepend(u.mapCoord):(c.uniforms.uMapCoord=u.mapCoord.toArray(!0),c.uniforms.uClampFrame=u.uClampFrame,c.uniforms.uClampOffset=u.uClampOffset),c.uniforms.uTransform=aD.toArray(!0),c.uniforms.uColor=tR.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(c.uniforms.uColor),c.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),c.uniforms.uSampler=a,e.shader.bind(c),e.geometry.bind(i),this.state.blendMode=tC(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}aB.extension={name:"tilingSprite",type:er.RendererPlugin},ea.add(aB);let aN=class t{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof iB?t:null,this.baseTexture=t instanceof ev?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;let r=this.baseTexture.resource;this.resolution=this._updateResolution(i||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){let{scale:e}=this.data.meta,i=tW(t,null);return null===i&&(i="number"==typeof e?e:parseFloat(e??"1")),1!==i&&this.baseTexture.setResolution(i),i}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let i=e,r=t.BATCH_SIZE;for(;i-e<r&&i<this._frameKeys.length;){let s=this._frameKeys[i],n=this._frames[s],a=n.frame;if(a){let o=null,h=null,l=!1!==n.trimmed&&n.sourceSize?n.sourceSize:n.frame,u=new eL(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o=n.rotated?new eL(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):new eL(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),!1!==n.trimmed&&n.spriteSourceSize&&(h=new eL(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[s]=new iB(this.baseTexture,o,u,h,n.rotated?2:0,n.anchor,n.borders),iB.addToCache(this.textures[s],s.toString())}i++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){let r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};aN.BATCH_SIZE=1e3;let aO=["jpg","png","jpeg","avif","webp"],aL={extension:er.Asset,cac
1091he:{test:t=>t instanceof aN,getCacheableAssets:(t,e)=>(function t(e,i,r){let s={};if(e.forEach(t=>{s[t]=i}),Object.keys(i.textures).forEach(t=>{s[t]=i.textures[t]}),!r){let n=K.dirname(e[0]);i.linkedSheets.forEach((e,r)=>{let a=t([`${n}/${i.data.meta.related_multi_packs[r]}`],e,!0);Object.assign(s,a)})}return s})(t,e,!1)},resolver:{test(t){let e=t.split("?")[0].split("."),i=e.pop(),r=e.pop();return"json"===i&&aO.includes(r)},parse(t){let e=t.split(".");return{resolution:parseFloat(A.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:er.LoadParser,priority:sR.Normal},testParse:async(t,e)=>".json"===K.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,i){let r=K.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let s=r+t.meta.image;s=nr(s,e.src);let n=(await i.load([s]))[s],a=new aN(n.baseTexture,t,e.src);await a.parse();let o=t?.meta?.related_multi_packs;if(Array.isArray(o)){let h=[];for(let l of o){if("string"!=typeof l)continue;let u=r+l;e.data?.ignoreMultiPack||(u=nr(u,e.src),h.push(i.load({src:u,data:{ignoreMultiPack:!0}})))}let d=await Promise.all(h);a.linkedSheets=d,d.forEach(t=>{t.linkedSheets=[a].concat(a.linkedSheets.filter(e=>e!==t))})}return a},unload(t){t.destroy(!0)}}};ea.add(aL);class aF{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ak{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){let e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let r in e){let s=e[r].match(/^[a-z]+/gm)[0],n=e[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(let o in n){let h=n[o].split("="),l=h[0],u=h[1].replace(/"/gm,""),d=parseFloat(u),c=isNaN(d)?u:d;a[l]=c}i[s].push(a)}let f=new aF;return i.info.forEach(t=>f.info.push({face:t.face,size:parseInt(t.size,10)})),i.common.forEach(t=>f.common.push({lineHeight:parseInt(t.lineHeight,10)})),i.page.forEach(t=>f.page.push({id:parseInt(t.id,10),file:t.file})),i.char.forEach(t=>f.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})),i.kerning.forEach(t=>f.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})),i.distanceField.forEach(t=>f.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType})),f}}class aU{static test(t){return"string"!=typeof t&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){let e=new aF,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let h=0;h<i.length;h++)e.info.push({face:i[h].getAttribute("face"),size:parseInt(i[h].getAttribute("size"),10)});for(let l=0;l<r.length;l++)e.common.push({lineHeight:parseInt(r[l].getAttribute("lineHeight"),10)});for(let u=0;u<s.length;u++)e.page.push({id:parseInt(s[u].getAttribute("id"),10)||0,file:s[u].getAttribute("file")});for(let d=0;d<n.length;d++){let c=n[d];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let f=0;f<a.length;f++)e.kerning.push({first:parseInt(a[f].getAttribute("first"),10),second:parseInt(a[f].getAttribute("second"),10),amount:parseInt(a[f].getAttribute("amount"),10)});for(let p=0;p<o.length;p++)e.distanceField.push({fieldType:o[p].getAttribute("fieldType"),distanceRange:parseInt(o[p].getAttribute("distanceRange"),10)});return e}}class aG{static test(t){return!!("string"==typeof t&&t.includes("<font>"))&&aU.test(A.ADAPTER.parseXML(t))}static parse(t){return aU.parse(A.ADAPTER.parseXML(t))}}let aH=[ak,aU,aG];function aX(t,e,i,r,s,n,a){let o=i.text,h=i.fontProperties;e.translate(r,s),e.scale(n,n);let l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=function(t,e,
1091i,r,s,n){let a=i.fill;if(!Array.isArray(a))return a;if(1===a.length)return a[0];let o,h=i.dropShadow?i.dropShadowDistance:0,l=i.padding||0,u=t.width/r-h-2*l,d=t.height/r-h-2*l,c=a.slice(),f=i.fillGradientStops.slice();if(!f.length){let p=c.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(c.unshift(a[0]),f.unshift(0),c.push(a[a.length-1]),f.push(1),i.fillGradientType===ai.LINEAR_VERTICAL){o=e.createLinearGradient(u/2,l,u/2,d+l);let g=0,_=(n.fontProperties.fontSize+i.strokeThickness)/d;for(let v=0;v<s.length;v++){let x=n.lineHeight*v;for(let y=0;y<c.length;y++){let b=0;b="number"==typeof f[y]?f[y]:y/c.length;let E=x/d+b*_,T=Math.max(g,E);T=Math.min(T,1),o.addColorStop(T,c[y]),g=T}}}else{o=e.createLinearGradient(l,d/2,u+l,d/2);let A=c.length+1,S=1;for(let w=0;w<c.length;w++){let R;R="number"==typeof f[w]?f[w]:S/A,o.addColorStop(R,c[w]),S++}}return o}(t,e,a,n,[o],i),e.strokeStyle=a.stroke,a.dropShadow){let d=a.dropShadowColor,c=a.dropShadowBlur*n,f=a.dropShadowDistance*n;e.shadowColor=tR.shared.setValue(d).setAlpha(a.dropShadowAlpha).toRgbaString(),e.shadowBlur=c,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;a.stroke&&a.strokeThickness&&e.strokeText(o,l,u+i.lineHeight-h.descent),a.fill&&e.fillText(o,l,u+i.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function az(t){return Array.from?Array.from(t):t.split("")}function aV(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}let aW=class t{constructor(t,e,i){let[r]=t.info,[s]=t.common,[n]=t.page,[a]=t.distanceField,o=tW(n.file),h={};this._ownsTextures=i,this.font=r.face,this.size=r.size,this.lineHeight=s.lineHeight/o,this.chars={},this.pageTextures=h;for(let l=0;l<t.page.length;l++){let{id:u,file:d}=t.page[l];h[u]=e instanceof Array?e[l]:e[d],a?.fieldType&&"none"!==a.fieldType&&(h[u].baseTexture.alphaMode=g.NO_PREMULTIPLIED_ALPHA,h[u].baseTexture.mipmap=m.OFF)}for(let c=0;c<t.char.length;c++){let{id:f,page:p}=t.char[c],{x:_,y:v,width:x,height:y,xoffset:b,yoffset:E,xadvance:T}=t.char[c];_/=o,v/=o,x/=o,y/=o,b/=o,E/=o,T/=o;let A=new eL(_+h[p].frame.x/o,v+h[p].frame.y/o,x,y);this.chars[f]={xOffset:b,yOffset:E,xAdvance:T,kerning:{},texture:new iB(h[p].baseTexture,A),page:p}}for(let S=0;S<t.kerning.length;S++){let{first:w,second:R,amount:I}=t.kerning[S];w/=o,R/=o,I/=o,this.chars[R]&&(this.chars[R].kerning[w]=I)}this.distanceFieldRange=a?.distanceRange,this.distanceFieldType=a?.fieldType?.toLowerCase()??"none"}destroy(){for(let t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(let e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(e,i,r){let s;if(e instanceof aF)s=e;else{let n=function(t){for(let e=0;e<aH.length;e++)if(aH[e].test(t))return aH[e];return null}(e);if(!n)throw Error("Unrecognized data format for font.");s=n.parse(e)}i instanceof iB&&(i=[i]);let a=new t(s,i,r);return t.available[a.font]=a,a}static uninstall(e){let i=t.available[e];if(!i)throw Error(`No font found named '${e}'`);i.destroy(),delete t.available[e]}static from(e,i,r){if(!e)throw Error("[BitmapFont] Property `name` is required.");let{chars:s,padding:n,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},t.defaultOptions,r),u=function(t){"string"==typeof t&&(t=[t]);let e=[];for(let i=0,r=t.length;i<r;i++){let s=t[i];if(Array.isArray(s)){if(2!==s.length)throw Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);let n=s[0].charCodeAt(0),a=s[1].charCodeAt(0);if(a<n)throw Error("[BitmapFont]: Invalid character range.");for(let o=n;o<=a;o++)e.push(String.fromCharCode(o))}else e.push(...az(s))}if(0===e.length)throw Error("[BitmapFont]: Empty set when resolving characters.");return e}(s),d=i instanceof ah?i:new ah(i),c=new aF;c.info[0]={face:d.fontFamily,size:d.fontSize},c.common[0]={lineHeight:d.fontSize};let f=0,p=0,m,g,_,v=0,x=[],y=[];for(let b=0;b<u.length;b++){m||((m=A.ADAPTER.createCanvas()).width=o,m.height=h,g=m.getContext("2d"),_=new ev(m,{resolution:a,...l}),x.push(_),y.push(new iB(_)),c.page.push({id:y.length-1,file:""}));let E=u[b],T=an.measureText(E,d,!1,m),S=T.width,w=Math.ceil(T.height),R=Math.ceil(("italic"===d.fontStyle?2:1)*S);if(p>=h-w*a){if(0===p)throw Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${E}')`);--b,m=null,g=null,_=null,p=0,f=0,v=0;continue}if(v=Math.max(w+T.fontProperties.descent,v),R*a+f>=o){if(0===f)throw Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${E}')`);--b,p+=v*a,p=Math.ceil(p),f=0,v=0;continue}aX(m,g,T,f,p,a,d);let I=aV(T.text);c.char.push({id:I,page:y.length-1,x:f/a,y:p/a,width:R,height:w,xoffset:0,yoffset:0,xadvance:S-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),f+=(R+2*n)*a,f=Math.ceil(f)}if(!r?.skipKerning)for(let C=0,M=u.length;C<M;C++){let P=u[C];for(let D=0;D<M;D++){let B=u[D],N=g.measureText(P).width,O=g.measureText(B).width,L=g.measureText(P+B).width-(N+O);L&&c.kerning.push({first:aV(P),second:aV(B),amount:L})}}let F=new t(c,y,!0);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=F,F}};aW.ALPHA=[["a","z"],["A","Z"]," "],aW.NUMERIC=[["0","9"]],aW.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],aW.ASCII=[[" ","~"]],aW.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:aW.ALPHANUMERIC},aW.available={};var aj=`// Pixi texture info\r 1092varying vec2 vTextureCoord;\r 1093uniform sampler2D uSampler;\r 1094\r 1095// Tint\r 1096uniform vec4 uColor;\r 1097\r 1098// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r 1099uniform float uFWidth;\r 1100\r 1101void main(void) {\r 1102\r 1103 // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r 1104 vec4 texColor = texture2D(uSampler, vTextureCoord);\r 1105\r 1106 // MSDF\r 1107 float median = texColor.r + texColor.g + texColor.b -\r 1108 min(texColor.r, min(texColor.g, texColor.b)) -\r 1109 max(texColor.r, max(texColor.g, texColor.b));\r 1110 // SDF\r 1111 median = min(median, texColor.a);\r 1112\r 1113 float screenPxDistance = uFWidth * (median - 0.5);\r 1114 float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r 1115 if (median < 0.01) {\r
1116 alpha = 0.0;\r 1117 } else if (median > 0.99) {\r 1118 alpha = 1.0;\r 1119 }\r 1120\r 1121 // Gamma correction for coverage-like alpha\r 1122 float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r 1123 float gamma = mix(1.0, 1.0 / 2.2, luma);\r 1124 float coverage = pow(uColor.a * alpha, gamma); \r 1125\r 1126 // NPM Textures, NPM outputs\r 1127 gl_FragColor = vec4(uColor.rgb, coverage);\r 1128}\r 1129`,aY=`// Mesh material default fragment\r 1130attribute vec2 aVertexPosition;\r 1131attribute vec2 aTextureCoord;\r 1132\r 1133uniform mat3 projectionMatrix;\r 1134uniform mat3 translationMatrix;\r 1135uniform mat3 uTextureMatrix;\r 1136\r 1137varying vec2 vTextureCoord;\r 1138\r 1139void main(void)\r 1140{\r 1141 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r 1142\r 1143 vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r 1144}\r 1145`;let a$=[],aq=[],aK=[],aZ=class t extends r${constructor(e,i={}){super();let{align:r,tint:s,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},t.styleDefaults,i);if(!aW.available[o])throw Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=r,this._tintColor=new tR(s),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=e,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new eK(()=>{this.dirty=!0},this,0,0),this._roundPixels=A.ROUND_PIXELS,this.dirty=!0,this._resolution=A.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){let t=aW.available[this._fontName],e=this.fontSize,i=e/t.size,r=new eN,s=[],n=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,` 1146`)||" ",l=az(h),u=this._maxWidth*t.size/e,d="none"===t.distanceFieldType?a$:aq,c=null,f=0,p=0,m=0,g=-1,_=0,v=0,x=0,y=0;for(let b=0;b<l.length;b++){let E=l[b],T=aV(E);if(/(?:\s)/.test(E)&&(g=b,_=f,y++),"\r"===E||E===` 1147`){n.push(f),a.push(-1),p=Math.max(p,f),++m,++v,r.x=0,r.y+=t.lineHeight,c=null,y=0;continue}let A=t.chars[T];if(!A)continue;c&&A.kerning[c]&&(r.x+=A.kerning[c]);let S=aK.pop()||{texture:iB.EMPTY,line:0,charCode:0,prevSpaces:0,position:new eN};S.texture=A.texture,S.line=m,S.charCode=T,S.position.x=Math.round(r.x+A.xOffset+this._letterSpacing/2),S.position.y=Math.round(r.y+A.yOffset),S.prevSpaces=y,s.push(S),f=S.position.x+Math.max(A.xAdvance-A.xOffset,A.texture.orig.width),r.x+=A.xAdvance+this._letterSpacing,x=Math.max(x,A.yOffset+A.texture.height),c=T,-1!==g&&u>0&&r.x>u&&(tN(s,1+g-++v,1+b-g),b=g,g=-1,n.push(_),a.push(s.length>0?s[s.length-1].prevSpaces:0),p=Math.max(p,_),m++,r.x=0,r.y+=t.lineHeight,c=null,y=0)}let w=l[l.length-1];"\r"!==w&&w!==` 1148`&&(/(?:\s)/.test(w)&&(f=_),n.push(f),p=Math.max(p,f),a.push(-1));let R=[];for(let I=0;I<=m;I++){let C=0;"right"===this._align?C=p-n[I]:"center"===this._align?C=(p-n[I])/2:"justify"===this._align&&(C=a[I]<0?0:(p-n[I])/a[I]),R.push(C)}let M=s.length,P={},D=[],B=this._activePagesMeshData;d.push(...B);for(let N=0;N<M;N++){let O=s[N].texture,L=O.baseTexture.uid;if(!P[L]){let F=d.pop();if(!F){let k=new n4,U,G;"none"===t.distanceFieldType?(U=new n6(iB.EMPTY),G=o.NORMAL):(U=new n6(iB.EMPTY,{program:ia.from(aY,aj),uniforms:{uFWidth:0}}),G=o.NORMAL_NPM);let H=new n3(k,U);H.blendMode=G,F={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:H,vertices:null,uvs:null,indices:null}}F.index=0,F.indexCount=0,F.vertexCount=0,F.uvsCount=0,F.total=0;let{_textureCache:X}=this;X[L]=X[L]||new iB(O.baseTexture),F.mesh.texture=X[L],F.mesh.tint=this._tintColor.value,D.push(F),P[L]=F}P[L].total++}for(let z=0;z<B.length;z++)D.includes(B[z])||this.removeChild(B[z].mesh);for(let V=0;V<D.length;V++)D[V].mesh.parent!==this&&this.addChild(D[V].mesh);for(let W in this._activePagesMeshData=D,P){let j=P[W],Y=j.total;if(!(j.indices?.length>6*Y)||j.vertices.length<2*n3.BATCHABLE_SIZE)j.vertices=new Float32Array(8*Y),j.uvs=new Float32Array(8*Y),j.indices=new Uint16Array(6*Y);else{let $=j.total,q=j.vertices;for(let K=8*$;K<q.length;K++)q[K]=0}j.mesh.size=6*Y}for(let Z=0;Z<M;Z++){let Q=s[Z],J=Q.position.x+R[Q.line]*("justify"===this._align?Q.prevSpaces:1);this._roundPixels&&(J=Math.round(J));let tt=J*i,te=Q.position.y*i,ti=Q.texture,tr=P[ti.baseTexture.uid],ts=ti.frame,tn=ti._uvs,ta=tr.index++;tr.indices[6*ta+0]=0+4*ta,tr.indices[6*ta+1]=1+4*ta,tr.indices[6*ta+2]=2+4*ta,tr.indices[6*ta+3]=0+4*ta,tr.indices[6*ta+4]=2+4*ta,tr.indices[6*ta+5]=3+4*ta,tr.vertices[8*ta+0]=tt,tr.vertices[8*ta+1]=te,tr.vertices[8*ta+2]=tt+ts.width*i,tr.vertices[8*ta+3]=te,tr.vertices[8*ta+4]=tt+ts.width*i,tr.vertices[8*ta+5]=te+ts.height*i,tr.vertices[8*ta+6]=tt,tr.vertices[8*ta+7]=te+ts.height*i,tr.uvs[8*ta+0]=tn.x0,tr.uvs[8*ta+1]=tn.y0,tr.uvs[8*ta+2]=tn.x1,tr.uvs[8*ta+3]=tn.y1,tr.uvs[8*ta+4]=tn.x2,tr.uvs[8*ta+5]=tn.y2,tr.uvs[8*ta+6]=tn.x3,tr.uvs[8*ta+7]=tn.y3}for(let to in this._textWidth=p*i,this._textHeight=(r.y+t.lineHeight)*i,P){let th=P[to];if(0!==this.anchor.x||0!==this.anchor.y){let tl=0,tu=this._textWidth*this.anchor.x,td=this._textHeight*this.anchor.y;for(let tc=0;tc<th.total;tc++)th.vertices[tl++]-=tu,th.vertices[tl++]-=td,th.vertices[tl++]-=tu,th.vertices[tl++]-=td,th.vertices[tl++]-=tu,th.vertices[tl++]-=td,th.vertices[tl++]-=tu,th.vertices[tl++]-=td}this._maxLineHeight=x*i;let tf=th.mesh.geometry.getBuffer("aVertexPosition"),tp=th.mesh.geometry.getBuffer("aTextureCoord"),tm=th.mesh.geometry.getIndex();tf.data=th.vertices,tp.data=th.uvs,tm.data=th.indices,tf.update(
1148),tp.update(),tm.update()}for(let tg=0;tg<s.length;tg++)aK.push(s[tg]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);let{distanceFieldRange:e,distanceFieldType:i,size:r}=aW.available[this._fontName];if("none"!==i){let{a:s,b:n,c:a,d:o}=this.worldTransform,h=(Math.abs(Math.sqrt(s*s+n*n))+Math.abs(Math.sqrt(a*a+o*o)))/2,l=this.fontSize/r,u=t._view.resolution;for(let d of this._activePagesMeshData)d.mesh.shader.uniforms.uFWidth=h*e*l*u}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){let t=aW.available[this._fontName];if(!t)throw Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!aW.available[t])throw Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??aW.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){let{_textureCache:e}=this,i="none"===aW.available[this._fontName].distanceFieldType?a$:aq;for(let r of(i.push(...this._activePagesMeshData),this._activePagesMeshData))this.removeChild(r.mesh);for(let s in this._activePagesMeshData=[],i.filter(t=>e[t.mesh.texture.baseTexture.uid]).forEach(t=>{t.mesh.texture=iB.EMPTY}),e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};aZ.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let aQ=[".xml",".fnt"],aJ={extension:{type:er.LoadParser,priority:sR.Normal},name:"loadBitmapFont",test:t=>aQ.includes(K.extname(t).toLowerCase()),testParse:async t=>ak.test(t)||aG.test(t),async parse(t,e,i){let r=ak.test(t)?ak.parse(t):aG.parse(t),{src:s}=e,{page:n}=r,a=[];for(let o=0;o<n.length;++o){let h=n[o].file,l=K.join(K.dirname(s),h);l=nr(l,s),a.push(l)}let u=await i.load(a),d=a.map(t=>u[t]);return aW.install(r,d,!0)},load:async(t,e)=>(await A.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};ea.add(aJ);let a0=class t extends ah{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new t(Object.keys(t.defaultOptions).reduce((t,i)=>({...t,[i]:e[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(e=>{URL.revokeObjectURL(e.src),e.refs--,0===e.refs&&(e.fontFace&&document.fonts.delete(e.fontFace),delete t.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,i={}){let{availableFonts:r}=t;if(r[e]){let s=r[e];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return A.ADAPTER.fetch(e).then(t=>t.blob()).then(async t=>new Promise((e,i)=>{let r=URL.createObjectURL(t),s=new FileReader;s.onload=()=>e([r,s.result]),s.onerror=i,s.readAsDataURL(t)})).then(async([t,s])=>{let n=Object.assign({family:K.basename(e,K.extname(e)),weight:"normal",style:"normal",display:"auto",src:t,dataSrc:s,refs:1,originalUrl:e,fontFace:null},i);r[e]=n,this._fonts.push(n),this.styleID++;let a=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style,display:n.display});n.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirt
1148y=!0})}addOverride(...t){let e=t.filter(t=>!this._overrides.includes(t));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){let e=t.filter(t=>this._overrides.includes(t));e.length>0&&(this._overrides=this._overrides.filter(t=>!e.includes(t)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t} 1149 @font-face { 1150 font-family: "${e.family}"; 1151 src: url('${e.dataSrc}'); 1152 font-weight: ${e.weight}; 1153 font-style: ${e.style}; 1154 font-display: ${e.display}; 1155 }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){var e,i;return Array.isArray(t)&&(e=t,Y("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),t=tR.shared.setValue(e).toNumber()),"number"==typeof t?(i=t,Y("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),tR.shared.setValue(i).toHex()):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor),e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));let s=`${i}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${s} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${s} ${t}`}reset(){Object.assign(this,t.defaultOptions)}onBeforeDraw(){let{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){let{userAgent:t}=A.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};a0.availableFonts={},a0.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 a1=class t extends rZ{constructor(e="",i={}){super(iB.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;let r=new Image,s=iB.from(r,{scaleMode:A.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new eL,s.trim=new eL,this.texture=s;let n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",o.appendChild(h),this.maxWidth=t.defaultMaxWidth,this.maxHeight=t.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=o,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=r,this._loadImage=new Image,this._autoResolution=t.defaultAutoResolution,this._resolution=t.defaultResolution??A.RESOLUTION,this.text=e,this.style=i}measureText(t){let{text:e,style:i,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(r)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);let s=this._domElement.getBoundingClientRect();this._svgRoot.remove();let{width:n,height:a}=s;(n>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");let o=Math.min(this.maxWidth,Math.ceil(n)),h=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",h.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(r)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:o+2*i.padding,height:h+2*i.padding}}async updateText(t=!0){let{style:e,_image:i,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;let{width:s,height:n}=this.measureText();i.width=r.width=Math.ceil(Math.max(1,s)),i.height=r.height=Math.ceil(Math.max(1,n)),this._updateID++;let a=this._updateID;await new Promise(t=>{r.onload=async()=>
1155{if(a<this._updateID){t();return}await e.onBeforeDraw(),i.src=r.src,r.onload=null,r.src="",this.updateTexture(),t()};let s=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(s)}`})}get source(){return this._image}updateTexture(){let{style:t,texture:e,_image:i,resolution:r}=this,{padding:s}=t,{baseTexture:n}=e;e.trim.width=e._frame.width=i.width/r,e.trim.height=e._frame.height=i.height/r,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-2*s,e.orig.height=e._frame.height-2*s,this._onTextureUpdate(),n.setRealSize(i.width,i.height,r),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},t.defaultDestroyOptions,e),super.destroy(e),this.ownsStyle&&this._style?.cleanFonts(),this._style=null,this._svgRoot?.remove(),this._svgRoot=null,this._domElement?.remove(),this._domElement=null,this._foreignObject?.remove(),this._foreignObject=null,this._styleElement?.remove(),this._styleElement=null,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=null,this._image.src="",this._image=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);let e=tO(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);let e=tO(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&((t=t||{})instanceof a0?(this.ownsStyle=!1,this._style=t):t instanceof ah?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=a0.from(t)):(this.ownsStyle=!0,this._style=new a0(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(""===t||null==t?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};a1.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},a1.defaultMaxWidth=2024,a1.defaultMaxHeight=2024,a1.defaultAutoResolution=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.