pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
2,231 lines • 706 kB
JavaScript
/*!
* PixiJS - v8.10.1
* Compiled Thu, 05 Jun 2025 17:35:59 UTC
*
* PixiJS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/const Hy={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return(r=document.baseURI)!=null?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};let Cc=Hy;const L={get(){return Cc},set(r){Cc=r}};var hD=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function $n(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function dD(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function pD(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function fD(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}var Xn={},ee={},re={};function zy(r,t,e){if(e===void 0&&(e=Array.prototype),r&&typeof e.find=="function")return e.find.call(r,t);for(var s=0;s<r.length;s++)if(Object.prototype.hasOwnProperty.call(r,s)){var i=r[s];if(t.call(void 0,i,s,r))return i}}function Hn(r,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(r):r}function jy(r,t){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r}var Rc=Hn({HTML:"text/html",isHTML:function(r){return r===Rc.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Pc=Hn({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(r){return r===Pc.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),mD=re.assign=jy,gD=re.find=zy,_D=re.freeze=Hn,xD=re.MIME_TYPE=Rc,bD=re.NAMESPACE=Pc,Dc=re,Vt=Dc.find,Fr=Dc.NAMESPACE;function Vy(r){return r!==""}function Wy(r){return r?r.split(/[\t\n\f\r ]+/).filter(Vy):[]}function Yy(r,t){return r.hasOwnProperty(t)||(r[t]=!0),r}function Mc(r){if(!r)return[];var t=Wy(r);return Object.keys(t.reduce(Yy,{}))}function qy(r){return function(t){return r&&r.indexOf(t)!==-1}}function Ir(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function gt(r,t){var e=r.prototype;if(!(e instanceof t)){let s=function(){};s.prototype=t.prototype,s=new s,Ir(e,s),r.prototype=e=s}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var _t={},Nt=_t.ELEMENT_NODE=1,Ve=_t.ATTRIBUTE_NODE=2,$s=_t.TEXT_NODE=3,Oc=_t.CDATA_SECTION_NODE=4,Bc=_t.ENTITY_REFERENCE_NODE=5,Ky=_t.ENTITY_NODE=6,Gc=_t.PROCESSING_INSTRUCTION_NODE=7,Fc=_t.COMMENT_NODE=8,Ic=_t.DOCUMENT_NODE=9,Uc=_t.DOCUMENT_TYPE_NODE=10,se=_t.DOCUMENT_FRAGMENT_NODE=11,Zy=_t.NOTATION_NODE=12,ct={},ot={},yD=ct.INDEX_SIZE_ERR=(ot[1]="Index size error",1),vD=ct.DOMSTRING_SIZE_ERR=(ot[2]="DOMString size error",2),xt=ct.HIERARCHY_REQUEST_ERR=(ot[3]="Hierarchy request error",3),TD=ct.WRONG_DOCUMENT_ERR=(ot[4]="Wrong document",4),AD=ct.INVALID_CHARACTER_ERR=(ot[5]="Invalid character",5),SD=ct.NO_DATA_ALLOWED_ERR=(ot[6]="No data allowed",6),ED=ct.NO_MODIFICATION_ALLOWED_ERR=(ot[7]="No modification allowed",7),kc=ct.NOT_FOUND_ERR=(ot[8]="Not found",8),wD=ct.NOT_SUPPORTED_ERR=(ot[9]="Not supported",9),Lc=ct.INUSE_ATTRIBUTE_ERR=(ot[10]="Attribute in use",10),CD=ct.INVALID_STATE_ERR=(ot[11]="Invalid state",11),RD=ct.SYNTAX_ERR=(ot[12]="Syntax error",12),PD=ct.INVALID_MODIFICATION_ERR=(ot[13]="Invalid modification",13),DD=ct.NAMESPACE_ERR=(ot[14]="Invalid namespace",14),MD=ct.INVALID_ACCESS_ERR=(ot[15]="Invalid access",15);function tt(r,t){if(t instanceof Error)var e=t;else e=this,Error.call(this,ot[r]),this.message=ot[r],Error.captureStackTrace&&Error.captureStackTrace(this,tt);return e.code=r,t&&(this.message=this.message+": "+t),e}tt.prototype=Error.prototype,Ir(ct,tt);function ie(){}ie.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r,t){for(var e=[],s=0;s<this.length;s++)Ye(this[s],e,r,t);return e.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};function We(r,t){this._node=r,this._refresh=t,zn(this)}function zn(r){var t=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==t){var e=r._refresh(r._node);if(rh(r,"length",e.length),!r.$$length||e.length<r.$$length)for(var s=e.length;s in r;s++)Object.prototype.hasOwnProperty.call(r,s)&&delete r[s];Ir(e,r),r._inc=t}}We.prototype.item=function(r){return zn(this),this[r]||null},gt(We,ie);function Xs(){}function Nc(r,t){for(var e=r.length;e--;)if(r[e]===t)return e}function $c(r,t,e,s){if(s?t[Nc(t,s)]=e:t[t.length++]=e,r){e.ownerElement=r;var i=r.ownerDocument;i&&(s&&jc(i,r,s),Qy(i,r,e))}}function Xc(r,t,e){var s=Nc(t,e);if(s>=0){for(var i=t.length-1;s<i;)t[s]=t[++s];if(t.length=i,r){var n=r.ownerDocument;n&&(jc(n,r,e),e.ownerElement=null)}}else throw new tt(kc,new Error(r.tagName+"@"+e))}Xs.prototype={length:0,item:ie.prototype.item,getNamedItem:function(r){for(var t=this.length;t--;){var e=this[t];if(e.nodeName==r)return e}},setNamedItem:function(r){var t=r.ownerElement;if(t&&t!=this._ownerElement)throw new tt(Lc);var e=this.getNamedItem(r.nodeName);return $c(this._ownerElement,this,r,e),e},setNamedItemNS:function(r){var t=r.ownerElement,e;if(t&&t!=this._ownerElement)throw new tt(Lc);return e=this.getNamedItemNS(r.namespaceURI,r.localName),$c(this._ownerElement,this,r,e),e},removeNamedItem:function(r){var t=this.getNamedItem(r);return Xc(this._ownerElement,this,t),t},removeNamedItemNS:function(r,t){var e=this.getNamedItemNS(r,t);return Xc(this._ownerElement,this,e),e},getNamedItemNS:function(r,t){for(var e=this.length;e--;){var s=this[e];if(s.localName==t&&s.namespaceURI==r)return s}return null}};function Hc(){}Hc.prototype={hasFeature:function(r,t){return!0},createDocument:function(r,t,e){var s=new kr;if(s.implementation=this,s.childNodes=new ie,s.doctype=e||null,e&&s.appendChild(e),t){var i=s.createElementNS(r,t);s.appendChild(i)}return s},createDocumentType:function(r,t,e){var s=new js;return s.name=r,s.nodeName=r,s.publicId=t||"",s.systemId=e||"",s}};function j(){}j.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(r,t){return Hs(this,r,t)},replaceChild:function(r,t){Hs(this,r,t,qc),t&&this.removeChild(t)},removeChild:function(r){return Vc(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return Jn(this.ownerDocument||this,this,r)},normalize:function(){for(var r=this.firstChild;r;){var t=r.nextSibling;t&&t.nodeType==$s&&r.nodeType==$s?(this.removeChild(t),r.appendData(t.data)):(r.normalize(),r=t)}},isSupported:function(r,t){return this.ownerDocument.implementation.hasFeature(r,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(r){for(var t=this;t;){var e=t._nsMap;if(e){for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]===r)return s}t=t.nodeType==Ve?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(r){for(var t=this;t;){var e=t._nsMap;if(e&&Object.prototype.hasOwnProperty.call(e,r))return e[r];t=t.nodeType==Ve?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(r){var t=this.lookupPrefix(r);return t==null}};function zc(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}Ir(_t,j),Ir(_t,j.prototype);function Ur(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Ur(r,t))return!0;while(r=r.nextSibling)}function kr(){this.ownerDocument=this}function Qy(r,t,e){r&&r._inc++;var s=e.namespaceURI;s===Fr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function jc(r,t,e,s){r&&r._inc++;var i=e.namespaceURI;i===Fr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function jn(r,t,e){if(r&&r._inc){r._inc++;var s=t.childNodes;if(e)s[s.length++]=e;else{for(var i=t.firstChild,n=0;i;)s[n++]=i,i=i.nextSibling;s.length=n,delete s[s.length]}}}function Vc(r,t){var e=t.previousSibling,s=t.nextSibling;return e?e.nextSibling=s:r.firstChild=s,s?s.previousSibling=e:r.lastChild=e,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,jn(r.ownerDocument,r),t}function Jy(r){return r&&(r.nodeType===j.DOCUMENT_NODE||r.nodeType===j.DOCUMENT_FRAGMENT_NODE||r.nodeType===j.ELEMENT_NODE)}function tv(r){return r&&(Wt(r)||Vn(r)||ne(r)||r.nodeType===j.DOCUMENT_FRAGMENT_NODE||r.nodeType===j.COMMENT_NODE||r.nodeType===j.PROCESSING_INSTRUCTION_NODE)}function ne(r){return r&&r.nodeType===j.DOCUMENT_TYPE_NODE}function Wt(r){return r&&r.nodeType===j.ELEMENT_NODE}function Vn(r){return r&&r.nodeType===j.TEXT_NODE}function Wc(r,t){var e=r.childNodes||[];if(Vt(e,Wt)||ne(t))return!1;var s=Vt(e,ne);return!(t&&s&&e.indexOf(s)>e.indexOf(t))}function Yc(r,t){var e=r.childNodes||[];function s(n){return Wt(n)&&n!==t}if(Vt(e,s))return!1;var i=Vt(e,ne);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function ev(r,t,e){if(!Jy(r))throw new tt(xt,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new tt(kc,"child not in parent");if(!tv(t)||ne(t)&&r.nodeType!==j.DOCUMENT_NODE)throw new tt(xt,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function rv(r,t,e){var s=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===j.DOCUMENT_FRAGMENT_NODE){var n=i.filter(Wt);if(n.length>1||Vt(i,Vn))throw new tt(xt,"More than one element or text in fragment");if(n.length===1&&!Wc(r,e))throw new tt(xt,"Element in fragment can not be inserted before doctype")}if(Wt(t)&&!Wc(r,e))throw new tt(xt,"Only one element can be added and only after doctype");if(ne(t)){if(Vt(s,ne))throw new tt(xt,"Only one doctype is allowed");var o=Vt(s,Wt);if(e&&s.indexOf(o)<s.indexOf(e))throw new tt(xt,"Doctype can only be inserted before an element");if(!e&&o)throw new tt(xt,"Doctype can not be appended since element is present")}}function qc(r,t,e){var s=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===j.DOCUMENT_FRAGMENT_NODE){var n=i.filter(Wt);if(n.length>1||Vt(i,Vn))throw new tt(xt,"More than one element or text in fragment");if(n.length===1&&!Yc(r,e))throw new tt(xt,"Element in fragment can not be inserted before doctype")}if(Wt(t)&&!Yc(r,e))throw new tt(xt,"Only one element can be added and only after doctype");if(ne(t)){if(Vt(s,function(u){return ne(u)&&u!==e}))throw new tt(xt,"Only one doctype is allowed");var o=Vt(s,Wt);if(e&&s.indexOf(o)<s.indexOf(e))throw new tt(xt,"Doctype can only be inserted before an element")}}function Hs(r,t,e,s){ev(r,t,e),r.nodeType===j.DOCUMENT_NODE&&(s||rv)(r,t,e);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===se){var n=t.firstChild;if(n==null)return t;var o=t.lastChild}else n=o=t;var a=e?e.previousSibling:r.lastChild;n.previousSibling=a,o.nextSibling=e,a?a.nextSibling=n:r.firstChild=n,e==null?r.lastChild=o:e.previousSibling=o;do n.parentNode=r;while(n!==o&&(n=n.nextSibling));return jn(r.ownerDocument||r,r),t.nodeType==se&&(t.firstChild=t.lastChild=null),t}function sv(r,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=r,t.previousSibling=r.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:r.firstChild=t,r.lastChild=t,jn(r.ownerDocument,r,t),t}kr.prototype={nodeName:"#document",nodeType:Ic,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,t){if(r.nodeType==se){for(var e=r.firstChild;e;){var s=e.nextSibling;this.insertBefore(e,t),e=s}return r}return Hs(this,r,t),r.ownerDocument=this,this.documentElement===null&&r.nodeType===Nt&&(this.documentElement=r),r},removeChild:function(r){return this.documentElement==r&&(this.documentElement=null),Vc(this,r)},replaceChild:function(r,t){Hs(this,r,t,qc),r.ownerDocument=this,t&&this.removeChild(t),Wt(r)&&(this.documentElement=r)},importNode:function(r,t){return eh(this,r,t)},getElementById:function(r){var t=null;return Ur(this.documentElement,function(e){if(e.nodeType==Nt&&e.getAttribute("id")==r)return t=e,!0}),t},getElementsByClassName:function(r){var t=Mc(r);return new We(this,function(e){var s=[];return t.length>0&&Ur(e.documentElement,function(i){if(i!==e&&i.nodeType===Nt){var n=i.getAttribute("class");if(n){var o=r===n;if(!o){var a=Mc(n);o=t.every(qy(a))}o&&s.push(i)}}}),s})},createElement:function(r){var t=new Re;t.ownerDocument=this,t.nodeName=r,t.tagName=r,t.localName=r,t.childNodes=new ie;var e=t.attributes=new Xs;return e._ownerElement=t,t},createDocumentFragment:function(){var r=new Vs;return r.ownerDocument=this,r.childNodes=new ie,r},createTextNode:function(r){var t=new Wn;return t.ownerDocument=this,t.appendData(r),t},createComment:function(r){var t=new Yn;return t.ownerDocument=this,t.appendData(r),t},createCDATASection:function(r){var t=new qn;return t.ownerDocument=this,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new Zn;return e.ownerDocument=this,e.tagName=e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){var t=new zs;return t.ownerDocument=this,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){var t=new Kn;return t.ownerDocument=this,t.nodeName=r,t},createElementNS:function(r,t){var e=new Re,s=t.split(":"),i=e.attributes=new Xs;return e.childNodes=new ie,e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.namespaceURI=r,s.length==2?(e.prefix=s[0],e.localName=s[1]):e.localName=t,i._ownerElement=e,e},createAttributeNS:function(r,t){var e=new zs,s=t.split(":");return e.ownerDocument=this,e.nodeName=t,e.name=t,e.namespaceURI=r,e.specified=!0,s.length==2?(e.prefix=s[0],e.localName=s[1]):e.localName=t,e}},gt(kr,j);function Re(){this._nsMap={}}Re.prototype={nodeType:Nt,hasAttribute:function(r){return this.getAttributeNode(r)!=null},getAttribute:function(r){var t=this.getAttributeNode(r);return t&&t.value||""},getAttributeNode:function(r){return this.attributes.getNamedItem(r)},setAttribute:function(r,t){var e=this.ownerDocument.createAttribute(r);e.value=e.nodeValue=""+t,this.setAttributeNode(e)},removeAttribute:function(r){var t=this.getAttributeNode(r);t&&this.removeAttributeNode(t)},appendChild:function(r){return r.nodeType===se?this.insertBefore(r,null):sv(this,r)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(r,t){return this.getAttributeNodeNS(r,t)!=null},getAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);return e&&e.value||""},setAttributeNS:function(r,t,e){var s=this.ownerDocument.createAttributeNS(r,t);s.value=s.nodeValue=""+e,this.setAttributeNode(s)},getAttributeNodeNS:function(r,t){return this.attributes.getNamedItemNS(r,t)},getElementsByTagName:function(r){return new We(this,function(t){var e=[];return Ur(t,function(s){s!==t&&s.nodeType==Nt&&(r==="*"||s.tagName==r)&&e.push(s)}),e})},getElementsByTagNameNS:function(r,t){return new We(this,function(e){var s=[];return Ur(e,function(i){i!==e&&i.nodeType===Nt&&(r==="*"||i.namespaceURI===r)&&(t==="*"||i.localName==t)&&s.push(i)}),s})}},kr.prototype.getElementsByTagName=Re.prototype.getElementsByTagName,kr.prototype.getElementsByTagNameNS=Re.prototype.getElementsByTagNameNS,gt(Re,j);function zs(){}zs.prototype.nodeType=Ve,gt(zs,j);function Lr(){}Lr.prototype={data:"",substringData:function(r,t){return this.data.substring(r,r+t)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,t){this.replaceData(r,0,t)},appendChild:function(r){throw new Error(ot[xt])},deleteData:function(r,t){this.replaceData(r,t,"")},replaceData:function(r,t,e){var s=this.data.substring(0,r),i=this.data.substring(r+t);e=s+e+i,this.nodeValue=this.data=e,this.length=e.length}},gt(Lr,j);function Wn(){}Wn.prototype={nodeName:"#text",nodeType:$s,splitText:function(r){var t=this.data,e=t.substring(r);t=t.substring(0,r),this.data=this.nodeValue=t,this.length=t.length;var s=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}},gt(Wn,Lr);function Yn(){}Yn.prototype={nodeName:"#comment",nodeType:Fc},gt(Yn,Lr);function qn(){}qn.prototype={nodeName:"#cdata-section",nodeType:Oc},gt(qn,Lr);function js(){}js.prototype.nodeType=Uc,gt(js,j);function Kc(){}Kc.prototype.nodeType=Zy,gt(Kc,j);function Zc(){}Zc.prototype.nodeType=Ky,gt(Zc,j);function Kn(){}Kn.prototype.nodeType=Bc,gt(Kn,j);function Vs(){}Vs.prototype.nodeName="#document-fragment",Vs.prototype.nodeType=se,gt(Vs,j);function Zn(){}Zn.prototype.nodeType=Gc,gt(Zn,j);function Qc(){}Qc.prototype.serializeToString=function(r,t,e){return Jc.call(r,t,e)},j.prototype.toString=Jc;function Jc(r,t){var e=[],s=this.nodeType==9&&this.documentElement||this,i=s.prefix,n=s.namespaceURI;if(n&&i==null){var i=s.lookupPrefix(n);if(i==null)var o=[{namespace:n,prefix:null}]}return Ye(this,e,r,t,o),e.join("")}function th(r,t,e){var s=r.prefix||"",i=r.namespaceURI;if(!i||s==="xml"&&i===Fr.XML||i===Fr.XMLNS)return!1;for(var n=e.length;n--;){var o=e[n];if(o.prefix===s)return o.namespace!==i}return!0}function Qn(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,zc),'"')}function Ye(r,t,e,s,i){if(i||(i=[]),s)if(r=s(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case Nt:var n=r.attributes,o=n.length,_=r.firstChild,a=r.tagName;e=Fr.isHTML(r.namespaceURI)||e;var u=a;if(!e&&!r.prefix&&r.namespaceURI){for(var l,c=0;c<n.length;c++)if(n.item(c).name==="xmlns"){l=n.item(c).value;break}if(!l)for(var h=i.length-1;h>=0;h--){var d=i[h];if(d.prefix===""&&d.namespace===r.namespaceURI){l=d.namespace;break}}if(l!==r.namespaceURI)for(var h=i.length-1;h>=0;h--){var d=i[h];if(d.namespace===r.namespaceURI){d.prefix&&(u=d.prefix+":"+a);break}}}t.push("<",u);for(var p=0;p<o;p++){var f=n.item(p);f.prefix=="xmlns"?i.push({prefix:f.localName,namespace:f.value}):f.nodeName=="xmlns"&&i.push({prefix:"",namespace:f.value})}for(var p=0;p<o;p++){var f=n.item(p);if(th(f,e,i)){var g=f.prefix||"",m=f.namespaceURI;Qn(t,g?"xmlns:"+g:"xmlns",m),i.push({prefix:g,namespace:m})}Ye(f,t,e,s,i)}if(a===u&&th(r,e,i)){var g=r.prefix||"",m=r.namespaceURI;Qn(t,g?"xmlns:"+g:"xmlns",m),i.push({prefix:g,namespace:m})}if(_||e&&!/^(?:meta|link|img|br|hr|input)$/i.test(a)){if(t.push(">"),e&&/^script$/i.test(a))for(;_;)_.data?t.push(_.data):Ye(_,t,e,s,i.slice()),_=_.nextSibling;else for(;_;)Ye(_,t,e,s,i.slice()),_=_.nextSibling;t.push("</",u,">")}else t.push("/>");return;case Ic:case se:for(var _=r.firstChild;_;)Ye(_,t,e,s,i.slice()),_=_.nextSibling;return;case Ve:return Qn(t,r.name,r.value);case $s:return t.push(r.data.replace(/[<&>]/g,zc));case Oc:return t.push("<![CDATA[",r.data,"]]>");case Fc:return t.push("<!--",r.data,"-->");case Uc:var b=r.publicId,x=r.systemId;if(t.push("<!DOCTYPE ",r.name),b)t.push(" PUBLIC ",b),x&&x!="."&&t.push(" ",x),t.push(">");else if(x&&x!=".")t.push(" SYSTEM ",x,">");else{var v=r.internalSubset;v&&t.push(" [",v,"]"),t.push(">")}return;case Gc:return t.push("<?",r.target," ",r.data,"?>");case Bc:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function eh(r,t,e){var s;switch(t.nodeType){case Nt:s=t.cloneNode(!1),s.ownerDocument=r;case se:break;case Ve:e=!0;break}if(s||(s=t.cloneNode(!1)),s.ownerDocument=r,s.parentNode=null,e)for(var i=t.firstChild;i;)s.appendChild(eh(r,i,e)),i=i.nextSibling;return s}function Jn(r,t,e){var s=new t.constructor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];typeof n!="object"&&n!=s[i]&&(s[i]=n)}switch(t.childNodes&&(s.childNodes=new ie),s.ownerDocument=r,s.nodeType){case Nt:var o=t.attributes,a=s.attributes=new Xs,u=o.length;a._ownerElement=s;for(var l=0;l<u;l++)s.setAttributeNode(Jn(r,o.item(l),!0));break;case Ve:e=!0}if(e)for(var c=t.firstChild;c;)s.appendChild(Jn(r,c,e)),c=c.nextSibling;return s}function rh(r,t,e){r[t]=e}try{if(Object.defineProperty){let r=function(t){switch(t.nodeType){case Nt:case se:var e=[];for(t=t.firstChild;t;)t.nodeType!==7&&t.nodeType!==8&&e.push(r(t)),t=t.nextSibling;return e.join("");default:return t.nodeValue}};Object.defineProperty(We.prototype,"length",{get:function(){return zn(this),this.$$length}}),Object.defineProperty(j.prototype,"textContent",{get:function(){return r(this)},set:function(t){switch(this.nodeType){case Nt:case se:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),rh=function(t,e,s){t["$$"+e]=s}}}catch(r){}var OD=ee.DocumentType=js,BD=ee.DOMException=tt,GD=ee.DOMImplementation=Hc,FD=ee.Element=Re,ID=ee.Node=j,UD=ee.NodeList=ie,kD=ee.XMLSerializer=Qc,Ws={},to={};(function(r){"use strict";var t=re.freeze;r.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),r.HTML_ENTITIES=t({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}),r.entityMap=r.HTML_ENTITIES})(to);var LD=$n(to),eo={},Nr=re.NAMESPACE,ro=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,sh=new RegExp("[\\-\\.0-9"+ro.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),ih=new RegExp("^"+ro.source+sh.source+"*(?::"+ro.source+sh.source+"*)?$"),$r=0,me=1,qe=2,Xr=3,Ke=4,Ze=5,Hr=6,Ys=7;function Qe(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Qe)}Qe.prototype=new Error,Qe.prototype.name=Qe.name;function nh(){}nh.prototype={parse:function(r,t,e){var s=this.domBuilder;s.startDocument(),uh(t,t={}),iv(r,t,e,s,this.errorHandler),s.endDocument()}};function iv(r,t,e,s,i){function n(R){if(R>65535){R-=65536;var M=55296+(R>>10),je=56320+(R&1023);return String.fromCharCode(M,je)}else return String.fromCharCode(R)}function o(R){var M=R.slice(1,-1);return Object.hasOwnProperty.call(e,M)?e[M]:M.charAt(0)==="#"?n(parseInt(M.substr(1).replace("x","0x"))):(i.error("entity not found:"+R),R)}function a(R){if(R>g){var M=r.substring(g,R).replace(/&#?\w+;/g,o);d&&u(g),s.characters(M,0,R-g),g=R}}function u(R,M){for(;R>=c&&(M=h.exec(r));)l=M.index,c=l+M[0].length,d.lineNumber++;d.columnNumber=R-l+1}for(var l=0,c=0,h=/.*(?:\r\n?|\n)|.*$/g,d=s.locator,p=[{currentNSMap:t}],f={},g=0;;){try{var m=r.indexOf("<",g);if(m<0){if(!r.substr(g).match(/^\s*$/)){var _=s.doc,b=_.createTextNode(r.substr(g));_.appendChild(b),s.currentElement=b}return}switch(m>g&&a(m),r.charAt(m+1)){case"/":var E=r.indexOf(">",m+3),x=r.substring(m+2,E).replace(/[ \t\n\r]+$/g,""),v=p.pop();E<0?(x=r.substring(m+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+v.tagName),E=m+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),E=m+1+x.length);var A=v.localNSMap,T=v.tagName==x,S=T||v.tagName&&v.tagName.toLowerCase()==x.toLowerCase();if(S){if(s.endElement(v.uri,v.localName,x),A)for(var B in A)Object.prototype.hasOwnProperty.call(A,B)&&s.endPrefixMapping(B);T||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+v.tagName)}else p.push(v);E++;break;case"?":d&&u(m),E=lv(r,m,s);break;case"!":d&&u(m),E=uv(r,m,s,i);break;default:d&&u(m);var P=new lh,C=p[p.length-1].currentNSMap,E=nv(r,m,P,C,o,i),G=P.length;if(!P.closed&&av(r,E,P.tagName,f)&&(P.closed=!0,e.nbsp||i.warning("unclosed xml attribute")),d&&G){for(var U=oh(d,{}),k=0;k<G;k++){var Bt=P[k];u(Bt.offset),Bt.locator=oh(d,{})}s.locator=U,ah(P,s,C)&&p.push(P),s.locator=d}else ah(P,s,C)&&p.push(P);Nr.isHTML(P.uri)&&!P.closed?E=ov(r,E,P.tagName,o,s):E++}}catch(R){if(R instanceof Qe)throw R;i.error("element parse error: "+R),E=-1}E>g?g=E:a(Math.max(m,g)+1)}}function oh(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function nv(r,t,e,s,i,n){function o(p,f,g){e.attributeNames.hasOwnProperty(p)&&n.fatalError("Attribute "+p+" redefined"),e.addValue(p,f.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),g)}for(var a,u,l=++t,c=$r;;){var h=r.charAt(l);switch(h){case"=":if(c===me)a=r.slice(t,l),c=Xr;else if(c===qe)c=Xr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===Xr||c===me)if(c===me&&(n.warning('attribute value must after "="'),a=r.slice(t,l)),t=l+1,l=r.indexOf(h,t),l>0)u=r.slice(t,l),o(a,u,t-1),c=Ze;else throw new Error("attribute value no end '"+h+"' match");else if(c==Ke)u=r.slice(t,l),o(a,u,t),n.warning('attribute "'+a+'" missed start quot('+h+")!!"),t=l+1,c=Ze;else throw new Error('attribute value must after "="');break;case"/":switch(c){case $r:e.setTagName(r.slice(t,l));case Ze:case Hr:case Ys:c=Ys,e.closed=!0;case Ke:case me:break;case qe:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),c==$r&&e.setTagName(r.slice(t,l)),l;case">":switch(c){case $r:e.setTagName(r.slice(t,l));case Ze:case Hr:case Ys:break;case Ke:case me:u=r.slice(t,l),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case qe:c===qe&&(u=a),c==Ke?(n.warning('attribute "'+u+'" missed quot(")!'),o(a,u,t)):((!Nr.isHTML(s[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),o(u,u,t));break;case Xr:throw new Error("attribute value missed!!")}return l;case"\x80":h=" ";default:if(h<=" ")switch(c){case $r:e.setTagName(r.slice(t,l)),c=Hr;break;case me:a=r.slice(t,l),c=qe;break;case Ke:var u=r.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),o(a,u,t);case Ze:c=Hr;break}else switch(c){case qe:var d=e.tagName;(!Nr.isHTML(s[""])||!a.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),o(a,a,t),t=l,c=me;break;case Ze:n.warning('attribute space is required"'+a+'"!!');case Hr:c=me,t=l;break;case Xr:c=Ke,t=l;break;case Ys:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function ah(r,t,e){for(var s=r.tagName,i=null,h=r.length;h--;){var n=r[h],o=n.qName,a=n.value,d=o.indexOf(":");if(d>0)var u=n.prefix=o.slice(0,d),l=o.slice(d+1),c=u==="xmlns"&&l;else l=o,u=null,c=o==="xmlns"&&"";n.localName=l,c!==!1&&(i==null&&(i={},uh(e,e={})),e[c]=i[c]=a,n.uri=Nr.XMLNS,t.startPrefixMapping(c,a))}for(var h=r.length;h--;){n=r[h];var u=n.prefix;u&&(u==="xml"&&(n.uri=Nr.XML),u!=="xmlns"&&(n.uri=e[u||""]))}var d=s.indexOf(":");d>0?(u=r.prefix=s.slice(0,d),l=r.localName=s.slice(d+1)):(u=null,l=r.localName=s);var p=r.uri=e[u||""];if(t.startElement(p,l,s,r),r.closed){if(t.endElement(p,l,s),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&t.endPrefixMapping(u)}else return r.currentNSMap=e,r.localNSMap=i,!0}function ov(r,t,e,s,i){if(/^(?:script|textarea)$/i.test(e)){var n=r.indexOf("</"+e+">",t),o=r.substring(t+1,n);if(/[&<]/.test(o))return/^script$/i.test(e)?(i.characters(o,0,o.length),n):(o=o.replace(/&#?\w+;/g,s),i.characters(o,0,o.length),n)}return t+1}function av(r,t,e,s){var i=s[e];return i==null&&(i=r.lastIndexOf("</"+e+">"),i<t&&(i=r.lastIndexOf("</"+e)),s[e]=i),i<t}function uh(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function uv(r,t,e,s){var i=r.charAt(t+2);switch(i){case"-":if(r.charAt(t+3)==="-"){var n=r.indexOf("-->",t+4);return n>t?(e.comment(r,t+4,n-t-4),n+3):(s.error("Unclosed comment"),-1)}else return-1;default:if(r.substr(t+3,6)=="CDATA["){var n=r.indexOf("]]>",t+9);return e.startCDATA(),e.characters(r,t+9,n-t-9),e.endCDATA(),n+3}var o=cv(r,t),a=o.length;if(a>1&&/!doctype/i.test(o[0][0])){var u=o[1][0],l=!1,c=!1;a>3&&(/^public$/i.test(o[2][0])?(l=o[3][0],c=a>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var h=o[a-1];return e.startDTD(u,l,c),e.endDTD(),h.index+h[0].length}}return-1}function lv(r,t,e){var s=r.indexOf("?>",t);if(s){var i=r.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){var n=i[0].length;return e.processingInstruction(i[1],i[2]),s+2}else return-1}return-1}function lh(){this.attributeNames={}}lh.prototype={setTagName:function(r){if(!ih.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!ih.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:t,offset:e}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};function cv(r,t){var e,s=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(r);e=i.exec(r);)if(s.push(e),e[1])return s}var ND=eo.XMLReader=nh,$D=eo.ParseError=Qe,hv=re,dv=ee,ch=to,hh=eo,pv=dv.DOMImplementation,dh=hv.NAMESPACE,fv=hh.ParseError,mv=hh.XMLReader;function ph(r){return r.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
`)}function fh(r){this.options=r||{locator:{}}}fh.prototype.parseFromString=function(r,t){var e=this.options,s=new mv,i=e.domBuilder||new zr,n=e.errorHandler,o=e.locator,a=e.xmlns||{},u=/\/x?html?$/.test(t),l=u?ch.HTML_ENTITIES:ch.XML_ENTITIES;o&&i.setDocumentLocator(o),s.errorHandler=gv(n,i,o),s.domBuilder=e.domBuilder||i,u&&(a[""]=dh.HTML),a.xml=a.xml||dh.XML;var c=e.normalizeLineEndings||ph;return r&&typeof r=="string"?s.parse(c(r),a,l):s.errorHandler.error("invalid doc source"),i.doc};function gv(r,t,e){if(!r){if(t instanceof zr)return t;r=t}var s={},i=r instanceof Function;e=e||{};function n(o){var a=r[o];!a&&i&&(a=r.length==2?function(u){r(o,u)}:r),s[o]=a&&function(u){a("[xmldom "+o+"] "+u+so(e))}||function(){}}return n("warning"),n("error"),n("fatalError"),s}function zr(){this.cdata=!1}function Je(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}zr.prototype={startDocument:function(){this.doc=new pv().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,t,e,s){var i=this.doc,n=i.createElementNS(r,e||t),o=s.length;qs(this,n),this.currentElement=n,this.locator&&Je(this.locator,n);for(var a=0;a<o;a++){var r=s.getURI(a),u=s.getValue(a),e=s.getQName(a),l=i.createAttributeNS(r,e);this.locator&&Je(s.getLocator(a),l),l.value=l.nodeValue=u,n.setAttributeNode(l)}},endElement:function(r,t,e){var s=this.currentElement,i=s.tagName;this.currentElement=s.parentNode},startPrefixMapping:function(r,t){},endPrefixMapping:function(r){},processingInstruction:function(r,t){var e=this.doc.createProcessingInstruction(r,t);this.locator&&Je(this.locator,e),qs(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=mh.apply(this,arguments),r){if(this.cdata)var s=this.doc.createCDATASection(r);else var s=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(s):/^\s*$/.test(r)&&this.doc.appendChild(s),this.locator&&Je(this.locator,s)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){(this.locator=r)&&(r.lineNumber=0)},comment:function(r,t,e){r=mh.apply(this,arguments);var s=this.doc.createComment(r);this.locator&&Je(this.locator,s),qs(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e){var s=this.doc.implementation;if(s&&s.createDocumentType){var i=s.createDocumentType(r,t,e);this.locator&&Je(this.locator,i),qs(this,i),this.doc.doctype=i}},warning:function(r){console.warn("[xmldom warning] "+r,so(this.locator))},error:function(r){console.error("[xmldom error] "+r,so(this.locator))},fatalError:function(r){throw new fv(r,this.locator)}};function so(r){if(r)return`
@`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function mh(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){zr.prototype[r]=function(){return null}});function qs(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}var XD=Ws.__DOMHandler=zr,HD=Ws.normalizeLineEndings=ph,zD=Ws.DOMParser=fh,gh=ee,jD=Xn.DOMImplementation=gh.DOMImplementation,VD=Xn.XMLSerializer=gh.XMLSerializer,_v=Xn.DOMParser=Ws.DOMParser;const _h={createCanvas:(r,t)=>new OffscreenCanvas(r!=null?r:0,t!=null?t:0),getCanvasRenderingContext2D:()=>OffscreenCanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>globalThis.location.href,getFontFaceSet:()=>globalThis.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new _v().parseFromString(r,"text/xml")};var xv=Object.defineProperty,bv=Object.defineProperties,yv=Object.getOwnPropertyDescriptors,xh=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,Tv=Object.prototype.propertyIsEnumerable,bh=(r,t,e)=>t in r?xv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yh=(r,t)=>{for(var e in t||(t={}))vv.call(t,e)&&bh(r,e,t[e]);if(xh)for(var e of xh(t))Tv.call(t,e)&&bh(r,e,t[e]);return r},Av=(r,t)=>bv(r,yv(t)),y=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(y||{});const io=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=Av(yh({},t),{ref:r})}if(typeof r=="object")r=yh({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},jr=(r,t)=>{var e;return(e=io(r).priority)!=null?e:t},I={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(io).forEach(t=>{t.type.forEach(e=>{var s,i;return(i=(s=this._removeHandlers)[e])==null?void 0:i.call(s,t)})}),this},add(...r){return r.map(io).forEach(t=>{t.type.forEach(e=>{var s,i;const n=this._addHandlers,o=this._queue;n[e]?(i=n[e])==null||i.call(n,t):(o[e]=o[e]||[],(s=o[e])==null||s.push(t))})}),this},handle(r,t,e){var s;const i=this._addHandlers,n=this._removeHandlers;i[r]=t,n[r]=e;const o=this._queue;return o[r]&&((s=o[r])==null||s.forEach(a=>t(a)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,s=>{t.findIndex(i=>i.name===s.name)>=0||(t.push({name:s.name,value:s.ref}),t.sort((i,n)=>jr(n.value,e)-jr(i.value,e)))},s=>{const i=t.findIndex(n=>n.name===s.name);i!==-1&&t.splice(i,1)})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>jr(n,e)-jr(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})},mixin(r,...t){for(const e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}};class no{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,s=n}this.renderer.resize(e,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}no.extension=y.Application;var ge=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ge||{});class Ks{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=s,this._once=i}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const vh=class Mt{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 Ks(null,null,1/0),this.deltaMS=1/Mt.targetFPMS,this.elapsedMS=1/Mt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=ge.NORMAL){return this._addListener(new Ks(t,e,s))}addOnce(t,e,s=ge.NORMAL){return this._addListener(new Ks(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Mt.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,e)/1e3,Mt.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Mt._shared){const t=Mt._shared=new Mt;t.autoStart=!0,t._protected=!0}return Mt._shared}static get system(){if(!Mt._system){const t=Mt._system=new Mt;t.autoStart=!0,t._protected=!0}return Mt._system}};vh.targetFPMS=.06;let dt=vh;class oo{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,ge.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?dt.shared:new dt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}oo.extension=y.Application,I.add(no),I.add(oo);var wt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(wt||{});function $t(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Vr(r){return r.split("?")[0].split("#")[0]}function Sv(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ev(r,t,e){return r.replace(new RegExp(Sv(t),"g"),e)}function wv(r,t){let e="",s=0,i=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||n===1))if(i!==a-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const u=e.lastIndexOf("/");if(u!==e.length-1){u===-1?(e="",s=0):(e=e.slice(0,u),s=e.length-1-e.lastIndexOf("/")),i=a,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,a)}`:e=r.slice(i+1,a),s=a-i-1;i=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(r){return Ev(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){$t(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if($t(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=Vr(this.toPosix(t!=null?t:L.get().getBaseUrl())),i=Vr(this.toPosix(e!=null?e:this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?bt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if($t(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=wv(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return $t(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let s=0;s<r.length;++s){const i=r[s];if($t(i),i.length>0)if(e===void 0)e=i;else{const n=(t=r[s-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if($t(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!i){s=a;break}}else i=!1;return s===-1?e?"/":this.isUrl(o)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){$t(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){$t(r),t&&$t(t),r=Vr(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const u=r.charCodeAt(n);if(u===47){if(!i){e=n+1;break}}else a===-1&&(i=!1,a=n+1),o>=0&&(u===t.charCodeAt(o)?--o===-1&&(s=n):(o=-1,s=a))}return e===s?s=a:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){$t(r),r=Vr(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!i){e=o+1;break}continue}s===-1&&(i=!1,s=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){$t(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Vr(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;const n="";t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let o=-1,a=0,u=-1,l=!0,c=r.length-1,h=0;for(;c>=i;--c){if(e=r.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}u===-1&&(l=!1,u=c+1),e===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||u===-1||h===0||h===1&&o===u-1&&o===a+1?u!==-1&&(a===0&&s?t.base=t.name=r.slice(1,u):t.base=t.name=r.slice(a,u)):(a===0&&s?(t.name=r.slice(1,o),t.base=r.slice(1,u)):(t.name=r.slice(a,o),t.base=r.slice(a,u)),t.ext=r.slice(o,u)),t.dir=this.dirname(r),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]},Gt=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r);function Th(r,t,e,s,i){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Th(r.replace(s[e],a),t,e+1,s,i):i.push(r.replace(s[e],a))}}function Ah(r){const t=/\{(.*?)\}/g,e=r.match(t),s=[];if(e){const i=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");i.push(o)}),Th(r,i,0,e,s)}else s.push(r);return s}const Wr=r=>!Array.isArray(r);var Cv=Object.defineProperty,Rv=Object.defineProperties,Pv=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Mv=Object.prototype.propertyIsEnumerable,Eh=(r,t,e)=>t in r?Cv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,tr=(r,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&Eh(r,e,t[e]);if(Sh)for(var e of Sh(t))Mv.call(t,e)&&Eh(r,e,t[e]);return r},Ov=(r,t)=>Rv(r,Pv(t));class _e{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,s,i;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(i=t.extractAssetIdFromBundle)!=null?i:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,src:s}=t;return Gt(e||s,i=>typeof i=="string"?i:Array.isArray(i)?i.map(n=>{var o;return(o=n==null?void 0:n.src)!=null?o:n}):i!=null&&i.src?i.src:i,!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];let i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:tr({alias:n},o))),i.forEach(n=>{const o=n.src,a=n.alias;let u;if(typeof a=="string"){const l=this._createBundleAssetId(t,a);s.push(l),u=[a,l]}else{const l=a.map(c=>this._createBundleAssetId(t,c));s.push(...l),u=[...a,...l]}this.add(Ov(tr({},n),{alias:u,src:o}))}),this._bundles[t]=s}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let s;Gt(e).forEach(i=>{const{src:n}=i;let{data:o,format:a,loadParser:u}=i;const l=Gt(n).map(d=>typeof d=="string"?Ah(d):Array.isArray(d)?d:[d]),c=this.getAlias(i),h=[];l.forEach(d=>{d.forEach(p=>{var f,g,m;let _={};if(typeof p!="object"){_.src=p;for(let b=0;b<this._parsers.length;b++){const x=this._parsers[b];if(x.test(p)){_=x.parse(p);break}}}else o=(f=p.data)!=null?f:o,a=(g=p.format)!=null?g:a,u=(m=p.loadParser)!=null?m:u,_=tr(tr({},_),p);if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:c,data:o,format:a,loadParser:u}),h.push(_)})}),c.forEach(d=>{this._assetMap[d]=h})})}resolveBundle(t){const e=Wr(t);t=Gt(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const o=this.resolve(n),a={};for(const u in o){const l=o[u];a[this._extractAssetIdFromBundle(i,u)]=l}s[i]=a}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Wr(t);t=Gt(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(u=>{const l=n.filter(c=>c[a]?c[a]===u:!1);l.length&&(n=l)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[e],i=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var s,i;const{aliases:n,data:o,loadParser:a,format:u}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=n!=null?n:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=tr(tr({},o||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=(i=u!=null?u:t.format)!=null?i:wh(t.src),t}}_e.RETINA_PREFIX=/@([0-9\.]+)x/;function wh(r){return r.split(".").pop().split("?").shift().split("#").shift()}const Zs=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};var ao={exports:{}},WD=ao.exports;(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(u,l,c){this.fn=u,this.context=l,this.once=c||!1}function n(u,l,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var p=new i(c,h||u,d),f=e?e+l:l;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],p]:u._events[f].push(p):(u._events[f]=p,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new s:delete u._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)t.call(c,h)&&l.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,p=h.length,f=new Array(p);d<p;d++)f[d]=h[d].fn;return f},a.prototype.listenerCount=function(l){var c=e?e+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,d,p,f){var g=e?e+l:l;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,b,x;if(m.fn){switch(m.once&&this.removeListener(l,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,h),!0;case 4:return m.fn.call(m.context,c,h,d),!0;case 5:return m.fn.call(m.context,c,h,d,p),!0;case 6:return m.fn.call(m.context,c,h,d,p,f),!0}for(x=1,b=new Array(_-1);x<_;x++)b[x-1]=arguments[x];m.fn.apply(m.context,b)}else{var v=m.length,A;for(x=0;x<v;x++)switch(m[x].once&&this.removeListener(l,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,c);break;case 3:m[x].fn.call(m[x].context,c,h);break;case 4:m[x].fn.call(m[x].context,c,h,d);break;default:if(!b)for(A=1,b=new Array(_-1);A<_;A++)b[A-1]=arguments[A];m[x].fn.apply(m[x].context,b)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,d){var p=e?e+l:l;if(!this._events[p])return this;if(!c)return o(this,p),this;var f=this._events[p];if(f.fn)f.fn===c&&(!d||f.once)&&(!h||f.context===h)&&o(this,p);else{for(var g=0,m=[],_=f.length;g<_;g++)(f[g].fn!==c||d&&!f[g].once||h&&f[g].context!==h)&&m.push(f[g]);m.length?this._events[p]=m.length===1?m[0]:m:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(ao);var Bv=ao.exports,Ct=$n(Bv);const Ch=Math.PI*2,Rh=180/Math.PI,Ph=Math.PI/180;class it{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new it(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}static get shared(){return uo.x=0,uo.y=0,uo}}const uo=new it;class D{constructor(t=1,e=0,s=0,i=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,n,o){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new it;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new it;const s=this.a,i=this.b,n=this.c,o=this.d,a=this.tx,u=this.ty,l=1/(s*o+n*-i),c=t.x,h=t.y;return e.x=o*l*c+-n*l*h+(u*n-a*o)*l,e.y=s*l*h+-i*l*c+(-u*s+a*i)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=o*e-this.ty*s,this.ty=o*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}appendFrom(t,e){const s=t.a,i=t.b,n=t.c,o=t.d,a=t.tx,u=t.ty,l=e.a,c=e.b,h=e.c,d=e.d;return this.a=s*l+i*h,this.b=s*c+i*d,this.c=n*l+o*h,this.d=n*c+o*d,this.tx=a*l+u*h+e.tx,this.ty=a*c+u*d+e.ty,this}setTransform(t,e,s,i,n,o,a,u,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-u)*o,this.d=Math.cos(a-u)*o,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-i,n),u=Math.atan2(s,e),l=Math.abs(a+u);return l<1e-5||Math.abs(Ch-l)<1e-5?(t.rotation=u,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=u),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*s+o.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,o=t*i-e*s;return this.a=i/o,this.b=-e/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new D;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}equals(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}static get IDENTITY(){return Fv.identity()}static get shared(){return Gv.identity()}}const Gv=new D,Fv=new D,Pe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],De=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Me=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Oe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],lo=[],Dh=[],Qs=Math.sign;function Iv(){for(let r=0;r<16;r++){const t=[];lo.push(t);for(let e=0;e<16;e++){const s=Qs(Pe[r]*Pe[e]+Me[r]*De[e]),i=Qs(De[r]*Pe[e]+Oe[r]*De[e]),n=Qs(Pe[r]*Me[e]+Me[r]*Oe[e]),o=Qs(De[r]*Me[e]+Oe[r]*Oe[e]);for(let a=0;a<16;a++)if(Pe[a]===s&&De[a]===i&&Me[a]===n&&Oe[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new D;t.set(Pe[r],De[r],Me[r],Oe[r],0,0),Dh.push(t)}}Iv();const N={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Pe[r],uY:r=>De[r],vX:r=>Me[r],vY:r=>Oe[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>lo[r][t],sub:(r,t)=>lo[r][N.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?N.S:N.N:Math.abs(t)*2<=Math.abs(r)?r>0?N.E:N.W:t>0?r>0?N.SE:N.SW:r>0?N.NE:N.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=Dh[N.inv(t)];i.tx=e,i.ty=s,r.append(i)}},Js=[new it,new it,new it,new it];class z{constructor(t=0,e=0,s=0,i=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new z(0,0,0,0)}clone(){return new z(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,s,i=.5){const{width:n,height:o}=this;if(n<=0||o<=0)return!1;const a=this.x,u=this.y,l=s*(1-i),c=s-l,h=a-l,d=a+n+l,p=u-l,f=u+o+l,g=a+c,m=a+n-c,_=u+c,b=u+o-c;return t>=h&&t<=d&&e>=p&&e<=f&&!(t>g&&t<m&&e>_&&e<b)}intersects(t,e){if(!e){const B=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=B)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const s=this.left,i=this.right,n=this.top,o=this.bottom;if(i<=s||o<=n)return!1;const a=Js[0].set(t.left,t.top),u=Js[1].set(t.left,t.bottom),l=Js[2].set(t.right,t.top),c=Js[3].set(t.right,t.bottom);if(l.x<=a.x||u.y<=a.y)return!1;const h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(a,a),e.apply(u,u),e.apply(l,l),e.apply(c,c),Math.max(a.x,u.x,l.x,c.x)<=s||Math.min(a.x,u.x,l.x,c.x)>=i||Math.max(a.y,u.y,l.y,c.y)<=n||Math.min(a.y,u.y,l.y,c.y)>=o))return!1;const d=h*(u.y-a.y),p=h*(a.x-u.x),f=d*s+p*n,g=d*i+p*n,m=d*s+p*o,_=d*i+p*o;if(Math.max(f,g,m,_)<=d*a.x+p*a.y||Math.min(f,g,m,_)>=d*c.x+p*c.y)return!1;const b=h*(a.y-l.y),x=h*(l.x-a.x),v=b*s+x*n,A=b*i+x*n,T=b*s+x*o,S=b*i+x*o;return!(Math.max(v,A,T,S)<=b*a.x+x*a.y||Math.min(v,A,T,S)>=b*c.x+x*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}getBounds(t){return t||(t=new z),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,s=t.y,i=t.x+t.width,n=t.y+t.height;return e>=this.x&&e<this.x+this.width&&s>=this.y&&s<this.y+this.height&&i>=this.x&&i<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(t,e,s,i){return this.x=t,this.y=e,this.width=s,this.height=i,this}}const Yr={default:-1};function Y(r="default"){return Yr[r]===void 0&&(Yr[r]=-1),++Yr[r]}function Uv(){for(const r in Yr)delete Yr[r]}const co=()=>{};function Be(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function ho(r){return!(r&r-1)&&!!r}function kv(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Xt(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Lv=Object.defineProperty,Mh=Object.getOwnPropertySymbols,Nv=Object.prototype.hasOwnProperty,$v=Object.prototype.propertyIsEnumerable,Oh=(r,t,e)=>t in r?Lv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bh=(r,t)=>{for(var e in t||(t={}))Nv.call(t,e)&&Oh(r,e,t[e]);if(Mh)for(var e of Mh(t))$v.call(t,e)&&Oh(r,e,t[e]);return r};const Gh=Object.create(null);function Xv(r){const t=Gh[r];return t===void 0&&(Gh[r]=Y("resource")),t}const Fh=class hy extends Ct{constructor(t={}){var e,s,i,n,o,a,u;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=Bh(Bh({},hy.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=(e=t.addressModeU)!=null?e:this.addressModeU,this.addressModeV=(s=t.addressModeV)!=null?s:this.addressModeV,this.addressModeW=(i=t.addressModeW)!=null?i:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=(n=t.magFilter)!=null?n:this.magFilter,this.minFilter=(o=t.minFilter)!=null?o:this.minFilter,this.mipmapFilter=(a=t.mipmapFilter)!=null?a:this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=(u=t.maxAnisotropy)!=null?u:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Xv(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Fh.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Ft=Fh;var Hv=Object.defineProperty,Ih=Object.getOwnPropertySymbols,zv=Object.prototype.hasOwnProperty,jv=Object.prototype.propertyIsEnumerable,Uh=(r,t,e)=>t in r?Hv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kh=(r,t)=>{for(var e in t||(t={}))zv.call(t,e)&&Uh(r,e,t[e]);if(Ih)for(var e of Ih(t))jv.call(t,e)&&Uh(r,e,t[e]);return r};const Lh=class dy extends Ct{constructor(t={}){var e,s,i;super(),this.options=t,this.uid=Y("textureSource"),this._resourceType="textureSource",this._resourceId=Y("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t=kh(kh({},dy.defaultOptions),t),this.label=(e=t.label)!=null?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&(s=this.resourceWidth)!=null?s:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&(i=this.resourceHeight)!=null?i:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Ft(Xt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,s;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(s=this._style)==null||s.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Y("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,s){s||(s=this._resolution),t||(t=this.width),e||(e=this.height);const i=Math.round(t*s),n=Math.round(e*s);return this.width=i/s,this.height=n/s,this._resolution=s,this.pixelWidth===i&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=n,this.emit("resize",this),this._resourceId=Y("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=ho(this.pixelWidth)&&ho(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Lh.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let q=Lh;var Vv=Object.defineProperty,Wv=Object.defineProperties,Yv=Object.getOwnPropertyDescriptors,Nh=Object.getOwnPropertySymbols,qv=Object.prototype.hasOwnProperty,Kv=Object.prototype.propertyIsEnumerable,$h=(r,t,e)=>t in r?Vv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zv=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&$h(r,e,t[e]);if(Nh)for(var e of Nh(t))Kv.call(t,e)&&$h(r,e,t[e]);return r},Qv=(r,t)=>Wv(r,Yv(t));class ti extends q{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let s=t.format;s||(e instanceof Float32Array?s="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?s="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?s="rgba16uint":(e instanceof Int8Array,s="bgra8unorm")),super(Qv(Zv({},t),{resource:e,format:s})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}ti.extension=y.TextureSource;const Xh=new D;class po{constructor(t,e){this.mapCoord=new D,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e=="undefined"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],o=t[i+1];e[i]=n*s.a+o*s.c+s.tx,e[i+1]=n*s.b+o*s.d+s.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const s=t.orig,i=t.trim;i&&(Xh.set(s.width/i.width,0,0,s.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Xh));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,u=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+u)/n.width,o[1]=(t.frame.y+a+u)/n.height,o[2]=(t.frame.x+t.frame.width-a+u)/n.width,o[3]=(t.frame.y+t.frame.height-a+u)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}class w extends Ct{constructor({source:t,label:e,frame:s,orig:i,trim:n,defaultAnchor:o,defaultBorders:a,rotate:u,dynamic:l}={}){var c;if(super(),this.uid=Y("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new z,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(c=t==null?void 0:t.source)!=null?c:new q,this.noFrame=!s,s)this.frame.copyFrom(s);else{const{width:h,height:d}=this._source;this.frame.width=h,this.frame.height=d}this.orig=i||this.frame,this.trim=n,this.rotate=u!=null?u:0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new po(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:s,height:i}=this._source,n=e.x/s,o=e.y/i,a=e.width/s,u=e.height/i;let l=this.rotate;if(l){const c=a/2,h=u/2,d=n+c,p=o+h;l=N.add(l,N.NW),t.x0=d+c*N.uX(l),t.y0=p+h*N.uY(l),l=N.add(l,2),t.x1=d+c*N.uX(l),t.y1=p+h*N.uY(l),l=N.add(l,2),t.x2=d+c*N.uX(l),t.y2=p+h*N.uY(l),l=N.add(l,2),t.x3=d+c*N.uX(l),t.y3=p+h*N.uY(l)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+u,t.x3=n,t.y3=o+u}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return this._source}}w.EMPTY=new w({label:"EMPTY",source:new q({label:"EMPTY"})}),w.EMPTY.destroy=co,w.WHITE=new w({source:new ti({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),w.WHITE.destroy=co;const Hh=class Gs{constructor(t,e){this.linkedSheets=[];let s=t;(t==null?void 0:t.source)instanceof q&&(s={texture:t,data:e});const{texture:i,data:n,cachePrefix:o=""}=s;this.cachePrefix=o,this._texture=i instanceof w?i:null,this.textureSource=i.source,this.textures={},this.animations={},this.data=n;const a=parseFloat(n.meta.scale);a?(this.resolution=a,i.source.resolution=this.resolution):this.resolution=i.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Gs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Gs.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const i=this._frameKeys[e],n=this._frames[i],o=n.frame;if(o){let a=null,u=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new z(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new z(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(u=new z(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[i]=new w({source:this.textureSource,frame:a,orig:c,trim:u,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:i.toString()})}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Gs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Gs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Hh.BATCH_SIZE=1e3;let fo=Hh;const Jv=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function zh(r,t,e){const s={};if(r.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=bt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=zh([`${i}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(s,a)})}return s}const jh={extension:y.Asset,cache:{test:r=>r instanceof fo,getCacheableAssets:(r,t)=>zh(r,t,!1)},resolver:{extension:{type:y.ResolveParser,name:"resolveSpritesheet"},test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&Jv.includes(s)},parse:r=>{var t,e;const s=r.split(".");return{resolution:parseFloat((e=(t=_e.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:y.LoadParser,priority:wt.Normal,name:"spritesheetLoader"},async testParse(r,t){return bt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var s,i,n;const{texture:o,imageFilename:a,textureOptions:u,cachePrefix:l}=(s=t==null?void 0:t.data)!=null?s:{};let c=bt.dirname(t.src);c&&c.lastIndexOf("/")!==c.length-1&&(c+="/");let h;if(o instanceof w)h=o;else{const f=Zs(c+(a!=null?a:r.meta.image),t.src);h=(await e.load([{src:f,data:u}]))[f]}const d=new fo({texture:h.source,data:r,cachePrefix:l});await d.parse();const p=(i=r==null?void 0:r.meta)==null?void 0:i.related_multi_packs;if(Array.isArray(p)){const f=[];for(const m of p){if(typeof m!="string")continue;let _=c+m;(n=t.data)!=null&&n.ignoreMultiPack||(_=Zs(_,t.src),f.push(e.load({src:_,data:{textureOptions:u,ignoreMultiPack:!0}})))}const g=await Promise.all(f);d.linkedSheets=g,g.forEach(m=>{m.linkedSheets=[d].concat(d.linkedSheets.filter(_=>_!==m))})}return d},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};I.add(jh);class st{constructor(t,e,s){this._x=e||0,this._y=s||0,this._observer=t}clone(t){return new st(t!=null?t:this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),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._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function mo(r,t,e){const{width:s,height:i}=e.orig,n=e.trim;if(n){const o=n.width,a=n.height;r.minX=n.x-t._x*s,r.maxX=r.minX+o,r.minY=n.y-t._y*i,r.maxY=r.minY+a}else r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*i,r.maxY=r.minY+i}const Vh=new D;class nt{constructor(t=1/0,e=1/0,s=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Vh,this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new z);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Vh,this}set(t,e,s,i){this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}addFrame(t,e,s,i,n){n||(n=this.matrix);const o=n.a,a=n.b,u=n.c,l=n.d,c=n.tx,h=n.ty;let d=this.minX,p=this.minY,f=this.maxX,g=this.maxY,m=o*t+u*e+c,_=a*t+l*e+h;m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),m=o*s+u*e+c,_=a*s+l*e+h,m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),m=o*t+u*i+c,_=a*t+l*i+h,m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),m=o*s+u*i+c,_=a*s+l*i+h,m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),this.minX=d,this.minY=p,this.maxX=f,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,s=this.minY,i=this.maxX,n=this.maxY,{a:o,b:a,c:u,d:l,tx:c,ty:h}=t;let d=o*e+u*s+c,p=a*e+l*s+h;this.minX=d,this.minY=p,this.maxX=d,this.maxY=p,d=o*i+u*s+c,p=a*i+l*s+h,this.minX=d<this.minX?d:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=p>this.maxY?p:this.maxY,d=o*e+u*n+c,p=a*e+l*n+h,this.minX=d<this.minX?d:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=p>this.maxY?p:this.maxY,d=o*i+u*n+c,p=a*i+l*n+h,this.minX=d<this.minX?d:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=p>this.maxY?p:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,s,i){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<s&&(this.minY=s),this.maxY>i&&(this.maxY=i),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new nt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,s,i){let n=this.minX,o=this.minY,a=this.maxX,u=this.maxY;i||(i=this.matrix);const l=i.a,c=i.b,h=i.c,d=i.d,p=i.tx,f=i.ty;for(let g=e;g<s;g+=2){const m=t[g],_=t[g+1],b=l*m+h*_+p,x=c*m+d*_+f;n=b<n?b:n,o=x<o?x:o,a=b>a?b:a,u=x>u?x:u}this.minX=n,this.minY=o,this.maxX=a,this.maxY=u}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var t1={grad:.9,turn:360,rad:360/(2*Math.PI)},oe=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},at=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},It=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Wh=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Yh=function(r){return{r:It(r.r,0,255),g:It(r.g,0,255),b:It(r.b,0,255),a:It(r.a)}},go=function(r){return{r:at(r.r),g:at(r.g),b:at(r.b),a:at(r.a,3)}},e1=/^#([0-9a-f]{3,8})$/i,ei=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},qh=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),o=n-Math.min(t,e,s),a=o?n===t?(e-s)/o:n===e?2+(s-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:i}},Kh=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),o=s*(1-e),a=s*(1-(t-n)*e),u=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,a,o,o,u,s][l],g:255*[u,s,s,a,o,o][l],b:255*[o,o,u,s,s,a][l],a:i}},Zh=function(r){return{h:Wh(r.h),s:It(r.s,0,100),l:It(r.l,0,100),a:It(r.a)}},Qh=function(r){return{h:at(r.h),s:at(r.s),l:at(r.l),a:at(r.a,3)}},Jh=function(r){return Kh((e=(t=r).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},qr=function(r){return{h:(t=qh(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},r1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,i1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,n1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_o={string:[[function(r){var t=e1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?at(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?at(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=i1.exec(r)||n1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Yh({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=r1.exec(r)||s1.exec(r);if(!t)return null;var e,s,i=Zh({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(t1[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Jh(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return oe(t)&&oe(e)&&oe(s)?Yh({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!oe(t)||!oe(e)||!oe(s))return null;var o=Zh({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Jh(o)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!oe(t)||!oe(e)||!oe(s))return null;var o=function(a){return{h:Wh(a.h),s:It(a.s,0,100),v:It(a.v,0,100),a:It(a.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Kh(o)},"hsv"]]},td=function(r,t){for(var e=0;e<t.length;e++){var s=t[e][0](r);if(s)return[s,t[e][1]]}return[null,void 0]},ed=function(r){return typeof r=="string"?td(r.trim(),_o.string):typeof r=="object"&&r!==null?td(r,_o.object):[null,void 0]},YD=function(r){return ed(r)[1]},xo=function(r,t){var e=qr(r);return{h:e.h,s:It(e.s+100*t,0,100),l:e.l,a:e.a}},bo=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},rd=function(r,t){var e=qr(r);return{h:e.h,s:e.s,l:It(e.l+100*t,0,100),a:e.a}},ri=function(){function r(t){this.parsed=ed(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return at(bo(this.rgba),2)},r.prototype.isDark=function(){return bo(this.rgba)<.5},r.prototype.isLight=function(){return bo(this.rgba)>=.5},r.prototype.toHex=function(){return t=go(this.rgba),e=t.r,s=t.g,i=t.b,o=(n=t.a)<1?ei(at(255*n)):"","#"+ei(e)+ei(s)+ei(i)+o;var t,e,s,i,n,o},r.prototype.toRgb=function(){return go(this.rgba)},r.prototype.toRgbString=function(){return t=go(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return Qh(qr(this.rgba))},r.prototype.toHslString=function(){return t=Qh(qr(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=qh(this.rgba),{h:at(t.h),s:at(t.s),v:at(t.v),a:at(t.a,3)};var t},r.prototype.invert=function(){return Yt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Yt(xo(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Yt(xo(this.rgba,-t))},r.prototype.grayscale=function(){return Yt(xo(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Yt(rd(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Yt(rd(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Yt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):at(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=qr(this.rgba);return typeof t=="number"?Yt({h:t,s:e.s,l:e.l,a:e.a}):at(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Yt(t).toHex()},r}(),Yt=function(r){return r instanceof ri?r:new ri(r)},sd=[],o1=function(r){r.forEach(function(t){sd.indexOf(t)<0&&(t(ri,_o),sd.push(t))})},qD=function(){return new ri({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function a1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var i in e)s[e[i]]=i;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,u,l=s[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),h=1/0,d="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var f in e){var g=(a=c,u=n[f],Math.pow(a.r-u.r,2)+Math.pow(a.g-u.g,2)+Math.pow(a.b-u.b,2));g<h&&(h=g,d=f)}return d}},t.string.push([function(o){var a=o.toLowerCase(),u=a==="transparent"?"#0000":e[a];return u?new r(u).toRgb():null},"name"])}var u1=Object.defineProperty,id=Object.getOwnPropertySymbols,l1=Object.prototype.hasOwnProperty,c1=Object.prototype.propertyIsEnumerable,nd=(r,t,e)=>t in r?u1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,h1=(r,t)=>{for(var e in t||(t={}))l1.call(t,e)&&nd(r,e,t[e]);if(id)for(var e of id(t))c1.call(t,e)&&nd(r,e,t[e]);return r};o1([a1]);const er=class Fs{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Fs)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?h1({},t):t}_isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((i,n)=>i===e[n]);if(t!==null&&e!==null){const i=Object.keys(t),n=Object.keys(e);return i.length!==n.length?!1:i.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toBgrNumber(){const[t,e,s]=this.toUint8RgbArray();return(s<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=Fs._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,s,i,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,s=(o>>8&255)/255,i=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Fs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Yt(t);o.isValid()&&({r:e,g:s,b:i,a:n}=o.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Fs||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};er.shared=new er,er._temp=new er,er.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let X=er;const od={cullArea:null,cullable:!1,cullableChildren:!0};class si{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){var e;let s;return this._index>0?s=this._pool[--this._index]:s=new this._classType,(e=s.init)==null||e.call(s,t),s}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class ad{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new si(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const s=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[s]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const ut=new ad,ud={get isCachedAsTexture(){var r;return!!((r=this.renderGroup)!=null&&r.isCachedAsTexture)},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){var r;(r=this.renderGroup)==null||r.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){this.cacheAsTexture(r)}};function ld(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;i<n;++i)r[i]=r[i+e];r.length=n}const cd={allowChildren:!0,removeChildren(r=0,t){var e;const s=t!=null?t:this.children.length,i=s-r,n=[];if(i>0&&i<=s){for(let a=s-1;a>=r;a--){const u=this.children[a];u&&(n.push(u),u.parent=null)}ld(this.children,r,s);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(n);for(let a=0;a<n.length;++a){const u=n[a];(e=u.parentRenderLayer)==null||e.detach(u),this.emit("childRemoved",u,this,a),n[a].emit("removed",this)}return n.length>0&&this._didViewChangeTick++,n}else if(i===0&&this.children.length===0)return n;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){const t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){const t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){const{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){const i=r.parent.children.indexOf(r);if(r.parent===this&&i===t)return r;i!==-1&&r.parent.children.splice(i,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),s=this.getChildIndex(t);this.children[e]=t,this.children[s]=r;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var r;(r=this.parent)==null||r.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const s=this.worldTransform.clone();return s.invert(),e.prepend(s),r.setFromMatrix(e),r}},hd={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){const s=this.children,i=s.length;for(let n=0;n<i;n++)s[n].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){const{renderPipes:s}=t;for(let i=0;i<this.effects.length;i++){const n=this.effects[i];s[n.pipe].push(n,this,r)}this.collectRenderablesSimple(r,t,e);for(let i=this.effects.length-1;i>=0;i--){const n=this.effects[i];s[n.pipe].pop(n,this,r)}}};class Kr{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}class dd{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const s=this._tests[e];if(s.test(t))return ut.get(s.maskClass,t)}return t}returnMaskEffect(t){ut.return(t)}}const ii=new dd;I.handleByList(y.MaskEffect,ii._effectClasses);var d1=Object.defineProperty,pd=Object.getOwnPropertySymbols,p1=Object.prototype.hasOwnProperty,f1=Object.prototype.propertyIsEnumerable,fd=(r,t,e)=>t in r?d1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,md=(r,t)=>{for(var e in t||(t={}))p1.call(t,e)&&fd(r,e,t[e]);if(pd)for(var e of pd(t))f1.call(t,e)&&fd(r,e,t[e]);return r};const gd={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,e)=>t.priority-e.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){const t=this._maskEffect;(t==null?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),ii.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=ii.getMaskEffect(r),this.addEffect(this._maskEffect)))},get mask(){var r;return(r=this._maskEffect)==null?void 0:r.mask},setMask(r){this._maskOptions=md(md({},this._maskOptions),r),r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},set filters(r){var t;!Array.isArray(r)&&r&&(r=[r]);const e=this._filterEffect||(this._filterEffect=new Kr);r=r;const s=(r==null?void 0:r.length)>0,i=((t=e.filters)==null?void 0:t.length)>0,n=s!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),n&&(s?this.addEffect(e):(this.removeEffect(e),e.filters=r!=null?r:null))},get filters(){var r;return(r=this._filterEffect)==null?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new Kr),this._filterEffect.filterArea=r},get filterArea(){var r;return(r=this._filterEffect)==null?void 0:r.filterArea}},_d={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let s=0;s<e.length;s++){const i=e[s];if(i.label===r||r instanceof RegExp&&r.test(i.label))return i}if(t)for(let s=0;s<e.length;s++){const i=e[s].getChildByLabel(r,!0);if(i)return i}return null},getChildrenByLabel(r,t=!1,e=[]){const s=this.children;for(let i=0;i<s.length;i++){const n=s[i];(n.label===r||r instanceof RegExp&&r.test(n.label))&&e.push(n)}if(t)for(let i=0;i<s.length;i++)s[i].getChildrenByLabel(r,!0,e);return e}},ht=new si(D),qt=new si(nt),m1=new D,xd={getFastGlobalBounds(r,t){t||(t=new nt),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let s=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(s=qt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;s.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const n=this.children;for(let o=0;o<n.length;o++)n[o]._getGlobalBoundsRecursive(r,s,e)}if(i){let n=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(n||(n=!0,s.applyMatrix(o.worldTransform)),this.effects[a].addBounds(s,!0));n&&(s.applyMatrix(o.worldTransform.copyTo(m1).invert()),t.addBounds(s,this.relativeGroupTransform)),t.addBounds(s),qt.return(s)}else this.renderGroup&&(t.addBounds(s,this.relativeGroupTransform),qt.return(s))}};function Zr(r,t,e){e.clear();let s,i;return r.parent?t?s=r.parent.worldTransform:(i=ht.get().identity(),s=ni(r,i)):s=D.IDENTITY,bd(r,e,s,t),i&&ht.return(i),e.isValid||e.set(0,0,0,0),e}function bd(r,t,e,s){var i,n;if(!r.visible||!r.measurable)return;let o;s?o=r.worldTransform:(r.updateLocalTransform(),o=ht.get(),o.appendFrom(r.localTransform,e));const a=t,u=!!r.effects.length;if(u&&(t=qt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.bounds&&(t.matrix=o,t.addBounds(r.bounds));for(let l=0;l<r.children.length;l++)bd(r.children[l],t,o,s)}if(u){for(let l=0;l<r.effects.length;l++)(n=(i=r.effects[l]).addBounds)==null||n.call(i,t);a.addBounds(t,D.IDENTITY),qt.return(t)}s||ht.return(o)}function ni(r,t){const e=r.parent;return e&&(ni(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function yo(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;const e=r>>16&255,s=r>>8&255,i=r&255,n=t>>16&255,o=t>>8&255,a=t&255,u=e*n/255|0,l=s*o/255|0,c=i*a/255|0;return(u<<16)+(l<<8)+c}const yd=16777215;function Qr(r,t){return r===yd?t:t===yd?r:yo(r,t)}function rr(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}const vd={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();const e=ni(this,ht.get().identity());return r.appendFrom(this.localTransform,e),ht.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?rr(this.renderGroup.worldColor):this.parentRenderGroup?rr(Qr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Qr(t,e.localColor),e=e.parent;return rr(t)}};function oi(r,t,e){return t.clear(),e||(e=D.IDENTITY),Td(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function Td(r,t,e,s,i){var n,o;let a;if(i)a=ht.get(),a=e.copyTo(a);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();const c=r.localTransform;a=ht.get(),a.appendFrom(c,e)}const u=t,l=!!r.effects.length;if(l&&(t=qt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,a);else{r.renderPipeId&&(t.matrix=a,t.addBounds(r.bounds));const c=r.children;for(let h=0;h<c.length;h++)Td(c[h],t,a,s,!1)}if(l){for(let c=0;c<r.effects.length;c++)(o=(n=r.effects[c]).addLocalBounds)==null||o.call(n,t,s);u.addBounds(t,D.IDENTITY),qt.return(t)}ht.return(a)}function vo(r,t){const e=r.children;for(let s=0;s<e.length;s++){const i=e[s],n=i.uid,o=(i._didViewChangeTick&65535)<<16|i._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,i.children.length&&vo(i,t)}return t.didChange}const g1=new D,Ad={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new nt});const r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),vo(this,r),r.didChange&&oi(this,r.localBounds,g1),r.localBounds},getBounds(r,t){return Zr(this,r,t||new nt)}},Sd={_onRender:null,set onRender(r){const t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}},Ed={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(_1))}};function _1(r,t){return r._zIndex-t._zIndex}const wd={getGlobalPosition(r=new it,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){const s=this.getGlobalTransform(ht.get(),e);return t=s.apply(r,t),ht.return(s),t},toLocal(r,t,e,s){t&&(r=t.toGlobal(r,e,s));const i=this.getGlobalTransform(ht.get(),s);return e=i.applyInverse(r,e),ht.return(i),e}};class To{constructor(){this.uid=Y("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}var x1=Object.defineProperty,b1=Object.defineProperties,y1=Object.getOwnPropertyDescriptors,Cd=Object.getOwnPropertySymbols,v1=Object.prototype.hasOwnProperty,T1=Object.prototype.propertyIsEnumerable,Rd=(r,t,e)=>t in r?x1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,A1=(r,t)=>{for(var e in t||(t={}))v1.call(t,e)&&Rd(r,e,t[e]);if(Cd)for(var e of Cd(t))T1.call(t,e)&&Rd(r,e,t[e]);return r},S1=(r,t)=>b1(r,y1(t));let E1=0;class Pd{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new Ft(this.textureOptions)}createTexture(t,e,s){const i=new q(S1(A1({},this.textureOptions),{width:t,height:e,resolution:1,antialias:s,autoGarbageCollect:!1}));return new w({source:i,label:`texturePool_${E1++}`})}getOptimalTexture(t,e,s=1,i){let n=Math.ceil(t*s-1e-6),o=Math.ceil(e*s-1e-6);n=Be(n),o=Be(o);const a=(n<<17)+(o<<1)+(i?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let u=this._texturePool[a].pop();return u||(u=this.createTexture(n,o,i)),u.source._resolution=s,u.source.width=n/s,u.source.height=o/s,u.source.pixelWidth=n,u.source.pixelHeight=o,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=a,u}getSameSizeTexture(t,e=!1){const s=t.source;return this.getOptimalTexture(t.width,t.height,s._resolution,e)}returnTexture(t,e=!1){const s=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[s].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const s=this._texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0)}this._texturePool={}}}const et=new Pd;class Dd{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new D,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new To,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let s=0;s<e.length;s++){const i=e[s];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(et.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let s=0;s<e.length;s++)this.removeChild(e[s])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let s=0;s<e.length;s++)this._getChildren(e[s],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const s=t.children;for(let i=0;i<s.length;i++)this._getChildren(s[i],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return this._matrixDirty&1?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new D),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return this._matrixDirty&2?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new D),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(this._matrixDirty&4))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new D),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function ai(r,t,e={}){for(const s in t)!e[s]&&t[s]!==void 0&&(r[s]=t[s])}const Ao=new st(null),So=new st(null),Eo=new st(null,1,1),Jr=1,ui=2,sr=4,w1=8;class mt extends Ct{constructor(t={}){var e,s;super(),this.uid=Y("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new D,this.relativeGroupTransform=new D,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new st(this,0,0),this._scale=Eo,this._pivot=So,this._skew=Ao,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],ai(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(i=>this.addChild(i)),(s=t.parent)==null||s.addChild(this)}static mixin(t){I.mixin(mt,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(t.length>1){for(let i=0;i<t.length;i++)this.addChild(t[i]);return t[0]}const e=t[0],s=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),s&&(s.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,s&&s.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let i=0;i<t.length;i++)this.removeChild(t[i]);return t[0]}const e=t[0],s=this.children.indexOf(e);return s>-1&&(this._didViewChangeTick++,this.children.splice(s,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,s),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=ut.get(Dd,this),this.groupTransform=D.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),ut.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new D),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Rh}set angle(t){this.rotation=t*Ph}get pivot(){return this._pivot===So&&(this._pivot=new st(this,0,0)),this._pivot}set pivot(t){this._pivot===So&&(this._pivot=new st(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Ao&&(this._skew=new st(this,0,0)),this._skew}set skew(t){this._skew===Ao&&(this._skew=new st(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Eo&&(this._scale=new st(this,1,1)),this._scale}set scale(t){this._scale===Eo&&(this._scale=new st(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){var s;const i=this.getLocalBounds();typeof t=="object"?(e=(s=t.height)!=null?s:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,s=this._scale,i=this._pivot,n=this._position,o=s._x,a=s._y,u=i._x,l=i._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=n._x-(u*e.a+l*e.c),e.ty=n._y-(u*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Jr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=X.shared.setValue(t!=null?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=Jr,this._onUpdate())}get tint(){return rr(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ui,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=sr,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=sr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=sr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var e;if(this.destroyed)return;this.destroyed=!0;let s;if(this.children.length&&(s=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t==null?void 0:t.children)&&s)for(let i=0;i<s.length;++i)s[i].destroy(t);(e=this.renderGroup)==null||e.destroy(),this.renderGroup=null}}I.mixin(mt,cd,xd,wd,Sd,Ad,gd,_d,Ed,od,ud,vd,hd);class ae extends mt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new nt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:s,y:i}=t;return s>=e.minX&&s<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){var e,s;super.destroy(t),this._bounds=null;for(const i in this._gpuData)(s=(e=this._gpuData[i]).destroy)==null||s.call(e);this._gpuData=null}collectRenderablesSimple(t,e,s){const{renderPipes:i}=e;i.blendMode.setBlendMode(this,this.groupBlendMode,t),i[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=!1;const n=this.children,o=n.length;for(let a=0;a<o;a++)n[a].collectRenderables(t,e,s)}}var C1=Object.defineProperty,li=Object.getOwnPropertySymbols,Md=Object.prototype.hasOwnProperty,Od=Object.prototype.propertyIsEnumerable,Bd=(r,t,e)=>t in r?C1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,R1=(r,t)=>{for(var e in t||(t={}))Md.call(t,e)&&Bd(r,e,t[e]);if(li)for(var e of li(t))Od.call(t,e)&&Bd(r,e,t[e]);return r},P1=(r,t)=>{var e={};for(var s in r)Md.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&li)for(var s of li(r))t.indexOf(s)<0&&Od.call(r,s)&&(e[s]=r[s]);return e};class jt extends ae{constructor(t=w.EMPTY){t instanceof w&&(t={texture:t});const e=t,{texture:s=w.EMPTY,anchor:i,roundPixels:n,width:o,height:a}=e,u=P1(e,["texture","anchor","roundPixels","width","height"]);super(R1({label:"Sprite"},u)),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new st({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:s.defaultAnchor&&(this.anchor=s.defaultAnchor),this.texture=s,this.allowChildren=!1,this.roundPixels=n!=null?n:!1,o!==void 0&&(this.width=o),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof w?new jt(t):new jt(w.from(t,e))}set texture(t){t||(t=w.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return mo(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,s=this._bounds,{width:i,height:n}=e.orig;s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*n,s.maxY=s.minY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null,this._gpuData=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){var s;typeof t=="object"?(e=(s=t.height)!=null?s:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const D1=new nt;function ci(r,t,e){const s=D1;r.measurable=!0,Zr(r,e,s),t.addBoundsMask(s),r.measurable=!1}function hi(r,t,e){const s=qt.get();r.measurable=!0;const i=ht.get().identity(),n=Gd(r,e,i);oi(r,s,n),r.measurable=!1,t.addBoundsMask(s),ht.return(i),qt.return(s)}function Gd(r,t,e){return r&&r!==t&&(Gd(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class wo{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof jt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||ci(this.mask,t,e)}addLocalBounds(t,e){hi(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof jt}}wo.extension=y.MaskEffect;class Co{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Co.extension=y.MaskEffect;class Ro{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){ci(this.mask,t,e)}addLocalBounds(t,e){hi(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof mt}}Ro.extension=y.MaskEffect;class Kt extends q{constructor(t){t.resource||(t.resource=L.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,s=this._resolution){const i=super.resize(t,e,s);return i&&this.resizeCanvas(),i}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}Kt.extension=y.TextureSource;class xe extends q{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}xe.extension=y.TextureSource;let Po;async function Do(){return Po!=null||(Po=(async()=>{var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(s),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Po}var M1=Object.defineProperty,O1=Object.defineProperties,B1=Object.getOwnPropertyDescriptors,Fd=Object.getOwnPropertySymbols,G1=Object.prototype.hasOwnProperty,F1=Object.prototype.propertyIsEnumerable,Id=(r,t,e)=>t in r?M1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mo=(r,t)=>{for(var e in t||(t={}))G1.call(t,e)&&Id(r,e,t[e]);if(Fd)for(var e of Fd(t))F1.call(t,e)&&Id(r,e,t[e]);return r},I1=(r,t)=>O1(r,B1(t));const di=class py extends q{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=Mo(Mo({},py.defaultOptions),t),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=(e=t.alphaMode)!=null?e:"premultiply-alpha-on-upload",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._onCanPlayThrough=this._onCanPlayThrough.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),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=dt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;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._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Do(),this._load=new Promise((s,i)=>{this.isValid?s(this):(this._resolve=s,this._reject=i,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;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._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}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.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(dt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(dt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(dt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};di.extension=y.TextureSource,di.defaultOptions=I1(Mo({},q.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),di.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let ts=di,U1=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){return this._cache.get(t)}set(t,e){const s=Gt(t);let i;for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];if(l.test(e)){i=l.getCacheableAssets(s,e);break}}const n=new Map(Object.entries(i||{}));i||s.forEach(u=>{n.set(u,e)});const o=[...n.keys()],a={cacheKeys:o,keys:s};s.forEach(u=>{this._cacheMap.set(u,a)}),o.forEach(u=>{const l=i?i[u]:e;this._cache.has(u)&&this._cache.get(u),this._cache.set(u,n.get(u))})}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const V=new U1,Oo=[];I.handleByList(y.TextureSource,Oo);function k1(r={}){return Bo(r)}function Bo(r={}){const t=r&&r.resource,e=t?r.resource:r,s=t?r:{resource:r};for(let i=0;i<Oo.length;i++){const n=Oo[i];if(n.test(e))return new n(s)}throw new Error(`Could not find a source type for resource: ${s.resource}`)}function Ud(r={},t=!1){const e=r&&r.resource,s=e?r.resource:r,i=e?r:{resource:r};if(!t&&V.has(s))return V.get(s);const n=new w({source:Bo(i)});return n.on("destroy",()=>{V.has(s)&&V.remove(s)}),t||V.set(s,n),n}function kd(r,t=!1){return typeof r=="string"?V.get(r):r instanceof q?new w({source:r}):Ud(r,t)}w.from=kd,q.from=Bo,I.add(wo,Co,Ro,ts,xe,Kt,ti);class Zt{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const s in t){const i=t[s];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const s in this.resources)t[e++]=this.resources[s]._resourceId;this._key=t.join("|")}setResource(t,e){var s,i;const n=this.resources[e];t!==n&&(n&&((s=t.off)==null||s.call(t,"change",this.onResourceChange,this)),(i=t.on)==null||i.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const s in e)e[s]._touched=t}destroy(){var t;const e=this.resources;for(const s in e){const i=e[s];(t=i.off)==null||t.call(i,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const s in e)e[s]===t&&(e[s]=null)}else this._updateKey()}}const Ld={};function pi(r,t,e){let s=2166136261;for(let i=0;i<t;i++)s^=r[i].uid,s=Math.imul(s,16777619),s>>>=0;return Ld[s]||L1(r,t,s,e)}function L1(r,t,e,s){const i={};let n=0;for(let a=0;a<s;a++){const u=a<t?r[a]:w.EMPTY.source;i[n++]=u.source,i[n++]=u.style}const o=new Zt(i);return Ld[e]=o,o}class Ge{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}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 int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const Nd={},N1="8.0.0",$1="8.3.4";function $d(r,t,e=3){if(Nd[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`):(s=s.split(`
`).splice(e).join(`
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
Deprecated since v${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`),console.warn(s))),Nd[t]=!0}function fi(r,t){const e=r.byteLength/8|0,s=new Float64Array(r,0,e);new Float64Array(t,0,e).set(s);const i=r.byteLength-e*8;if(i>0){const n=new Uint8Array(r,e*8,i);new Uint8Array(t,e*8,i).set(n)}}const Xd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var Q=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Q||{});function ir(r,t){return t.alphaMode==="no-premultiply-alpha"&&Xd[r]||r}let es;function Go(){return(!es||es!=null&&es.isContextLost())&&(es=L.get().createCanvas().getContext("webgl",{})),es}const X1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`);function H1(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Fo(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const s=X1.replace(/%forloop%/gi,H1(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}let nr=null;function Hd(){var r;if(nr)return nr;const t=Go();return nr=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),nr=Fo(nr,t),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),nr}class zd{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}var z1=Object.defineProperty,jd=Object.getOwnPropertySymbols,j1=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable,Vd=(r,t,e)=>t in r?z1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wd=(r,t)=>{for(var e in t||(t={}))j1.call(t,e)&&Vd(r,e,t[e]);if(jd)for(var e of jd(t))V1.call(t,e)&&Vd(r,e,t[e]);return r};class Yd{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new zd,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const qd=[];let Io=0;function Kd(){return Io>0?qd[--Io]:new Yd}function Zd(r){qd[Io++]=r}let rs=0;const Qd=class fy{constructor(t){this.uid=Y("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t=Wd(Wd({},fy.defaultOptions),t),t.maxTextures||($d("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Hd());const{maxTextures:e,attributesInitialSize:s,indicesInitialSize:i}=t;this.attributeBuffer=new Ge(s*4),this.indexBuffer=new Uint16Array(i),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Zd(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const s=t._batch.textures.ids[e._source.uid];return!s&&s!==0?!1:(t._textureId=s,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let s=Kd(),i=s.textures;i.clear();const n=e[this.elementStart];let o=ir(n.blendMode,n.texture._source),a=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const u=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let h=this._batchIndexSize,d=this._batchIndexStart,p="startBatch";const f=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){const m=e[g];e[g]=null;const _=m.texture._source,b=ir(m.blendMode,_),x=o!==b||a!==m.topology;if(_._batchTick===rs&&!x){m._textureId=_._textureBindLocation,h+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,u,l,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,u,l,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=s;continue}_._batchTick=rs,(i.count>=f||x)&&(this._finishBatch(s,d,h-d,i,o,a,t,p),p="renderBatch",d=h,o=b,a=m.topology,s=Kd(),i=s.textures,i.clear(),++rs),m._textureId=_._textureBindLocation=i.count,i.ids[_.uid]=i.count,i.textures[i.count++]=_,m._batch=s,h+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,u,l,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,u,l,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(s,d,h-d,i,o,a,t,p),d=h,++rs),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=h}_finishBatch(t,e,s,i,n,o,a,u){t.gpuBindGroup=null,t.bindGroup=null,t.action=u,t.batcher=this,t.textures=i,t.blendMode=n,t.topology=o,t.start=e,t.size=s,++rs,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),s=new Ge(e);fi(this.attributeBuffer.rawBinaryData,s.rawBinaryData),this.attributeBuffer=s}_resizeIndexBuffer(t){const e=this.indexBuffer;let s=Math.max(t,e.length*1.5);s+=s%2;const i=s>65535?new Uint32Array(s):new Uint16Array(s);if(i.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)i[n]=e[n];else fi(e.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(t,e,s){t[e]=s+0,t[e+1]=s+1,t[e+2]=s+2,t[e+3]=s+0,t[e+4]=s+2,t[e+5]=s+3}packIndex(t,e,s,i){const n=t.indices,o=t.indexSize,a=t.indexOffset,u=t.attributeOffset;for(let l=0;l<o;l++)e[s++]=i+n[l+a]-u}destroy(){for(let t=0;t<this.batches.length;t++)Zd(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};Qd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Jd=Qd;var $=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))($||{});class yt extends Ct{constructor(t){let{data:e,size:s}=t;const{usage:i,label:n,shrinkToFit:o}=t;super(),this.uid=Y("buffer"),this._resourceType="buffer",this._resourceId=Y("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,s!=null||(s=e==null?void 0:e.byteLength);const a=!!e;this.descriptor={size:s,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=o!=null?o:!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&$.STATIC)}set static(t){t?this.descriptor.usage|=$.STATIC:this.descriptor.usage&=~$.STATIC}setDataWithSize(t,e,s){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){s&&this.emit("update",this);return}const i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength<i.byteLength?s&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Y("resource"),this.emit("change",this));return}s&&this.emit("update",this)}update(t){this._updateSize=t!=null?t:this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function Uo(r,t){if(!(r instanceof yt)){let e=t?$.INDEX:$.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=$.INDEX|$.COPY_DST):(r=new Float32Array(r),e=$.VERTEX|$.COPY_DST)),r=new yt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}function tp(r,t,e){const s=r.getAttribute(t);if(!s)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const i=s.buffer.data;let n=1/0,o=1/0,a=-1/0,u=-1/0;const l=i.BYTES_PER_ELEMENT,c=(s.offset||0)/l,h=(s.stride||2*4)/l;for(let d=c;d<i.length;d+=h){const p=i[d],f=i[d+1];p>a&&(a=p),f>u&&(u=f),p<n&&(n=p),f<o&&(o=f)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=u,e}function W1(r){return(r instanceof yt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Uo(r.buffer,!1),r}class Fe extends Ct{constructor(t={}){var e;super(),this.uid=Y("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new nt,this._boundsDirty=!0;const{attributes:s,indexBuffer:i,topology:n}=t;if(this.buffers=[],this.attributes={},s)for(const o in s)this.addAttribute(o,s[o]);this.instanceCount=(e=t.instanceCount)!=null?e:1,i&&this.addIndex(i),this.topology=n||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const s=W1(e);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=s}addIndex(t){this.indexBuffer=Uo(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,tp(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Y1=new Float32Array(1),q1=new Uint32Array(1);class ep extends Fe{constructor(){const t=new yt({data:Y1,label:"attribute-batch-buffer",usage:$.VERTEX|$.COPY_DST,shrinkToFit:!1}),e=new yt({data:q1,label:"index-batch-buffer",usage:$.INDEX|$.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:s,offset:0},aUV:{buffer:t,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:e})}}const ko=Object.create(null),rp=Object.create(null);function or(r,t){let e=rp[r];return e===void 0&&(ko[t]===void 0&&(ko[t]=1),rp[r]=e=ko[t]++),e}let mi;function sp(){if(!mi){mi="mediump";const r=Go();r&&r.getShaderPrecisionFormat&&(mi=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return mi}function ip(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
#ifdef GL_ES // This checks if it is WebGL1
#define in varying
#define finalColor gl_FragColor
#define texture texture2D
#endif
${r}
`):`
#ifdef GL_ES // This checks if it is WebGL1
#define in attribute
#define out varying
#endif
${r}
`}function np(r,t,e){const s=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let i=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return i==="highp"&&s!=="highp"&&(i="mediump"),`precision ${i} float;
${r}`}else if(s!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function op(r,t){return t?`#version 300 es
${r}`:r}const K1={},Z1={};function ap(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const s=e?K1:Z1;return s[t]?(s[t]++,t+=`-${s[t]}`):s[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
${r}`}function up(r,t){return t?r.replace("#version 300 es",""):r}var Q1=Object.defineProperty,lp=Object.getOwnPropertySymbols,J1=Object.prototype.hasOwnProperty,tT=Object.prototype.propertyIsEnumerable,cp=(r,t,e)=>t in r?Q1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hp=(r,t)=>{for(var e in t||(t={}))J1.call(t,e)&&cp(r,e,t[e]);if(lp)for(var e of lp(t))tT.call(t,e)&&cp(r,e,t[e]);return r};const Lo={stripVersion:up,ensurePrecision:np,addProgramDefines:ip,setProgramName:ap,insertVersion:op},No=Object.create(null),dp=class fc{constructor(t){t=hp(hp({},fc.defaultOptions),t);const e=t.fragment.indexOf("#version 300 es")!==-1,s={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:sp()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let i=t.fragment,n=t.vertex;Object.keys(Lo).forEach(o=>{const a=s[o];i=Lo[o](i,a,!0),n=Lo[o](n,a,!1)}),this.fragment=i,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=or(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return No[e]||(No[e]=new fc(t)),No[e]}};dp.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Rt=dp;const pp={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function ue(r){var t;return(t=pp[r])!=null?t:pp.float32}const eT={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};function fp({source:r,entryPoint:t}){var e;const s={},i=r.indexOf(`fn ${t}`);if(i!==-1){const n=r.indexOf("->",i);if(n!==-1){const o=r.substring(i,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let u;for(;(u=a.exec(o))!==null;){const l=(e=eT[u[3]])!=null?e:"float32";s[u[2]]={location:parseInt(u[1],10),format:l,stride:ue(l).stride,offset:0,instance:!1,start:0}}}}return s}function gi(r){var t,e,s;const i=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,o=/@binding\((\d+)\)/,a=/var(<[^>]+>)? (\w+)/,u=/:\s*(\w+)/,l=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,d=(t=r.match(i))==null?void 0:t.map(f=>({group:parseInt(f.match(n)[1],10),binding:parseInt(f.match(o)[1],10),name:f.match(a)[2],isUniform:f.match(a)[1]==="<uniform>",type:f.match(u)[1]}));if(!d)return{groups:[],structs:[]};const p=(s=(e=r.match(l))==null?void 0:e.map(f=>{const g=f.match(h)[1],m=f.match(c).reduce((_,b)=>{const[x,v]=b.split(":");return _[x.trim()]=v.trim(),_},{});return m?{name:g,members:m}:null}).filter(({name:f})=>d.some(g=>g.type===f)))!=null?s:[];return{groups:d,structs:p}}var ar=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(ar||{});function mp({groups:r}){const t=[];for(let e=0;e<r.length;e++){const s=r[e];t[s.group]||(t[s.group]=[]),s.isUniform?t[s.group].push({binding:s.binding,visibility:ar.VERTEX|ar.FRAGMENT,buffer:{type:"uniform"}}):s.type==="sampler"?t[s.group].push({binding:s.binding,visibility:ar.FRAGMENT,sampler:{type:"filtering"}}):s.type==="texture_2d"&&t[s.group].push({binding:s.binding,visibility:ar.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}function gp({groups:r}){const t=[];for(let e=0;e<r.length;e++){const s=r[e];t[s.group]||(t[s.group]={}),t[s.group][s.name]=s.binding}return t}function _p(r,t){const e=new Set,s=new Set,i=[...r.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...r.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return s.has(a)?!1:(s.add(a),!0)});return{structs:i,groups:n}}const $o=Object.create(null);class Et{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var e,s;const{fragment:i,vertex:n,layout:o,gpuLayout:a,name:u}=t;if(this.name=u,this.fragment=i,this.vertex=n,i.source===n.source){const l=gi(i.source);this.structsAndGroups=l}else{const l=gi(n.source),c=gi(i.source);this.structsAndGroups=_p(l,c)}this.layout=o!=null?o:gp(this.structsAndGroups),this.gpuLayout=a!=null?a:mp(this.structsAndGroups),this.autoAssignGlobalUniforms=((e=this.layout[0])==null?void 0:e.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((s=this.layout[1])==null?void 0:s.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,s=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=or(s,"program")}get attributeData(){var t;return(t=this._attributeData)!=null||(this._attributeData=fp(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return $o[e]||($o[e]=new Et(t)),$o[e]}}function Xo(r,t,e){if(r)for(const s in r){const i=s.toLocaleLowerCase(),n=t[i];if(n){let o=r[s];s==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}}}const rT=/\{\{(.*?)\}\}/g;function Ho(r){var t,e;const s={};return((e=(t=r.match(rT))==null?void 0:t.map(i=>i.replace(/[{()}]/g,"")))!=null?e:[]).forEach(i=>{s[i]=[]}),s}function xp(r,t){let e;const s=/@in\s+([^;]+);/g;for(;(e=s.exec(r))!==null;)t.push(e[1])}function zo(r,t,e=!1){const s=[];xp(t,s),r.forEach(a=>{a.header&&xp(a.header,s)});const i=s;e&&i.sort();const n=i.map((a,u)=>` @location(${u}) ${a},`).join(`
`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
${n}
`),o}function bp(r,t){let e;const s=/@out\s+([^;]+);/g;for(;(e=s.exec(r))!==null;)t.push(e[1])}function sT(r){const t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function iT(r){const t=/@.*?\s+/g;return r.replace(t,"")}function yp(r,t){const e=[];bp(t,e),r.forEach(u=>{u.header&&bp(u.header,e)});let s=0;const i=e.sort().map(u=>u.indexOf("builtin")>-1?u:`@location(${s++}) ${u}`).join(`,
`),n=e.sort().map(u=>` var ${iT(u)};`).join(`
`),o=`return VSOutput(
${e.sort().map(u=>` ${sT(u)}`).join(`,
`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
${i}
`),a=a.replace("{{start}}",`
${n}
`),a=a.replace("{{return}}",`
${o}
`),a}function jo(r,t){let e=r;for(const s in t){const i=t[s];i.join(`
`).length?e=e.replace(`{{${s}}}`,`//-----${s} START-----//
${i.join(`
`)}
//----${s} FINISH----//`):e=e.replace(`{{${s}}}`,"")}return e}const Ie=Object.create(null),Vo=new Map;let nT=0;function vp({template:r,bits:t}){const e=Ap(r,t);if(Ie[e])return Ie[e];const{vertex:s,fragment:i}=oT(r,t);return Ie[e]=Sp(s,i,t),Ie[e]}function Tp({template:r,bits:t}){const e=Ap(r,t);return Ie[e]||(Ie[e]=Sp(r.vertex,r.fragment,t)),Ie[e]}function oT(r,t){const e=t.map(o=>o.vertex).filter(o=>!!o),s=t.map(o=>o.fragment).filter(o=>!!o);let i=zo(e,r.vertex,!0);i=yp(e,i);const n=zo(s,r.fragment,!0);return{vertex:i,fragment:n}}function Ap(r,t){return t.map(e=>(Vo.has(e)||Vo.set(e,nT++),Vo.get(e))).sort((e,s)=>e-s).join("-")+r.vertex+r.fragment}function Sp(r,t,e){const s=Ho(r),i=Ho(t);return e.forEach(n=>{Xo(n.vertex,s,n.name),Xo(n.fragment,i,n.name)}),{vertex:jo(r,s),fragment:jo(t,i)}}const Ep=`
@in aPosition: vec2<f32>;
@in aUV: vec2<f32>;
@out @builtin(position) vPosition: vec4<f32>;
@out vUV : vec2<f32>;
@out vColor : vec4<f32>;
{{header}}
struct VSOutput {
{{struct}}
};
@vertex
fn main( {{in}} ) -> VSOutput {
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
var modelMatrix = mat3x3<f32>(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
var position = aPosition;
var uv = aUV;
{{start}}
vColor = vec4<f32>(1., 1., 1., 1.);
{{main}}
vUV = uv;
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
vColor *= globalUniforms.uWorldColorAlpha;
{{end}}
{{return}}
};
`,wp=`
@in vUV : vec2<f32>;
@in vColor : vec4<f32>;
{{header}}
@fragment
fn main(
{{in}}
) -> @location(0) vec4<f32> {
{{start}}
var outColor:vec4<f32>;
{{main}}
var finalColor:vec4<f32> = outColor * vColor;
{{end}}
return finalColor;
};
`,Cp=`
in vec2 aPosition;
in vec2 aUV;
out vec4 vColor;
out vec2 vUV;
{{header}}
void main(void){
mat3 worldTransformMatrix = uWorldTransformMatrix;
mat3 modelMatrix = mat3(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
vec2 position = aPosition;
vec2 uv = aUV;
{{start}}
vColor = vec4(1.);
{{main}}
vUV = uv;
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= uWorldColorAlpha;
{{end}}
}
`,Rp=`
in vec4 vColor;
in vec2 vUV;
out vec4 finalColor;
{{header}}
void main(void) {
{{start}}
vec4 outColor;
{{main}}
finalColor = outColor * vColor;
{{end}}
}
`,Pp={name:"global-uniforms-bit",vertex:{header:`
struct GlobalUniforms {
uProjectionMatrix:mat3x3<f32>,
uWorldTransformMatrix:mat3x3<f32>,
uWorldColorAlpha: vec4<f32>,
uResolution: vec2<f32>,
}
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
`}},aT={name:"global-uniforms-ubo-bit",vertex:{header:`
uniform globalUniforms {
mat3 uProjectionMatrix;
mat3 uWorldTransformMatrix;
vec4 uWorldColorAlpha;
vec2 uResolution;
};
`}},Dp={name:"global-uniforms-bit",vertex:{header:`
uniform mat3 uProjectionMatrix;
uniform mat3 uWorldTransformMatrix;
uniform vec4 uWorldColorAlpha;
uniform vec2 uResolution;
`}};var uT=Object.defineProperty,Mp=Object.getOwnPropertySymbols,lT=Object.prototype.hasOwnProperty,cT=Object.prototype.propertyIsEnumerable,Op=(r,t,e)=>t in r?uT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hT=(r,t)=>{for(var e in t||(t={}))lT.call(t,e)&&Op(r,e,t[e]);if(Mp)for(var e of Mp(t))cT.call(t,e)&&Op(r,e,t[e]);return r};function ur({bits:r,name:t}){const e=vp({template:{fragment:wp,vertex:Ep},bits:[Pp,...r]});return Et.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function lr({bits:r,name:t}){return new Rt(hT({name:t},Tp({template:{vertex:Cp,fragment:Rp},bits:[Dp,...r]})))}const _i={name:"color-bit",vertex:{header:`
@in aColor: vec4<f32>;
`,main:`
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
`}},xi={name:"color-bit",vertex:{header:`
in vec4 aColor;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}},Wo={};function dT(r){const t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let s=0;s<r;s++)t.push(`@group(1) @binding(${e++}) var textureSource${s+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${s+1}: sampler;`)}return t.join(`
`)}function pT(r){const t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
`)}function bi(r){return Wo[r]||(Wo[r]={name:"texture-batch-bit",vertex:{header:`
@in aTextureIdAndRound: vec2<u32>;
@out @interpolate(flat) vTextureId : u32;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1)
{
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
@in @interpolate(flat) vTextureId: u32;
${dT(r)}
`,main:`
var uvDx = dpdx(vUV);
var uvDy = dpdy(vUV);
${pT(r)}
`}}),Wo[r]}const Yo={};function fT(r){const t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
`)}function yi(r){return Yo[r]||(Yo[r]={name:"texture-batch-bit",vertex:{header:`
in vec2 aTextureIdAndRound;
out float vTextureId;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`},fragment:{header:`
in float vTextureId;
uniform sampler2D uTextures[${r}];
`,main:`
${fT(r)}
`}}),Yo[r]}const cr={name:"round-pixels-bit",vertex:{header:`
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}},hr={name:"round-pixels-bit",vertex:{header:`
vec2 roundPixels(vec2 position, vec2 targetSize)
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}},qo=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Bp=qo.reduce((r,t)=>(r[t]=!0,r),{});function Gp(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var mT=Object.defineProperty,Fp=Object.getOwnPropertySymbols,gT=Object.prototype.hasOwnProperty,_T=Object.prototype.propertyIsEnumerable,Ip=(r,t,e)=>t in r?mT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Up=(r,t)=>{for(var e in t||(t={}))gT.call(t,e)&&Ip(r,e,t[e]);if(Fp)for(var e of Fp(t))_T.call(t,e)&&Ip(r,e,t[e]);return r};const kp=class my{constructor(t,e){this._touched=0,this.uid=Y("uniform"),this._resourceType="uniformGroup",this._resourceId=Y("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1;var s,i;e=Up(Up({},my.defaultOptions),e),this.uniformStructures=t;const n={};for(const o in t){const a=t[o];if(a.name=o,a.size=(s=a.size)!=null?s:1,!Bp[a.type])throw new Error(`Uniform type ${a.type} is not supported. Supported uniform types are: ${qo.join(", ")}`);(i=a.value)!=null||(a.value=Gp(a.type,a.size)),n[o]=a.value}this.uniforms=n,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=or(Object.keys(n).map(o=>`${o}-${t[o].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};kp.defaultOptions={ubo:!1,isStatic:!1};let rt=kp;const Lp={};function vi(r){let t=Lp[r];if(t)return t;const e=new Int32Array(r);for(let s=0;s<r;s++)e[s]=s;return t=Lp[r]=new rt({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var vt=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(vt||{}),xT=Object.defineProperty,Ti=Object.getOwnPropertySymbols,Np=Object.prototype.hasOwnProperty,$p=Object.prototype.propertyIsEnumerable,Xp=(r,t,e)=>t in r?xT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,bT=(r,t)=>{for(var e in t||(t={}))Np.call(t,e)&&Xp(r,e,t[e]);if(Ti)for(var e of Ti(t))$p.call(t,e)&&Xp(r,e,t[e]);return r},yT=(r,t)=>{var e={};for(var s in r)Np.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Ti)for(var s of Ti(r))t.indexOf(s)<0&&$p.call(r,s)&&(e[s]=r[s]);return e};class Ot extends Ct{constructor(t){super(),this.uid=Y("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:s,groups:i,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=s,o===void 0&&(o=0,e&&(o|=vt.WEBGPU),s&&(o|=vt.WEBGL)),this.compatibleRenderers=o;const u={};if(!n&&!i&&(n={}),n&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&i&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&i&&a)for(const l in a)for(const c in a[l]){const h=a[l][c];u[h]={group:l,binding:c,name:h}}else if(e&&i&&!a){const l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,u[c.name]=c})}else if(n){i={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,u[c.name]=c});let l=0;for(const c in n)u[c]||(i[99]||(i[99]=new Zt,this._ownedBindGroups.push(i[99])),u[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(const c in n){const h=c;let d=n[c];!d.source&&!d._resourceType&&(d=new rt(d));const p=u[h];p&&(i[p.group]||(i[p.group]=new Zt,this._ownedBindGroups.push(i[p.group])),i[p.group].setResource(d,p.binding))}}this.groups=i,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(i,u)}addResource(t,e,s){var i,n;(i=this._uniformBindMap)[e]||(i[e]={}),(n=this._uniformBindMap[e])[s]||(n[s]=t),this.groups[e]||(this.groups[e]=new Zt,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const s={};for(const i in e){const n=e[i];Object.defineProperty(s,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return s}destroy(t=!1){var e,s;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(s=this.glProgram)==null||s.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const e=t,{gpu:s,gl:i}=e,n=yT(e,["gpu","gl"]);let o,a;return s&&(o=Et.from(s)),i&&(a=Rt.from(i)),new Ot(bT({gpuProgram:o,glProgram:a},n))}}class Hp extends Ot{constructor(t){const e=lr({name:"batch",bits:[xi,yi(t),hr]}),s=ur({name:"batch",bits:[_i,bi(t),cr]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:vi(t)}})}}let Ko=null;const zp=class gy extends Jd{constructor(t){super(t),this.geometry=new ep,this.name=gy.extension.name,this.vertexSize=6,Ko!=null||(Ko=new Hp(t.maxTextures)),this.shader=Ko}packAttributes(t,e,s,i,n){const o=n<<16|t.roundPixels&65535,a=t.transform,u=a.a,l=a.b,c=a.c,h=a.d,d=a.tx,p=a.ty,{positions:f,uvs:g}=t,m=t.color,_=t.attributeOffset,b=_+t.attributeSize;for(let x=_;x<b;x++){const v=x*2,A=f[v],T=f[v+1];e[i++]=u*A+c*T+d,e[i++]=h*T+l*A+p,e[i++]=g[v],e[i++]=g[v+1],s[i++]=m,s[i++]=o}}packQuadAttributes(t,e,s,i,n){const o=t.texture,a=t.transform,u=a.a,l=a.b,c=a.c,h=a.d,d=a.tx,p=a.ty,f=t.bounds,g=f.maxX,m=f.minX,_=f.maxY,b=f.minY,x=o.uvs,v=t.color,A=n<<16|t.roundPixels&65535;e[i+0]=u*m+c*b+d,e[i+1]=h*b+l*m+p,e[i+2]=x.x0,e[i+3]=x.y0,s[i+4]=v,s[i+5]=A,e[i+6]=u*g+c*b+d,e[i+7]=h*b+l*g+p,e[i+8]=x.x1,e[i+9]=x.y1,s[i+10]=v,s[i+11]=A,e[i+12]=u*g+c*_+d,e[i+13]=h*_+l*g+p,e[i+14]=x.x2,e[i+15]=x.y2,s[i+16]=v,s[i+17]=A,e[i+18]=u*m+c*_+d,e[i+19]=h*_+l*m+p,e[i+20]=x.x3,e[i+21]=x.y3,s[i+22]=v,s[i+23]=A}};zp.extension={type:[y.Batcher],name:"default"};let Ai=zp;function jp(r,t,e,s,i,n,o,a=null){let u=0;e*=t,i*=n;const l=a.a,c=a.b,h=a.c,d=a.d,p=a.tx,f=a.ty;for(;u<o;){const g=r[e],m=r[e+1];s[i]=l*g+h*m+p,s[i+1]=c*g+d*m+f,i+=n,e+=t,u++}}function Vp(r,t,e,s){let i=0;for(t*=e;i<s;)r[t]=0,r[t+1]=0,t+=e,i++}function Zo(r,t,e,s,i){const n=t.a,o=t.b,a=t.c,u=t.d,l=t.tx,c=t.ty;e||(e=0),s||(s=2),i||(i=r.length/s-e);let h=e*s;for(let d=0;d<i;d++){const p=r[h],f=r[h+1];r[h]=n*p+a*f+l,r[h+1]=o*p+u*f+c,h+=s}}const vT=new D;class Si{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,s=this.renderable;return s?yo(e,s.groupColor)+(this.alpha*s.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||vT}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}var TT=Object.defineProperty,AT=Object.defineProperties,ST=Object.getOwnPropertyDescriptors,Wp=Object.getOwnPropertySymbols,ET=Object.prototype.hasOwnProperty,wT=Object.prototype.propertyIsEnumerable,Yp=(r,t,e)=>t in r?TT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ei=(r,t)=>{for(var e in t||(t={}))ET.call(t,e)&&Yp(r,e,t[e]);if(Wp)for(var e of Wp(t))wT.call(t,e)&&Yp(r,e,t[e]);return r},wi=(r,t)=>AT(r,ST(t));const dr={extension:{type:y.ShapeBuilder,name:"circle"},build(r,t){let e,s,i,n,o,a;if(r.type==="circle"){const v=r;if(o=a=v.radius,o<=0)return!1;e=v.x,s=v.y,i=n=0}else if(r.type==="ellipse"){const v=r;if(o=v.halfWidth,a=v.halfHeight,o<=0||a<=0)return!1;e=v.x,s=v.y,i=n=0}else{const v=r,A=v.width/2,T=v.height/2;e=v.x+A,s=v.y+T,o=a=Math.max(0,Math.min(v.radius,Math.min(A,T))),i=A-o,n=T-a}if(i<0||n<0)return!1;const u=Math.ceil(2.3*Math.sqrt(o+a)),l=u*8+(i?4:0)+(n?4:0);if(l===0)return!1;if(u===0)return t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n,!0;let c=0,h=u*4+(i?2:0)+2,d=h,p=l,f=i+o,g=n,m=e+f,_=e-f,b=s+g;if(t[c++]=m,t[c++]=b,t[--h]=b,t[--h]=_,n){const v=s-g;t[d++]=_,t[d++]=v,t[--p]=v,t[--p]=m}for(let v=1;v<u;v++){const A=Math.PI/2*(v/u),T=i+Math.cos(A)*o,S=n+Math.sin(A)*a,B=e+T,P=e-T,C=s+S,E=s-S;t[c++]=B,t[c++]=C,t[--h]=C,t[--h]=P,t[d++]=P,t[d++]=E,t[--p]=E,t[--p]=B}f=i,g=n+a,m=e+f,_=e-f,b=s+g;const x=s-g;return t[c++]=m,t[c++]=b,t[--p]=x,t[--p]=m,i&&(t[c++]=_,t[c++]=b,t[--p]=x,t[--p]=_),!0},triangulate(r,t,e,s,i,n){if(r.length===0)return;let o=0,a=0;for(let c=0;c<r.length;c+=2)o+=r[c],a+=r[c+1];o/=r.length/2,a/=r.length/2;let u=s;t[u*e]=o,t[u*e+1]=a;const l=u++;for(let c=0;c<r.length;c+=2)t[u*e]=r[c],t[u*e+1]=r[c+1],c>0&&(i[n++]=u,i[n++]=l,i[n++]=u-1),u++;i[n++]=l+1,i[n++]=l,i[n++]=u-1}},qp=wi(Ei({},dr),{extension:wi(Ei({},dr.extension),{name:"ellipse"})}),Kp=wi(Ei({},dr),{extension:wi(Ei({},dr.extension),{name:"roundedRectangle"})}),Qo=1e-4,Jo=1e-4;function Zp(r){const t=r.length;if(t<6)return 1;let e=0;for(let s=0,i=r[t-2],n=r[t-1];s<t;s+=2){const o=r[s],a=r[s+1];e+=(o-i)*(a+n),i=o,n=a}return e<0?-1:1}function Qp(r,t,e,s,i,n,o,a){const u=r-e*i,l=t-s*i,c=r+e*n,h=t+s*n;let d,p;o?(d=s,p=-e):(d=-s,p=e);const f=u+d,g=l+p,m=c+d,_=h+p;return a.push(f,g),a.push(m,_),2}function Ue(r,t,e,s,i,n,o,a){const u=e-r,l=s-t;let c=Math.atan2(u,l),h=Math.atan2(i-r,n-t);a&&c<h?c+=Math.PI*2:!a&&c>h&&(h+=Math.PI*2);let d=c;const p=h-c,f=Math.abs(p),g=Math.sqrt(u*u+l*l),m=(15*f*Math.sqrt(g)/Math.PI>>0)+1,_=p/m;if(d+=_,a){o.push(r,t),o.push(e,s);for(let b=1,x=d;b<m;b++,x+=_)o.push(r,t),o.push(r+Math.sin(x)*g,t+Math.cos(x)*g);o.push(r,t),o.push(i,n)}else{o.push(e,s),o.push(r,t);for(let b=1,x=d;b<m;b++,x+=_)o.push(r+Math.sin(x)*g,t+Math.cos(x)*g),o.push(r,t);o.push(i,n),o.push(r,t)}return m*2}function Jp(r,t,e,s,i,n){const o=Qo;if(r.length===0)return;const a=t;let u=a.alignment;if(t.alignment!==.5){let W=Zp(r);e&&(W*=-1),u=(u-.5)*W+.5}const l=new it(r[0],r[1]),c=new it(r[r.length-2],r[r.length-1]),h=s,d=Math.abs(l.x-c.x)<o&&Math.abs(l.y-c.y)<o;if(h){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));const W=(l.x+c.x)*.5,fe=(c.y+l.y)*.5;r.unshift(W,fe),r.push(W,fe)}const p=i,f=r.length/2;let g=r.length;const m=p.length/2,_=a.width/2,b=_*_,x=a.miterLimit*a.miterLimit;let v=r[0],A=r[1],T=r[2],S=r[3],B=0,P=0,C=-(A-S),E=v-T,G=0,U=0,k=Math.sqrt(C*C+E*E);C/=k,E/=k,C*=_,E*=_;const Bt=u,R=(1-Bt)*2,M=Bt*2;h||(a.cap==="round"?g+=Ue(v-C*(R-M)*.5,A-E*(R-M)*.5,v-C*R,A-E*R,v+C*M,A+E*M,p,!0)+2:a.cap==="square"&&(g+=Qp(v,A,C,E,R,M,!0,p))),p.push(v-C*R,A-E*R),p.push(v+C*M,A+E*M);for(let W=1;W<f-1;++W){v=r[(W-1)*2],A=r[(W-1)*2+1],T=r[W*2],S=r[W*2+1],B=r[(W+1)*2],P=r[(W+1)*2+1],C=-(A-S),E=v-T,k=Math.sqrt(C*C+E*E),C/=k,E/=k,C*=_,E*=_,G=-(S-P),U=T-B,k=Math.sqrt(G*G+U*U),G/=k,U/=k,G*=_,U*=_;const fe=T-v,Mr=A-S,Or=T-B,Br=P-S,Ac=fe*Or+Mr*Br,ks=Mr*Or-Br*fe,Gr=ks<0;if(Math.abs(ks)<.001*Math.abs(Ac)){p.push(T-C*R,S-E*R),p.push(T+C*M,S+E*M),Ac>=0&&(a.join==="round"?g+=Ue(T,S,T-C*R,S-E*R,T-G*R,S-U*R,p,!1)+4:g+=2,p.push(T-G*M,S-U*M),p.push(T+G*R,S+U*R));continue}const Sc=(-C+v)*(-E+S)-(-C+T)*(-E+A),Ec=(-G+B)*(-U+S)-(-G+T)*(-U+P),Ls=(fe*Ec-Or*Sc)/ks,Ns=(Br*Sc-Mr*Ec)/ks,Nn=(Ls-T)*(Ls-T)+(Ns-S)*(Ns-S),Se=T+(Ls-T)*R,Ee=S+(Ns-S)*R,we=T-(Ls-T)*M,Ce=S-(Ns-S)*M,$y=Math.min(fe*fe+Mr*Mr,Or*Or+Br*Br),wc=Gr?R:M,Xy=$y+wc*wc*b;Nn<=Xy?a.join==="bevel"||Nn/b>x?(Gr?(p.push(Se,Ee),p.push(T+C*M,S+E*M),p.push(Se,Ee),p.push(T+G*M,S+U*M)):(p.push(T-C*R,S-E*R),p.push(we,Ce),p.push(T-G*R,S-U*R),p.push(we,Ce)),g+=2):a.join==="round"?Gr?(p.push(Se,Ee),p.push(T+C*M,S+E*M),g+=Ue(T,S,T+C*M,S+E*M,T+G*M,S+U*M,p,!0)+4,p.push(Se,Ee),p.push(T+G*M,S+U*M)):(p.push(T-C*R,S-E*R),p.push(we,Ce),g+=Ue(T,S,T-C*R,S-E*R,T-G*R,S-U*R,p,!1)+4,p.push(T-G*R,S-U*R),p.push(we,Ce)):(p.push(Se,Ee),p.push(we,Ce)):(p.push(T-C*R,S-E*R),p.push(T+C*M,S+E*M),a.join==="round"?Gr?g+=Ue(T,S,T+C*M,S+E*M,T+G*M,S+U*M,p,!0)+2:g+=Ue(T,S,T-C*R,S-E*R,T-G*R,S-U*R,p,!1)+2:a.join==="miter"&&Nn/b<=x&&(Gr?(p.push(we,Ce),p.push(we,Ce)):(p.push(Se,Ee),p.push(Se,Ee)),g+=2),p.push(T-G*R,S-U*R),p.push(T+G*M,S+U*M),g+=2)}v=r[(f-2)*2],A=r[(f-2)*2+1],T=r[(f-1)*2],S=r[(f-1)*2+1],C=-(A-S),E=v-T,k=Math.sqrt(C*C+E*E),C/=k,E/=k,C*=_,E*=_,p.push(T-C*R,S-E*R),p.push(T+C*M,S+E*M),h||(a.cap==="round"?g+=Ue(T-C*(R-M)*.5,S-E*(R-M)*.5,T-C*R,S-E*R,T+C*M,S+E*M,p,!1)+2:a.cap==="square"&&(g+=Qp(T,S,C,E,R,M,!1,p)));const je=Jo*Jo;for(let W=m;W<g+m-2;++W)v=p[W*2],A=p[W*2+1],T=p[(W+1)*2],S=p[(W+1)*2+1],B=p[(W+2)*2],P=p[(W+2)*2+1],!(Math.abs(v*(S-P)+T*(P-A)+B*(A-S))<je)&&n.push(W,W+1,W+2)}function tf(r,t,e,s){const i=Qo;if(r.length===0)return;const n=r[0],o=r[1],a=r[r.length-2],u=r[r.length-1],l=t||Math.abs(n-a)<i&&Math.abs(o-u)<i,c=e,h=r.length/2,d=c.length/2;for(let p=0;p<h;p++)c.push(r[p*2]),c.push(r[p*2+1]);for(let p=0;p<h-1;p++)s.push(d+p,d+p+1);l&&s.push(d+h-1,d)}function ef(r,t,e=2){const s=t&&t.length,i=s?t[0]*e:r.length;let n=rf(r,0,i,e,!0);const o=[];if(!n||n.next===n.prev)return o;let a,u,l;if(s&&(n=MT(r,t,n,e)),r.length>80*e){a=1/0,u=1/0;let c=-1/0,h=-1/0;for(let d=e;d<i;d+=e){const p=r[d],f=r[d+1];p<a&&(a=p),f<u&&(u=f),p>c&&(c=p),f>h&&(h=f)}l=Math.max(c-a,h-u),l=l!==0?32767/l:0}return ss(n,o,e,a,u,l,0),o}function rf(r,t,e,s,i){let n;if(i===ra(r,t,e,s)>0)for(let o=t;o<e;o+=s)n=af(o/s|0,r[o],r[o+1],n);else for(let o=e-s;o>=t;o-=s)n=af(o/s|0,r[o],r[o+1],n);return n&&pr(n,n.next)&&(os(n),n=n.next),n}function ke(r,t){if(!r)return r;t||(t=r);let e=r,s;do if(s=!1,!e.steiner&&(pr(e,e.next)||K(e.prev,e,e.next)===0)){if(os(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function ss(r,t,e,s,i,n,o){if(!r)return;!o&&n&&IT(r,s,i,n);let a=r;for(;r.prev!==r.next;){const u=r.prev,l=r.next;if(n?RT(r,s,i,n):CT(r)){t.push(u.i,r.i,l.i),os(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=PT(ke(r),t),ss(r,t,e,s,i,n,2)):o===2&&DT(r,t,e,s,i,n):ss(ke(r),t,e,s,i,n,1);break}}}function CT(r){const t=r.prev,e=r,s=r.next;if(K(t,e,s)>=0)return!1;const i=t.x,n=e.x,o=s.x,a=t.y,u=e.y,l=s.y,c=Math.min(i,n,o),h=Math.min(a,u,l),d=Math.max(i,n,o),p=Math.max(a,u,l);let f=s.next;for(;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&is(i,a,n,u,o,l,f.x,f.y)&&K(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function RT(r,t,e,s){const i=r.prev,n=r,o=r.next;if(K(i,n,o)>=0)return!1;const a=i.x,u=n.x,l=o.x,c=i.y,h=n.y,d=o.y,p=Math.min(a,u,l),f=Math.min(c,h,d),g=Math.max(a,u,l),m=Math.max(c,h,d),_=ta(p,f,t,e,s),b=ta(g,m,t,e,s);let x=r.prevZ,v=r.nextZ;for(;x&&x.z>=_&&v&&v.z<=b;){if(x.x>=p&&x.x<=g&&x.y>=f&&x.y<=m&&x!==i&&x!==o&&is(a,c,u,h,l,d,x.x,x.y)&&K(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=g&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&is(a,c,u,h,l,d,v.x,v.y)&&K(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=_;){if(x.x>=p&&x.x<=g&&x.y>=f&&x.y<=m&&x!==i&&x!==o&&is(a,c,u,h,l,d,x.x,x.y)&&K(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=b;){if(v.x>=p&&v.x<=g&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&is(a,c,u,h,l,d,v.x,v.y)&&K(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function PT(r,t){let e=r;do{const s=e.prev,i=e.next.next;!pr(s,i)&&nf(s,e,e.next,i)&&ns(s,i)&&ns(i,s)&&(t.push(s.i,e.i,i.i),os(e),os(e.next),e=r=i),e=e.next}while(e!==r);return ke(e)}function DT(r,t,e,s,i,n){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&<(o,a)){let u=of(o,a);o=ke(o,o.next),u=ke(u,u.next),ss(o,t,e,s,i,n,0),ss(u,t,e,s,i,n,0);return}a=a.next}o=o.next}while(o!==r)}function MT(r,t,e,s){const i=[];for(let n=0,o=t.length;n<o;n++){const a=t[n]*s,u=n<o-1?t[n+1]*s:r.length,l=rf(r,a,u,s,!1);l===l.next&&(l.steiner=!0),i.push(kT(l))}i.sort(OT);for(let n=0;n<i.length;n++)e=BT(i[n],e);return e}function OT(r,t){let e=r.x-t.x;if(e===0&&(e=r.y-t.y,e===0)){const s=(r.next.y-r.y)/(r.next.x-r.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=s-i}return e}function BT(r,t){const e=GT(r,t);if(!e)return t;const s=of(e,r);return ke(s,s.next),ke(e,e.next)}function GT(r,t){let e=t;const s=r.x,i=r.y;let n=-1/0,o;if(pr(r,e))return e;do{if(pr(r,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=s&&h>n&&(n=h,o=e.x<e.next.x?e:e.next,h===s))return o}e=e.next}while(e!==t);if(!o)return null;const a=o,u=o.x,l=o.y;let c=1/0;e=o;do{if(s>=e.x&&e.x>=u&&s!==e.x&&sf(i<l?s:n,i,u,l,i<l?n:s,i,e.x,e.y)){const h=Math.abs(i-e.y)/(s-e.x);ns(e,r)&&(h<c||h===c&&(e.x>o.x||e.x===o.x&&FT(o,e)))&&(o=e,c=h)}e=e.next}while(e!==a);return o}function FT(r,t){return K(r.prev,r,t.prev)<0&&K(t.next,r,r.next)<0}function IT(r,t,e,s){let i=r;do i.z===0&&(i.z=ta(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,UT(i)}function UT(r){let t,e=1;do{let s=r,i;r=null;let n=null;for(t=0;s;){t++;let o=s,a=0;for(let l=0;l<e&&(a++,o=o.nextZ,!!o);l++);let u=e;for(;a>0||u>0&&o;)a!==0&&(u===0||!o||s.z<=o.z)?(i=s,s=s.nextZ,a--):(i=o,o=o.nextZ,u--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;s=o}n.nextZ=null,e*=2}while(t>1);return r}function ta(r,t,e,s,i){return r=(r-e)*i|0,t=(t-s)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function kT(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function sf(r,t,e,s,i,n,o,a){return(i-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(s-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(i-o)*(s-a)}function is(r,t,e,s,i,n,o,a){return!(r===o&&t===a)&&sf(r,t,e,s,i,n,o,a)}function LT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!NT(r,t)&&(ns(r,t)&&ns(t,r)&&$T(r,t)&&(K(r.prev,r,t.prev)||K(r,t.prev,t))||pr(r,t)&&K(r.prev,r,r.next)>0&&K(t.prev,t,t.next)>0)}function K(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function pr(r,t){return r.x===t.x&&r.y===t.y}function nf(r,t,e,s){const i=Ri(K(r,t,e)),n=Ri(K(r,t,s)),o=Ri(K(e,s,r)),a=Ri(K(e,s,t));return!!(i!==n&&o!==a||i===0&&Ci(r,e,t)||n===0&&Ci(r,s,t)||o===0&&Ci(e,r,s)||a===0&&Ci(e,t,s))}function Ci(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ri(r){return r>0?1:r<0?-1:0}function NT(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&nf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function ns(r,t){return K(r.prev,r,r.next)<0?K(r,t,r.next)>=0&&K(r,r.prev,t)>=0:K(r,t,r.prev)<0||K(r,r.next,t)<0}function $T(r,t){let e=r,s=!1;const i=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==r);return s}function of(r,t){const e=ea(r.i,r.x,r.y),s=ea(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function af(r,t,e,s){const i=ea(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function os(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ea(r,t,e){return{i:r,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ZD(r,t,e,s){const i=t&&t.length,n=i?t[0]*e:r.length;let o=Math.abs(ra(r,0,n,e));if(i)for(let u=0,l=t.length;u<l;u++){const c=t[u]*e,h=u<l-1?t[u+1]*e:r.length;o-=Math.abs(ra(r,c,h,e))}let a=0;for(let u=0;u<s.length;u+=3){const l=s[u]*e,c=s[u+1]*e,h=s[u+2]*e;a+=Math.abs((r[l]-r[h])*(r[c+1]-r[l+1])-(r[l]-r[c])*(r[h+1]-r[l+1]))}return o===0&&a===0?0:Math.abs((a-o)/o)}function ra(r,t,e,s){let i=0;for(let n=t,o=e-s;n<e;n+=s)i+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return i}function QD(r){const t=[],e=[],s=r[0][0].length;let i=0,n=0;for(const o of r){for(const a of o)for(let u=0;u<s;u++)t.push(a[u]);n&&(i+=n,e.push(i)),n=o.length}return{vertices:t,holes:e,dimensions:s}}const uf=ef.default||ef;function sa(r,t,e,s,i,n,o){const a=uf(r,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)n[o++]=a[l]+i,n[o++]=a[l+1]+i,n[o++]=a[l+2]+i;let u=i*s;for(let l=0;l<r.length;l+=2)e[u]=r[l],e[u+1]=r[l+1],u+=s}const XT=[],lf={extension:{type:y.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return!0},triangulate(r,t,e,s,i,n){sa(r,XT,t,e,s,i,n)}},cf={extension:{type:y.ShapeBuilder,name:"rectangle"},build(r,t){const e=r,s=e.x,i=e.y,n=e.width,o=e.height;return n>0&&o>0?(t[0]=s,t[1]=i,t[2]=s+n,t[3]=i,t[4]=s+n,t[5]=i+o,t[6]=s,t[7]=i+o,!0):!1},triangulate(r,t,e,s,i,n){let o=0;s*=e,t[s+o]=r[0],t[s+o+1]=r[1],o+=e,t[s+o]=r[2],t[s+o+1]=r[3],o+=e,t[s+o]=r[6],t[s+o+1]=r[7],o+=e,t[s+o]=r[4],t[s+o+1]=r[5],o+=e;const a=s/e;i[n++]=a,i[n++]=a+1,i[n++]=a+2,i[n++]=a+1,i[n++]=a+3,i[n++]=a+2}},hf={extension:{type:y.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,!0},triangulate(r,t,e,s,i,n){let o=0;s*=e,t[s+o]=r[0],t[s+o+1]=r[1],o+=e,t[s+o]=r[2],t[s+o+1]=r[3],o+=e,t[s+o]=r[4],t[s+o+1]=r[5];const a=s/e;i[n++]=a,i[n++]=a+1,i[n++]=a+2}};var HT=Object.defineProperty,df=Object.getOwnPropertySymbols,zT=Object.prototype.hasOwnProperty,jT=Object.prototype.propertyIsEnumerable,pf=(r,t,e)=>t in r?HT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ff=(r,t)=>{for(var e in t||(t={}))zT.call(t,e)&&pf(r,e,t[e]);if(df)for(var e of df(t))jT.call(t,e)&&pf(r,e,t[e]);return r};const mf=[{offset:0,color:"white"},{offset:1,color:"black"}],ia=class mc{constructor(...t){this.uid=Y("fillGradient"),this.type="linear",this.colorStops=[];var e;let s=VT(t);const i=s.type==="radial"?mc.defaultRadialOptions:mc.defaultLinearOptions;s=ff(ff({},i),Xt(s)),this._textureSize=s.textureSize,this._wrapMode=s.wrapMode,s.type==="radial"?(this.center=s.center,this.outerCenter=(e=s.outerCenter)!=null?e:this.center,this.innerRadius=s.innerRadius,this.outerRadius=s.outerRadius,this.scale=s.scale,this.rotation=s.rotation):(this.start=s.start,this.end=s.end),this.textureSpace=s.textureSpace,this.type=s.type,s.colorStops.forEach(n=>{this.addColorStop(n.offset,n.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:X.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:s,y:i}=this.end,n=s-t,o=i-e;const a=n<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){const m=t;t=s,s=m,n*=-1}if(o<0){const m=e;e=i,i=m,o*=-1}}const u=this.colorStops.length?this.colorStops:mf,l=this._textureSize,{canvas:c,context:h}=_f(l,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);gf(d,u),h.fillStyle=d,h.fillRect(0,0,l,1),this.texture=new w({source:new xe({resource:c,addressMode:this._wrapMode})});const p=Math.sqrt(n*n+o*o),f=Math.atan2(o,n),g=new D;g.scale(p/l,1),g.rotate(f),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:mf,e=this._textureSize,{canvas:s,context:i}=_f(e,e),{x:n,y:o}=this.center,{x:a,y:u}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,h=a-c,d=u-c,p=e/(c*2),f=(n-h)*p,g=(o-d)*p,m=i.createRadialGradient(f,g,l*p,(a-h)*p,(u-d)*p,c*p);gf(m,t),i.fillStyle=t[t.length-1].color,i.fillRect(0,0,e,e),i.fillStyle=m,i.translate(f,g),i.rotate(this.rotation),i.scale(1,this.scale),i.translate(-f,-g),i.fillRect(0,0,e,e),this.texture=new w({source:new xe({resource:s,addressMode:this._wrapMode})});const _=new D;_.scale(1/p,1/p),_.translate(h,d),this.textureSpace==="local"&&_.scale(e,e),this.transform=_}get styleKey(){return this.uid}destroy(){var t;(t=this.texture)==null||t.destroy(!0),this.texture=null}};ia.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},ia.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Qt=ia;function gf(r,t){for(let e=0;e<t.length;e++){const s=t[e];r.addColorStop(s.offset,s.color)}}function _f(r,t){const e=L.get().createCanvas(r,t),s=e.getContext("2d");return{canvas:e,context:s}}function VT(r){var t,e;let s=(t=r[0])!=null?t:{};return(typeof s=="number"||r[1])&&(s={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:(e=r[5])!=null?e:Qt.defaultLinearOptions.textureSize}),s}const WT=new D,YT=new z;function xf(r,t,e,s){const i=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){const o=e.getBounds(YT);t.width&&o.pad(t.width);const{x:a,y:u}=o,l=1/o.width,c=1/o.height,h=-a*l,d=-u*c,p=i.a,f=i.b,g=i.c,m=i.d;i.a*=l,i.b*=l,i.c*=c,i.d*=c,i.tx=h*p+d*g+i.tx,i.ty=h*f+d*m+i.ty}else i.translate(t.texture.frame.x,t.texture.frame.y),i.scale(1/t.texture.source.width,1/t.texture.source.height);const n=t.texture.source.style;return!(t.fill instanceof Qt)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),s&&i.append(WT.copyFrom(s).invert()),i}const as={};I.handleByMap(y.ShapeBuilder,as),I.add(cf,lf,hf,dr,qp,Kp);const qT=new z,KT=new D;function bf(r,t){const{geometryData:e,batches:s}=t;s.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let i=0;i<r.instructions.length;i++){const n=r.instructions[i];if(n.action==="texture")ZT(n.data,s,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,u=n.data.style,l=n.data.hole;o&&l&&yf(l.shapePath,u,!0,s,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),yf(a,u,o,s,e)}}}function ZT(r,t,e){const s=[],i=as.rectangle,n=qT;n.x=r.dx,n.y=r.dy,n.width=r.dw,n.height=r.dh;const o=r.transform;if(!i.build(n,s))return;const{vertices:a,uvs:u,indices:l}=e,c=l.length,h=a.length/2;o&&Zo(s,o),i.triangulate(s,a,2,h,l,c);const d=r.image,p=d.uvs;u.push(p.x0,p.y0,p.x1,p.y1,p.x3,p.y3,p.x2,p.y2);const f=ut.get(Si);f.indexOffset=c,f.indexSize=l.length-c,f.attributeOffset=h,f.attributeSize=a.length/2-h,f.baseColor=r.style,f.alpha=r.alpha,f.texture=d,f.geometryData=e,t.push(f)}function yf(r,t,e,s,i){const{vertices:n,uvs:o,indices:a}=i;r.shapePrimitives.forEach(({shape:u,transform:l,holes:c})=>{var h;const d=[],p=as[u.type];if(!p.build(u,d))return;const f=a.length,g=n.length/2;let m="triangle-list";if(l&&Zo(d,l),e){const v=(h=u.closePath)!=null?h:!0,A=t;A.pixelLine?(tf(d,v,n,a),m="line-list"):Jp(d,A,!1,v,n,a)}else if(c){const v=[],A=d.slice();QT(c).forEach(T=>{v.push(A.length/2),A.push(...T)}),sa(A,v,n,2,g,a,f)}else p.triangulate(d,n,2,g,a,f);const _=o.length/2,b=t.texture;if(b!==w.WHITE){const v=xf(KT,t,u,l);jp(n,2,g,o,_,2,n.length/2-g,v)}else Vp(o,_,2,n.length/2-g);const x=ut.get(Si);x.indexOffset=f,x.indexSize=a.length-f,x.attributeOffset=g,x.attributeSize=n.length/2-g,x.baseColor=t.color,x.alpha=t.alpha,x.texture=b,x.geometryData=i,x.topology=m,s.push(x)})}function QT(r){const t=[];for(let e=0;e<r.length;e++){const s=r[e].shape,i=[];as[s.type].build(s,i)&&t.push(i)}return t}class vf{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class Tf{constructor(){this.instructions=new To}init(t){this.batcher=new Ai({maxTextures:t}),this.instructions.reset()}get geometry(){return this.batcher.geometry}}const na=class gc{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){var e;gc.defaultOptions.bezierSmoothness=(e=t==null?void 0:t.bezierSmoothness)!=null?e:gc.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),bf(t,e);const s=t.batchMode;t.customShader||s==="no-batch"?e.isBatchable=!1:s==="auto"?e.isBatchable=e.geometryData.vertices.length<400:e.isBatchable=!0,t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){const e=ut.get(Tf,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:s,geometryData:i}=this._gpuContextHash[t.uid],n=i.vertices.length,o=i.indices.length;for(let c=0;c<s.length;c++)s[c].applyTransform=!1;const a=e.batcher;a.ensureAttributeBuffer(n),a.ensureIndexBuffer(o),a.begin();for(let c=0;c<s.length;c++){const h=s[c];a.add(h)}a.finish(e.instructions);const u=a.geometry;u.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),u.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);const l=a.batches;for(let c=0;c<l.length;c++){const h=l[c];h.bindGroup=pi(h.textures.textures,h.textures.count,this._renderer.limits.maxBatchableTextures)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new vf;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){const e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(ut.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(s=>{ut.return(s)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};na.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"graphicsContext"},na.defaultOptions={bezierSmoothness:.5};let Pi=na;const JT={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},oa=0,aa=1,ua=2,la=3,ca=4,ha=5,da=class _y{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<oa)}set blend(t){!!(this.data&1<<oa)!==t&&(this.data^=1<<oa)}get offsets(){return!!(this.data&1<<aa)}set offsets(t){!!(this.data&1<<aa)!==t&&(this.data^=1<<aa)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<ua)}set culling(t){!!(this.data&1<<ua)!==t&&(this.data^=1<<ua)}get depthTest(){return!!(this.data&1<<la)}set depthTest(t){!!(this.data&1<<la)!==t&&(this.data^=1<<la)}get depthMask(){return!!(this.data&1<<ha)}set depthMask(t){!!(this.data&1<<ha)!==t&&(this.data^=1<<ha)}get clockwiseFrontFace(){return!!(this.data&1<<ca)}set clockwiseFrontFace(t){!!(this.data&1<<ca)!==t&&(this.data^=1<<ca)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=JT[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new _y;return t.depthTest=!1,t.blend=!0,t}};da.default2d=da.for2d();let Pt=da;function tA(r,t,e,s){e[s++]=(r>>16&255)/255,e[s++]=(r>>8&255)/255,e[s++]=(r&255)/255,e[s++]=t}function fr(r,t,e){const s=(r>>24&255)/255;t[e++]=(r&255)/255*s,t[e++]=(r>>8&255)/255*s,t[e++]=(r>>16&255)/255*s,t[e++]=s}class Af{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{ut.return(t)}),this.batches.length=0}}class pa{constructor(t,e){this.state=Pt.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this)}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,s=!!t._gpuData,i=this.renderer.graphicsContext.updateGpuContext(e);return!!(i.isBatchable||s!==i.isBatchable)}addRenderable(t,e){const s=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),s.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._getGpuDataForRenderable(t).batches;for(let s=0;s<e.length;s++){const i=e[s];i._batcher.updateElement(i)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,s=t.context;if(!e.graphicsContext.getGpuContext(s).batches.length)return;const i=s.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const n=i.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,fr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),s=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),s.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const s=this.renderer.renderPipes.batch,i=this._getGpuDataForRenderable(t).batches;for(let n=0;n<i.length;n++){const o=i[n];s.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new Af;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){const s=t.context,i=this.renderer.graphicsContext.getGpuContext(s),n=this.renderer._roundPixels|t._roundPixels;e.batches=i.batches.map(o=>{const a=ut.get(Si);return o.copyTo(a),a.renderable=t,a.roundPixels=n,a})}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}pa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"graphics"},I.add(pa),I.add(Pi);class Di{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let s=e;const i=this.texture.textureMatrix;return i.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==i._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length<e.length)&&(s=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=i._updateID,this._uvUpdateId=t._updateID,i.multiplyUvs(e,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}class fa{destroy(){}}class ma{constructor(t,e){this.localUniforms=new rt({uTransformMatrix:{value:new D,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Zt({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=this._getMeshData(t),s=e.batched,i=t.batched;if(e.batched=i,s!==i)return!0;if(i){const n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;const o=this._getBatchableMesh(t);return o.texture.uid!==t._texture.uid&&(o._textureMatrixUpdateId=-1),!o._batcher.checkAndUpdateTexture(o,t._texture)}return!1}addRenderable(t,e){const s=this.renderer.renderPipes.batch,{batched:i}=this._getMeshData(t);if(i){const n=this._getBatchableMesh(t);n.setTexture(t._texture),n.geometry=t._geometry,s.addToBatch(n,e)}else s.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}execute(t){if(!t.isRenderable)return;t.state.blendMode=ir(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),fr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){var e,s;return(e=t._gpuData)[s=this.renderer.uid]||(e[s]=new fa),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){var e,s;return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:(e=t._geometry.indices)==null?void 0:e.length,vertexSize:(s=t._geometry.positions)==null?void 0:s.length},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,s;return(e=t._gpuData)[s=this.renderer.uid]||(e[s]=new fa),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=new Di;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}ma.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"mesh"},I.add(ma);class Sf{execute(t,e){const s=t.state,i=t.renderer,n=e.shader||t.defaultShader;n.resources.uTexture=e.texture._source,n.resources.uniforms=t.localUniforms;const o=i.gl,a=t.getBuffers(e);i.shader.bind(n),i.state.set(s),i.geometry.bind(a.geometry,n.glProgram);const u=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;o.drawElements(o.TRIANGLES,e.particleChildren.length*6,u,0)}}function ga(r,t=null){const e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,i=0;s<e;s+=6,i+=4)t[s+0]=i+0,t[s+1]=i+1,t[s+2]=i+2,t[s+3]=i+0,t[s+4]=i+2,t[s+5]=i+3;return t}function Ef(r){return{dynamicUpdate:wf(r,!0),staticUpdate:wf(r,!1)}}function wf(r,t){const e=[];e.push(`
var index = 0;
for (let i = 0; i < ps.length; ++i)
{
const p = ps[i];
`);let s=0;for(const n in r){const o=r[n];if(t!==o.dynamic)continue;e.push(`offset = index + ${s}`),e.push(o.code);const a=ue(o.format);s+=a.stride/4}e.push(`
index += stride * 4;
}
`),e.unshift(`
var stride = ${s};
`);const i=e.join(`
`);return new Function("ps","f32v","u32v",i)}class Cf{constructor(t){this._size=0,this._generateParticleUpdateCache={};var e;const s=this._size=(e=t.size)!=null?e:1e3,i=t.properties;let n=0,o=0;for(const h in i){const d=i[h],p=ue(d.format);d.dynamic?o+=p.stride:n+=p.stride}this._dynamicStride=o/4,this._staticStride=n/4,this.staticAttributeBuffer=new Ge(s*4*n),this.dynamicAttributeBuffer=new Ge(s*4*o),this.indexBuffer=ga(s);const a=new Fe;let u=0,l=0;this._staticBuffer=new yt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:$.VERTEX|$.COPY_DST}),this._dynamicBuffer=new yt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:$.VERTEX|$.COPY_DST});for(const h in i){const d=i[h],p=ue(d.format);d.dynamic?(a.addAttribute(d.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:u*4,format:d.format}),u+=p.size):(a.addAttribute(d.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:d.format}),l+=p.size)}a.addIndex(this.indexBuffer);const c=this.getParticleUpdate(i);this._dynamicUpload=c.dynamicUpdate,this._staticUpload=c.staticUpdate,this.geometry=a}getParticleUpdate(t){const e=eA(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Ef(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ge(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ge(this._size*this._dynamicStride*4*4),this.indexBuffer=ga(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const s=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,s.float32View,s.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){const i=this.staticAttributeBuffer;this._staticUpload(t,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}function eA(r){const t=[];for(const e in r){const s=r[e];t.push(e,s.code,s.dynamic?"d":"s")}return t.join("_")}var Rf=`varying vec2 vUV;
varying vec4 vColor;
uniform sampler2D uTexture;
void main(void){
vec4 color = texture2D(uTexture, vUV) * vColor;
gl_FragColor = color;
}`,Pf=`attribute vec2 aVertex;
attribute vec2 aUV;
attribute vec4 aColor;
attribute vec2 aPosition;
attribute float aRotation;
uniform mat3 uTranslationMatrix;
uniform float uRound;
uniform vec2 uResolution;
uniform vec4 uColor;
varying vec2 vUV;
varying vec4 vColor;
vec2 roundPixels(vec2 position, vec2 targetSize)
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
void main(void){
float cosRotation = cos(aRotation);
float sinRotation = sin(aRotation);
float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
vec2 v = vec2(x, y);
v = v + aPosition;
gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
if(uRound == 1.0)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
vUV = aUV;
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
}
`,_a=`
struct ParticleUniforms {
uProjectionMatrix:mat3x3<f32>,
uColor:vec4<f32>,
uResolution:vec2<f32>,
uRoundPixels:f32,
};
@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
@group(1) @binding(0) var uTexture: texture_2d<f32>;
@group(1) @binding(1) var uSampler : sampler;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
@location(1) color : vec4<f32>,
};
@vertex
fn mainVertex(
@location(0) aVertex: vec2<f32>,
@location(1) aPosition: vec2<f32>,
@location(2) aUV: vec2<f32>,
@location(3) aColor: vec4<f32>,
@location(4) aRotation: f32,
) -> VSOutput {
let v = vec2(
aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
) + aPosition;
let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;
return VSOutput(
position,
aUV,
vColor,
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@location(1) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
) -> @location(0) vec4<f32> {
var sample = textureSample(uTexture, uSampler, uv) * color;
return sample;
}`;class Df extends Ot{constructor(){const t=Rt.from({vertex:Pf,fragment:Rf}),e=Et.from({fragment:{source:_a,entryPoint:"mainFragment"},vertex:{source:_a,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:w.WHITE.source,uSampler:new Ft({}),uniforms:{uTranslationMatrix:{value:new D,type:"mat3x3<f32>"},uColor:{value:new X(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}class xa{constructor(t,e){this.state=Pt.for2d(),this.localUniforms=new rt({uTranslationMatrix:{value:new D,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Df,this.state=Pt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new Cf({size:t.particleChildren.length,properties:t._properties}),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){const e=t.particleChildren;if(e.length===0)return;const s=this.renderer,i=this.getBuffers(t);t.texture||(t.texture=e[0].texture);const n=this.state;i.update(e,t._childrenDirty),t._childrenDirty=!1,n.blendMode=ir(t.blendMode,t.texture._source);const o=this.localUniforms.uniforms,a=o.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(s.globalUniforms.globalUniformData.projectionMatrix),o.uResolution=s.globalUniforms.globalUniformData.resolution,o.uRound=s._roundPixels|t._roundPixels,fr(t.groupColorAlpha,o.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}class ba extends xa{constructor(t){super(t,new Sf)}}ba.extension={type:[y.WebGLPipes],name:"particle"};class Mf{execute(t,e){const s=t.renderer,i=e.shader||t.defaultShader;i.groups[0]=s.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),i.groups[1]=s.texture.getTextureBindGroup(e.texture);const n=t.state,o=t.getBuffers(e);s.encoder.draw({geometry:o.geometry,shader:e.shader||t.defaultShader,state:n,size:e.particleChildren.length*6})}}class ya extends xa{constructor(t){super(t,new Mf)}}ya.extension={type:[y.WebGPUPipes],name:"particle"},I.add(ba),I.add(ya);function Mi(r,t){const{texture:e,bounds:s}=r;mo(s,t._anchor,e);const i=t._style._getFinalPadding();s.minX-=i,s.minY-=i,s.maxX-=i,s.maxY-=i}class us{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){}}class Of extends us{constructor(t){super(),this._renderer=t,t.runners.resolutionChange.add(this)}resolutionChange(){const t=this.renderable;t._autoResolution&&t.onViewUpdate()}destroy(){this._renderer.canvasText.returnTexture(this.texture),this._renderer=null}}class va{constructor(t){this._renderer=t}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){const s=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t),t._didTextUpdate=!1),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.returnTexture(e.texture),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=e.texture=this._renderer.canvasText.getTexture(t),Mi(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Of(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}}va.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"text"};const Bf={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class ls{constructor(t,e){this.uid=Y("fillPattern"),this.transform=new D,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Bf[e].addressModeU,t.source.style.addressModeV=Bf[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}var rA=iA,Ta={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},sA=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function iA(r){var t=[];return r.replace(sA,function(e,s,i){var n=s.toLowerCase();for(i=oA(i),n=="m"&&i.length>2&&(t.push([s].concat(i.splice(0,2))),n="l",s=s=="m"?"l":"L");;){if(i.length==Ta[n])return i.unshift(s),t.push(i);if(i.length<Ta[n])throw new Error("malformed path data");t.push([s].concat(i.splice(0,Ta[n])))}}),t}var nA=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function oA(r){var t=r.match(nA);return t?t.map(Number):[]}var aA=$n(rA);function Gf(r,t){const e=aA(r),s=[];let i=null,n=0,o=0;for(let a=0;a<e.length;a++){const u=e[a],l=u[0],c=u;switch(l){case"M":n=c[1],o=c[2],t.moveTo(n,o);break;case"m":n+=c[1],o+=c[2],t.moveTo(n,o);break;case"H":n=c[1],t.lineTo(n,o);break;case"h":n+=c[1],t.lineTo(n,o);break;case"V":o=c[1],t.lineTo(n,o);break;case"v":o+=c[1],t.lineTo(n,o);break;case"L":n=c[1],o=c[2],t.lineTo(n,o);break;case"l":n+=c[1],o+=c[2],t.lineTo(n,o);break;case"C":n=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,o);break;case"c":t.bezierCurveTo(n+c[1],o+c[2],n+c[3],o+c[4],n+c[5],o+c[6]),n+=c[5],o+=c[6];break;case"S":n=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],n,o);break;case"s":t.bezierCurveToShort(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"Q":n=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],n,o);break;case"q":t.quadraticCurveTo(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"T":n=c[1],o=c[2],t.quadraticCurveToShort(n,o);break;case"t":n+=c[1],o+=c[2],t.quadraticCurveToShort(n,o);break;case"A":n=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"a":n+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"Z":case"z":t.closePath(),s.length>0&&(i=s.pop(),i?(n=i.startX,o=i.startY):(n=0,o=0)),i=null;break;default:}l!=="Z"&&l!=="z"&&i===null&&(i={startX:n,startY:o},s.push(i))}return t}class In{constructor(t=0,e=0,s=0){this.type="circle",this.x=t,this.y=e,this.radius=s}clone(){return new In(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}strokeContains(t,e,s,i=.5){if(this.radius===0)return!1;const n=this.x-t,o=this.y-e,a=this.radius,u=(1-i)*s,l=Math.sqrt(n*n+o*o);return l<=a+u&&l>a-(s-u)}getBounds(t){return t||(t=new z),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}}class Un{constructor(t=0,e=0,s=0,i=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=s,this.halfHeight=i}clone(){return new Un(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let s=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return s*=s,i*=i,s+i<=1}strokeContains(t,e,s,i=.5){const{halfWidth:n,halfHeight:o}=this;if(n<=0||o<=0)return!1;const a=s*(1-i),u=s-a,l=n-u,c=o-u,h=n+a,d=o+a,p=t-this.x,f=e-this.y,g=p*p/(l*l)+f*f/(c*c),m=p*p/(h*h)+f*f/(d*d);return g>1&&m<=1}getBounds(t){return t||(t=new z),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}}function cs(r,t,e,s,i,n){const o=r-e,a=t-s,u=i-e,l=n-s,c=o*u+a*l,h=u*u+l*l;let d=-1;h!==0&&(d=c/h);let p,f;d<0?(p=e,f=s):d>1?(p=i,f=n):(p=e+d*u,f=s+d*l);const g=r-p,m=t-f;return g*g+m*m}let uA,lA;class Pr{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;i<n;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,s=e.length;for(let i=0;i<s;i+=2){const n=e[i],o=e[i+1],a=e[(i+2)%s],u=e[(i+3)%s];t+=(a-n)*(u+o)}return t<0}containsPolygon(t){const e=this.getBounds(uA),s=t.getBounds(lA);if(!e.containsRect(s))return!1;const i=t.points;for(let n=0;n<i.length;n+=2){const o=i[n],a=i[n+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new Pr(t);return e.closePath=this.closePath,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let n=0,o=i-1;n<i;o=n++){const a=this.points[n*2],u=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];u>e!=c>e&&t<(l-a)*((e-u)/(c-u))+a&&(s=!s)}return s}strokeContains(t,e,s,i=.5){const n=s*s,o=n*(1-i),a=n-o,{points:u}=this,l=u.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){const h=u[c],d=u[c+1],p=u[(c+2)%u.length],f=u[(c+3)%u.length],g=cs(t,e,h,d,p,f),m=Math.sign((p-h)*(e-d)-(f-d)*(t-h));if(g<=(m<0?a:o))return!0}return!1}getBounds(t){t||(t=new z);const e=this.points;let s=1/0,i=-1/0,n=1/0,o=-1/0;for(let a=0,u=e.length;a<u;a+=2){const l=e[a],c=e[a+1];s=l<s?l:s,i=l>i?l:i,n=c<n?c:n,o=c>o?c:o}return t.x=s,t.width=i-s,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Oi=(r,t,e,s,i,n,o)=>{const a=r-e,u=t-s,l=Math.sqrt(a*a+u*u);return l>=i-n&&l<=i+o};class kn{constructor(t=0,e=0,s=0,i=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n}getBounds(t){return t||(t=new z),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new kn(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const o=s*s;if(i*i+n*n<=o||(i=t-(this.x+this.width-s),i*i+n*n<=o)||(n=e-(this.y+this.height-s),i*i+n*n<=o)||(i=t-(this.x+s),i*i+n*n<=o))return!0}return!1}strokeContains(t,e,s,i=.5){const{x:n,y:o,width:a,height:u,radius:l}=this,c=s*(1-i),h=s-c,d=n+l,p=o+l,f=a-l*2,g=u-l*2,m=n+a,_=o+u;return(t>=n-c&&t<=n+h||t>=m-h&&t<=m+c)&&e>=p&&e<=p+g||(e>=o-c&&e<=o+h||e>=_-h&&e<=_+c)&&t>=d&&t<=d+f?!0:t<d&&e<p&&Oi(t,e,d,p,l,h,c)||t>m-l&&e<p&&Oi(t,e,m-l,p,l,h,c)||t>m-l&&e>_-l&&Oi(t,e,m-l,_-l,l,h,c)||t<d&&e>_-l&&Oi(t,e,d,_-l,l,h,c)}}const cA=8,Bi=11920929e-14,hA=1,Aa=.01,mr=0,Le=0;function Sa(r,t,e,s,i,n,o,a,u,l){const c=Math.min(.99,Math.max(0,l!=null?l:Pi.defaultOptions.bezierSmoothness));let h=(hA-c)/1;return h*=h,dA(t,e,s,i,n,o,a,u,r,h),r}function dA(r,t,e,s,i,n,o,a,u,l){Ea(r,t,e,s,i,n,o,a,u,l,0),u.push(o,a)}function Ea(r,t,e,s,i,n,o,a,u,l,c){if(c>cA)return;const h=Math.PI,d=(r+e)/2,p=(t+s)/2,f=(e+i)/2,g=(s+n)/2,m=(i+o)/2,_=(n+a)/2,b=(d+f)/2,x=(p+g)/2,v=(f+m)/2,A=(g+_)/2,T=(b+v)/2,S=(x+A)/2;if(c>0){let B=o-r,P=a-t;const C=Math.abs((e-o)*P-(s-a)*B),E=Math.abs((i-o)*P-(n-a)*B);let G,U;if(C>Bi&&E>Bi){if((C+E)*(C+E)<=l*(B*B+P*P)){if(mr<Aa){u.push(T,S);return}const k=Math.atan2(n-s,i-e);if(G=Math.abs(k-Math.atan2(s-t,e-r)),U=Math.abs(Math.atan2(a-n,o-i)-k),G>=h&&(G=2*h-G),U>=h&&(U=2*h-U),G+U<mr){u.push(T,S);return}if(Le!==0){if(G>Le){u.push(e,s);return}if(U>Le){u.push(i,n);return}}}}else if(C>Bi){if(C*C<=l*(B*B+P*P)){if(mr<Aa){u.push(T,S);return}if(G=Math.abs(Math.atan2(n-s,i-e)-Math.atan2(s-t,e-r)),G>=h&&(G=2*h-G),G<mr){u.push(e,s),u.push(i,n);return}if(Le!==0&&G>Le){u.push(e,s);return}}}else if(E>Bi){if(E*E<=l*(B*B+P*P)){if(mr<Aa){u.push(T,S);return}if(G=Math.abs(Math.atan2(a-n,o-i)-Math.atan2(n-s,i-e)),G>=h&&(G=2*h-G),G<mr){u.push(e,s),u.push(i,n);return}if(Le!==0&&G>Le){u.push(i,n);return}}}else if(B=T-(r+o)/2,P=S-(t+a)/2,B*B+P*P<=l){u.push(T,S);return}}Ea(r,t,d,p,b,x,T,S,u,l,c+1),Ea(T,S,v,A,m,_,o,a,u,l,c+1)}const pA=8,fA=11920929e-14,mA=1,gA=.01,Ff=0;function If(r,t,e,s,i,n,o,a){const u=Math.min(.99,Math.max(0,a!=null?a:Pi.defaultOptions.bezierSmoothness));let l=(mA-u)/1;return l*=l,_A(t,e,s,i,n,o,r,l),r}function _A(r,t,e,s,i,n,o,a){wa(o,r,t,e,s,i,n,a,0),o.push(i,n)}function wa(r,t,e,s,i,n,o,a,u){if(u>pA)return;const l=Math.PI,c=(t+s)/2,h=(e+i)/2,d=(s+n)/2,p=(i+o)/2,f=(c+d)/2,g=(h+p)/2;let m=n-t,_=o-e;const b=Math.abs((s-n)*_-(i-o)*m);if(b>fA){if(b*b<=a*(m*m+_*_)){if(Ff<gA){r.push(f,g);return}let x=Math.abs(Math.atan2(o-i,n-s)-Math.atan2(i-e,s-t));if(x>=l&&(x=2*l-x),x<Ff){r.push(f,g);return}}}else if(m=f-(t+n)/2,_=g-(e+o)/2,m*m+_*_<=a){r.push(f,g);return}wa(r,t,e,c,h,f,g,a,u+1),wa(r,f,g,d,p,n,o,a,u+1)}function Ca(r,t,e,s,i,n,o,a){let u=Math.abs(i-n);(!o&&i>n||o&&n>i)&&(u=2*Math.PI-u),a||(a=Math.max(6,Math.floor(6*Math.pow(s,1/3)*(u/Math.PI)))),a=Math.max(a,3);let l=u/a,c=i;l*=o?-1:1;for(let h=0;h<a+1;h++){const d=Math.cos(c),p=Math.sin(c),f=t+d*s,g=e+p*s;r.push(f,g),c+=l}}function Uf(r,t,e,s,i,n){const o=r[r.length-2],a=r[r.length-1]-e,u=o-t,l=i-e,c=s-t,h=Math.abs(a*c-u*l);if(h<1e-8||n===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}const d=a*a+u*u,p=l*l+c*c,f=a*l+u*c,g=n*Math.sqrt(d)/h,m=n*Math.sqrt(p)/h,_=g*f/d,b=m*f/p,x=g*c+m*u,v=g*l+m*a,A=u*(m+_),T=a*(m+_),S=c*(g+b),B=l*(g+b),P=Math.atan2(T-v,A-x),C=Math.atan2(B-v,S-x);Ca(r,x+t,v+e,n,P,C,u*l>c*a)}const hs=Math.PI*2,Ra={centerX:0,centerY:0,ang1:0,ang2:0},Pa=({x:r,y:t},e,s,i,n,o,a,u)=>{r*=e,t*=s;const l=i*r-n*t,c=n*r+i*t;return u.x=l+o,u.y=c+a,u};function xA(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),s=t===1.5707963267948966?.551915024494:e,i=Math.cos(r),n=Math.sin(r),o=Math.cos(r+t),a=Math.sin(r+t);return[{x:i-n*s,y:n+i*s},{x:o+a*s,y:a-o*s},{x:o,y:a}]}const kf=(r,t,e,s)=>{const i=r*s-t*e<0?-1:1;let n=r*e+t*s;return n>1&&(n=1),n<-1&&(n=-1),i*Math.acos(n)},bA=(r,t,e,s,i,n,o,a,u,l,c,h,d)=>{const p=Math.pow(i,2),f=Math.pow(n,2),g=Math.pow(c,2),m=Math.pow(h,2);let _=p*f-p*m-f*g;_<0&&(_=0),_/=p*m+f*g,_=Math.sqrt(_)*(o===a?-1:1);const b=_*i/n*h,x=_*-n/i*c,v=l*b-u*x+(r+e)/2,A=u*b+l*x+(t+s)/2,T=(c-b)/i,S=(h-x)/n,B=(-c-b)/i,P=(-h-x)/n,C=kf(1,0,T,S);let E=kf(T,S,B,P);a===0&&E>0&&(E-=hs),a===1&&E<0&&(E+=hs),d.centerX=v,d.centerY=A,d.ang1=C,d.ang2=E};function Lf(r,t,e,s,i,n,o,a=0,u=0,l=0){if(n===0||o===0)return;const c=Math.sin(a*hs/360),h=Math.cos(a*hs/360),d=h*(t-s)/2+c*(e-i)/2,p=-c*(t-s)/2+h*(e-i)/2;if(d===0&&p===0)return;n=Math.abs(n),o=Math.abs(o);const f=Math.pow(d,2)/Math.pow(n,2)+Math.pow(p,2)/Math.pow(o,2);f>1&&(n*=Math.sqrt(f),o*=Math.sqrt(f)),bA(t,e,s,i,n,o,u,l,c,h,d,p,Ra);let{ang1:g,ang2:m}=Ra;const{centerX:_,centerY:b}=Ra;let x=Math.abs(m)/(hs/4);Math.abs(1-x)<1e-7&&(x=1);const v=Math.max(Math.ceil(x),1);m/=v;let A=r[r.length-2],T=r[r.length-1];const S={x:0,y:0};for(let B=0;B<v;B++){const P=xA(g,m),{x:C,y:E}=Pa(P[0],n,o,h,c,_,b,S),{x:G,y:U}=Pa(P[1],n,o,h,c,_,b,S),{x:k,y:Bt}=Pa(P[2],n,o,h,c,_,b,S);Sa(r,A,T,C,E,G,U,k,Bt),A=k,T=Bt,g+=m}}function Nf(r,t,e){var s;const i=(a,u)=>{const l=u.x-a.x,c=u.y-a.y,h=Math.sqrt(l*l+c*c),d=l/h,p=c/h;return{len:h,nx:d,ny:p}},n=(a,u)=>{a===0?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y)};let o=t[t.length-1];for(let a=0;a<t.length;a++){const u=t[a%t.length],l=(s=u.radius)!=null?s:e;if(l<=0){n(a,u),o=u;continue}const c=t[(a+1)%t.length],h=i(u,o),d=i(u,c);if(h.len<1e-4||d.len<1e-4){n(a,u),o=u;continue}let p=Math.asin(h.nx*d.ny-h.ny*d.nx),f=1,g=!1;h.nx*d.nx-h.ny*-d.ny<0?p<0?p=Math.PI+p:(p=Math.PI-p,f=-1,g=!0):p>0&&(f=-1,g=!0);const m=p/2;let _,b=Math.abs(Math.cos(m)*l/Math.sin(m));b>Math.min(h.len/2,d.len/2)?(b=Math.min(h.len/2,d.len/2),_=Math.abs(b*Math.sin(m)/Math.cos(m))):_=l;const x=u.x+d.nx*b+-d.ny*_*f,v=u.y+d.ny*b+d.nx*_*f,A=Math.atan2(h.ny,h.nx)+Math.PI/2*f,T=Math.atan2(d.ny,d.nx)-Math.PI/2*f;a===0&&r.moveTo(x+Math.cos(A)*_,v+Math.sin(A)*_),r.arc(x,v,_,A,T,g),o=u}}function $f(r,t,e,s){var i;const n=(u,l)=>Math.sqrt((u.x-l.x)**2+(u.y-l.y)**2),o=(u,l,c)=>({x:u.x+(l.x-u.x)*c,y:u.y+(l.y-u.y)*c}),a=t.length;for(let u=0;u<a;u++){const l=t[(u+1)%a],c=(i=l.radius)!=null?i:e;if(c<=0){u===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}const h=t[u],d=t[(u+2)%a],p=n(h,l);let f;if(p<1e-4)f=l;else{const _=Math.min(p/2,c);f=o(l,h,_/p)}const g=n(d,l);let m;if(g<1e-4)m=l;else{const _=Math.min(g/2,c);m=o(l,d,_/g)}u===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,s)}}const yA=new z;class Xf{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new nt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const s=this._currentPoly.points,i=s[s.length-2],n=s[s.length-1];return(i!==t||n!==e)&&s.push(t,e),this}arc(t,e,s,i,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return Ca(a,t,e,s,i,n,o),this}arcTo(t,e,s,i,n){this._ensurePoly();const o=this._currentPoly.points;return Uf(o,t,e,s,i,n),this}arcToSvg(t,e,s,i,n,o,a){const u=this._currentPoly.points;return Lf(u,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,o,a){this._ensurePoly();const u=this._currentPoly;return Sa(this._currentPoly.points,u.lastX,u.lastY,t,e,s,i,n,o,a),this}quadraticCurveTo(t,e,s,i,n){this._ensurePoly();const o=this._currentPoly;return If(this._currentPoly.points,o.lastX,o.lastY,t,e,s,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const s=this.shapePrimitives,i=s.length;for(let n=0;n<t.instructions.length;n++){const o=t.instructions[n];this[o.action](...o.data)}if(t.checkForHoles&&s.length-i>1){let n=null;for(let o=i;o<s.length;o++){const a=s[o];if(a.shape.type==="polygon"){const u=a.shape,l=n==null?void 0:n.shape;l&&l.containsPolygon(u)?(n.holes||(n.holes=[]),n.holes.push(a),s.copyWithin(o,o+1),s.length--,o--):n=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,s,i,n){return this.drawShape(new z(t,e,s,i),n),this}circle(t,e,s,i){return this.drawShape(new In(t,e,s),i),this}poly(t,e,s){const i=new Pr(t);return i.closePath=e,this.drawShape(i,s),this}regularPoly(t,e,s,i,n=0,o){i=Math.max(i|0,3);const a=-1*Math.PI/2+n,u=Math.PI*2/i,l=[];for(let c=0;c<i;c++){const h=a-c*u;l.push(t+s*Math.cos(h),e+s*Math.sin(h))}return this.poly(l,!0,o),this}roundPoly(t,e,s,i,n,o=0,a){if(i=Math.max(i|0,3),n<=0)return this.regularPoly(t,e,s,i,o);const u=s*Math.sin(Math.PI/i)-.001;n=Math.min(n,u);const l=-1*Math.PI/2+o,c=Math.PI*2/i,h=(i-2)*Math.PI/i/2;for(let d=0;d<i;d++){const p=d*c+l,f=t+s*Math.cos(p),g=e+s*Math.sin(p),m=p+Math.PI+h,_=p-Math.PI-h,b=f+n*Math.cos(m),x=g+n*Math.sin(m),v=f+n*Math.cos(_),A=g+n*Math.sin(_);d===0?this.moveTo(b,x):this.lineTo(b,x),this.quadraticCurveTo(f,g,v,A,a)}return this.closePath()}roundShape(t,e,s=!1,i){return t.length<3?this:(s?$f(this,t,e,i):Nf(this,t,e),this.closePath())}filletRect(t,e,s,i,n){if(n===0)return this.rect(t,e,s,i);const o=Math.min(s,i)/2,a=Math.min(o,Math.max(-o,n)),u=t+s,l=e+i,c=a<0?-a:0,h=Math.abs(a);return this.moveTo(t,e+h).arcTo(t+c,e+c,t+h,e,h).lineTo(u-h,e).arcTo(u-c,e+c,u,e+h,h).lineTo(u,l-h).arcTo(u-c,l-c,t+s-h,l,h).lineTo(t+h,l).arcTo(t+c,l-c,t,l-h,h).closePath()}chamferRect(t,e,s,i,n,o){if(n<=0)return this.rect(t,e,s,i);const a=Math.min(n,Math.min(s,i)/2),u=t+s,l=e+i,c=[t+a,e,u-a,e,u,e+a,u,l-a,u-a,l,t+a,l,t,l-a,t,e+a];for(let h=c.length-1;h>=2;h-=2)c[h]===c[h-2]&&c[h-1]===c[h-3]&&c.splice(h-1,2);return this.poly(c,!0,o)}ellipse(t,e,s,i,n){return this.drawShape(new Un(t,e,s,i),n),this}roundRect(t,e,s,i,n,o){return this.drawShape(new kn(t,e,s,i,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let s=this._currentPoly;return s&&this.endPoly(),s=new Pr,s.points.push(t,e),this._currentPoly=s,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Pr,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let s=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=s;s=n.a*s+n.c*i+n.tx,i=n.b*o+n.d*i+n.ty}this._currentPoly.points.push(s,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const s=t.instructions[e];this[s.action](...s.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let s=0;s<e.length;s++){const i=e[s],n=i.shape.getBounds(yA);i.transform?t.addRect(n,i.transform):t.addRect(n)}return t}}class ze{constructor(t,e=!1){this.instructions=[],this.uid=Y("graphicsPath"),this._dirty=!0;var s;this.checkForHoles=e,typeof t=="string"?Gf(t,this):this.instructions=(s=t==null?void 0:t.slice())!=null?s:[]}get shapePath(){return this._shapePath||(this._shapePath=new Xf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,s,i,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(it.shared);let u=0,l=0;if(!o||o.action!=="bezierCurveTo")u=a.x,l=a.y;else{u=o.data[2],l=o.data[3];const c=a.x,h=a.y;u=c+(c-u),l=h+(h-l)}return this.instructions.push({action:"bezierCurveTo",data:[u,l,t,e,s,i,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,s){const i=this.instructions[this.instructions.length-1],n=this.getLastPoint(it.shared);let o=0,a=0;if(!i||i.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=i.data[0],a=i.data[1];const u=n.x,l=n.y;o=u+(u-o),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,s]}),this._dirty=!0,this}rect(t,e,s,i,n){return this.instructions.push({action:"rect",data:[t,e,s,i,n]}),this._dirty=!0,this}circle(t,e,s,i){return this.instructions.push({action:"circle",data:[t,e,s,i]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,s,i,n,o,a){n||(n=i/2);const u=-1*Math.PI/2+o,l=s*2,c=Math.PI*2/l,h=[];for(let d=0;d<l;d++){const p=d%2?n:i,f=d*c+u;h.push(t+p*Math.cos(f),e+p*Math.sin(f))}return this.poly(h,!0,a),this}clone(t=!1){const e=new ze;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let s=0;s<this.instructions.length;s++){const i=this.instructions[s];e.instructions.push({action:i.action,data:i.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,s=t.b,i=t.c,n=t.d,o=t.tx,a=t.ty;let u=0,l=0,c=0,h=0,d=0,p=0,f=0,g=0;for(let m=0;m<this.instructions.length;m++){const _=this.instructions[m],b=_.data;switch(_.action){case"moveTo":case"lineTo":u=b[0],l=b[1],b[0]=e*u+i*l+o,b[1]=s*u+n*l+a;break;case"bezierCurveTo":c=b[0],h=b[1],d=b[2],p=b[3],u=b[4],l=b[5],b[0]=e*c+i*h+o,b[1]=s*c+n*h+a,b[2]=e*d+i*p+o,b[3]=s*d+n*p+a,b[4]=e*u+i*l+o,b[5]=s*u+n*l+a;break;case"quadraticCurveTo":c=b[0],h=b[1],u=b[2],l=b[3],b[0]=e*c+i*h+o,b[1]=s*c+n*h+a,b[2]=e*u+i*l+o,b[3]=s*u+n*l+a;break;case"arcToSvg":u=b[5],l=b[6],f=b[0],g=b[1],b[0]=e*f+i*g,b[1]=s*f+n*g,b[5]=e*u+i*l+o,b[6]=s*u+n*l+a;break;case"circle":b[4]=ds(b[3],t);break;case"rect":b[4]=ds(b[4],t);break;case"ellipse":b[8]=ds(b[8],t);break;case"roundRect":b[5]=ds(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=ds(b[2],t);break;default:break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,s=this.instructions[e];if(!s)return t.x=0,t.y=0,t;for(;s.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;s=this.instructions[e]}switch(s.action){case"moveTo":case"lineTo":t.x=s.data[0],t.y=s.data[1];break;case"quadraticCurveTo":t.x=s.data[2],t.y=s.data[3];break;case"bezierCurveTo":t.x=s.data[4],t.y=s.data[5];break;case"arc":case"arcToSvg":t.x=s.data[5],t.y=s.data[6];break;case"addPath":s.data[0].getLastPoint(t);break}return t}}function ds(r,t){return r?r.prepend(t):t.clone()}let Da=0;const Hf=500;function Ut(...r){Da!==Hf&&(Da++,Da===Hf?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}function Z(r,t,e){const s=r.getAttribute(t);return s?Number(s):e}function zf(r,t){const e=r.querySelectorAll("defs");for(let s=0;s<e.length;s++){const i=e[s];for(let n=0;n<i.children.length;n++){const o=i.children[n];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=vA(o);break;case"radialgradient":t.defs[o.id]=TA(o);break;default:break}}}}function vA(r){const t=Z(r,"x1",0),e=Z(r,"y1",0),s=Z(r,"x2",1),i=Z(r,"y2",0),n=r.getAttribute("gradientUnits")||"objectBoundingBox",o=new Qt(t,e,s,i,n==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){const u=r.children[a],l=Z(u,"offset",0),c=X.shared.setValue(u.getAttribute("stop-color")).toNumber();o.addColorStop(l,c)}return o}function TA(r){return new Qt(0,0,1,0)}function Ma(r){const t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const Oa={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function Ba(r,t){const e=r.getAttribute("style"),s={},i={},n={strokeStyle:s,fillStyle:i,useFill:!1,useStroke:!1};for(const o in Oa){const a=r.getAttribute(o);a&&jf(t,n,o,a.trim())}if(e){const o=e.split(";");for(let a=0;a<o.length;a++){const u=o[a].trim(),[l,c]=u.split(":");Oa[l]&&jf(t,n,l,c.trim())}}return{strokeStyle:n.useStroke?s:null,fillStyle:n.useFill?i:null,useFill:n.useFill,useStroke:n.useStroke}}function jf(r,t,e,s){switch(e){case"stroke":if(s!=="none"){if(s.startsWith("url(")){const i=Ma(s);t.strokeStyle.fill=r.defs[i]}else t.strokeStyle.color=X.shared.setValue(s).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(s);break;case"fill":if(s!=="none"){if(s.startsWith("url(")){const i=Ma(s);t.fillStyle.fill=r.defs[i]}else t.fillStyle.color=X.shared.setValue(s).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(s);break;case"stroke-opacity":t.strokeStyle.alpha=Number(s);break;case"opacity":t.fillStyle.alpha=Number(s),t.strokeStyle.alpha=Number(s);break}}var AA=Object.defineProperty,Vf=Object.getOwnPropertySymbols,SA=Object.prototype.hasOwnProperty,EA=Object.prototype.propertyIsEnumerable,Wf=(r,t,e)=>t in r?AA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gi=(r,t)=>{for(var e in t||(t={}))SA.call(t,e)&&Wf(r,e,t[e]);if(Vf)for(var e of Vf(t))EA.call(t,e)&&Wf(r,e,t[e]);return r};function Yf(r,t){if(typeof r=="string"){const o=document.createElement("div");o.innerHTML=r.trim(),r=o.querySelector("svg")}const e={context:t,defs:{},path:new ze};zf(r,e);const s=r.children,{fillStyle:i,strokeStyle:n}=Ba(r,e);for(let o=0;o<s.length;o++){const a=s[o];a.nodeName.toLowerCase()!=="defs"&&qf(a,e,i,n)}return t}function qf(r,t,e,s){const i=r.children,{fillStyle:n,strokeStyle:o}=Ba(r,t);n&&e?e=Gi(Gi({},e),n):n&&(e=n),o&&s?s=Gi(Gi({},s),o):o&&(s=o);const a=!e&&!s;a&&(e={color:0});let u,l,c,h,d,p,f,g,m,_,b,x,v,A,T,S,B;switch(r.nodeName.toLowerCase()){case"path":A=r.getAttribute("d"),r.getAttribute("fill-rule"),T=new ze(A,!0),t.context.path(T),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"circle":f=Z(r,"cx",0),g=Z(r,"cy",0),m=Z(r,"r",0),t.context.ellipse(f,g,m,m),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"rect":u=Z(r,"x",0),l=Z(r,"y",0),S=Z(r,"width",0),B=Z(r,"height",0),_=Z(r,"rx",0),b=Z(r,"ry",0),_||b?t.context.roundRect(u,l,S,B,_||b):t.context.rect(u,l,S,B),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"ellipse":f=Z(r,"cx",0),g=Z(r,"cy",0),_=Z(r,"rx",0),b=Z(r,"ry",0),t.context.beginPath(),t.context.ellipse(f,g,_,b),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"line":c=Z(r,"x1",0),h=Z(r,"y1",0),d=Z(r,"x2",0),p=Z(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,h),t.context.lineTo(d,p),s&&t.context.stroke(s);break;case"polygon":v=r.getAttribute("points"),x=v.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!0),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"polyline":v=r.getAttribute("points"),x=v.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!1),s&&t.context.stroke(s);break;case"g":case"svg":break;default:{Ut(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<i.length;P++)qf(i[P],t,e,s)}var wA=Object.defineProperty,Fi=Object.getOwnPropertySymbols,Kf=Object.prototype.hasOwnProperty,Zf=Object.prototype.propertyIsEnumerable,Qf=(r,t,e)=>t in r?wA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ht=(r,t)=>{for(var e in t||(t={}))Kf.call(t,e)&&Qf(r,e,t[e]);if(Fi)for(var e of Fi(t))Zf.call(t,e)&&Qf(r,e,t[e]);return r},CA=(r,t)=>{var e={};for(var s in r)Kf.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Fi)for(var s of Fi(r))t.indexOf(s)<0&&Zf.call(r,s)&&(e[s]=r[s]);return e};function RA(r){return X.isColorLike(r)}function Jf(r){return r instanceof ls}function tm(r){return r instanceof Qt}function PA(r){return r instanceof w}function DA(r,t,e){const s=X.shared.setValue(t!=null?t:0);return r.color=s.toNumber(),r.alpha=s.alpha===1?e.alpha:s.alpha,r.texture=w.WHITE,Ht(Ht({},e),r)}function MA(r,t,e){return r.texture=t,Ht(Ht({},e),r)}function em(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,Ht(Ht({},e),r)}function rm(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,Ht(Ht({},e),r)}function OA(r,t){const e=Ht(Ht({},t),r),s=X.shared.setValue(e.color);return e.alpha*=s.alpha,e.color=s.toNumber(),e}function be(r,t){if(r==null)return null;const e={},s=r;return RA(r)?DA(e,r,t):PA(r)?MA(e,r,t):Jf(r)?em(e,r,t):tm(r)?rm(e,r,t):s.fill&&Jf(s.fill)?em(s,s.fill,t):s.fill&&tm(s.fill)?rm(s,s.fill,t):OA(s,t)}function ps(r,t){const e=t,{width:s,alignment:i,miterLimit:n,cap:o,join:a,pixelLine:u}=e,l=CA(e,["width","alignment","miterLimit","cap","join","pixelLine"]),c=be(r,l);return c?Ht({width:s,alignment:i,miterLimit:n,cap:o,join:a,pixelLine:u},c):null}var BA=Object.defineProperty,sm=Object.getOwnPropertySymbols,GA=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,im=(r,t,e)=>t in r?BA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gr=(r,t)=>{for(var e in t||(t={}))GA.call(t,e)&&im(r,e,t[e]);if(sm)for(var e of sm(t))FA.call(t,e)&&im(r,e,t[e]);return r};const IA=new it,nm=new D,Ga=class te extends Ct{constructor(){super(...arguments),this.uid=Y("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ze,this._transform=new D,this._fillStyle=gr({},te.defaultFillStyle),this._strokeStyle=gr({},te.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new nt,this._boundsDirty=!0}clone(){const t=new te;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=gr({},this._fillStyle),t._strokeStyle=gr({},this._strokeStyle),t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=be(t,te.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ps(t,te.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=be(t,te.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=be(t,te.defaultStrokeStyle),this}texture(t,e,s,i,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:s||0,dy:i||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?X.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ze,this}fill(t,e){let s;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="stroke"?s=i.data.path:s=this._activePath.clone(),s?(t!=null&&(e!==void 0&&typeof t=="number"&&(t={color:t,alpha:e}),this._fillStyle=be(t,te.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(it.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="fill"?e=s.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ps(t,te.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],s=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(s);else{e.data.hole=s;break}}return this._initNextPathLocation(),this}arc(t,e,s,i,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,s,i,n,o),this}arcTo(t,e,s,i,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,n),this}arcToSvg(t,e,s,i,n,o,a){this._tick++;const u=this._transform;return this._activePath.arcToSvg(t,e,s,i,n,u.a*o+u.c*a+u.tx,u.b*o+u.d*a+u.ty),this}bezierCurveTo(t,e,s,i,n,o,a){this._tick++;const u=this._transform;return this._activePath.bezierCurveTo(u.a*t+u.c*e+u.tx,u.b*t+u.d*e+u.ty,u.a*s+u.c*i+u.tx,u.b*s+u.d*i+u.ty,u.a*n+u.c*o+u.tx,u.b*n+u.d*o+u.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,s,i){return this._tick++,this._activePath.ellipse(t,e,s,i,this._transform.clone()),this}circle(t,e,s){return this._tick++,this._activePath.circle(t,e,s,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const s=this._transform;return this._activePath.lineTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty),this}moveTo(t,e){this._tick++;const s=this._transform,i=this._activePath.instructions,n=s.a*t+s.c*e+s.tx,o=s.b*t+s.d*e+s.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=n,i[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,s,i,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,n),this}rect(t,e,s,i){return this._tick++,this._activePath.rect(t,e,s,i,this._transform.clone()),this}roundRect(t,e,s,i,n){return this._tick++,this._activePath.roundRect(t,e,s,i,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,s,i,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,s,i,n,o),this}roundPoly(t,e,s,i,n,o){return this._tick++,this._activePath.roundPoly(t,e,s,i,n,o),this}roundShape(t,e,s,i){return this._tick++,this._activePath.roundShape(t,e,s,i),this}filletRect(t,e,s,i,n){return this._tick++,this._activePath.filletRect(t,e,s,i,n),this}chamferRect(t,e,s,i,n,o){return this._tick++,this._activePath.chamferRect(t,e,s,i,n,o),this}star(t,e,s,i,n=0,o=0){return this._tick++,this._activePath.star(t,e,s,i,n,o,this._transform.clone()),this}svg(t){return this._tick++,Yf(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:gr({},this._fillStyle),strokeStyle:gr({},this._strokeStyle)}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,s,i,n,o){return t instanceof D?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,s,i,n,o),this)}transform(t,e,s,i,n,o){return t instanceof D?(this._transform.append(t),this):(nm.set(t,e,s,i,n,o),this._transform.append(nm),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const s=this.instructions[e],i=s.action;if(i==="fill"){const n=s.data;t.addBounds(n.path.bounds)}else if(i==="texture"){const n=s.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(i==="stroke"){const n=s.data,o=n.style.alignment,a=n.style.width*(1-o),u=n.path.bounds;t.addFrame(u.minX-a,u.minY-a,u.maxX+a,u.maxY+a)}}return t}containsPoint(t){var e;if(!this.bounds.containsPoint(t.x,t.y))return!1;const s=this.instructions;let i=!1;for(let n=0;n<s.length;n++){const o=s[n],a=o.data,u=a.path;if(!o.action||!u)continue;const l=a.style,c=u.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){const d=c[h].shape;if(!l||!d)continue;const p=c[h].transform,f=p?p.applyInverse(t,IA):t;if(o.action==="fill")i=d.contains(f.x,f.y);else{const m=l;i=d.strokeContains(f.x,f.y,m.width,m.alignment)}const g=a.hole;if(g){const m=(e=g.shapePath)==null?void 0:e.shapePrimitives;if(m)for(let _=0;_<m.length;_++)m[_].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(e),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(e)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Ga.defaultFillStyle={color:16777215,alpha:1,texture:w.WHITE,matrix:null,fill:null,textureSpace:"local"},Ga.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:w.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let pt=Ga;const om=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function am(r){const t=[];let e=0;for(let s=0;s<om.length;s++){const i=`_${om[s]}`;t[e++]=r[i]}return e=um(r._fill,t,e),e=kA(r._stroke,t,e),e=LA(r.dropShadow,t,e),e=UA(r.filters,t,e),t.join("-")}function UA(r,t,e){if(!r)return e;for(const s of r)t[e++]=s.uid;return e}function um(r,t,e){var s;return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=(s=r.fill)==null?void 0:s.styleKey),e}function kA(r,t,e){return r&&(e=um(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function LA(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=X.shared.setValue(r.color).toNumber()),e}var NA=Object.defineProperty,$A=Object.defineProperties,XA=Object.getOwnPropertyDescriptors,lm=Object.getOwnPropertySymbols,HA=Object.prototype.hasOwnProperty,zA=Object.prototype.propertyIsEnumerable,cm=(r,t,e)=>t in r?NA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dt=(r,t)=>{for(var e in t||(t={}))HA.call(t,e)&&cm(r,e,t[e]);if(lm)for(var e of lm(t))zA.call(t,e)&&cm(r,e,t[e]);return r},jA=(r,t)=>$A(r,XA(t));const Fa=class Rr extends Ct{constructor(t={}){super(),VA(t);const e=Dt(Dt({},Rr.defaultTextStyle),t);for(const s in e){const i=s;this[i]=e[s]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy(Dt(Dt({},Rr.defaultDropShadow),t)):this._dropShadow=t?this._createProxy(Dt({},Rr.defaultDropShadow)):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get filters(){return this._filters}set filters(t){this._filters=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy(Dt(Dt({},pt.defaultFillStyle),t),()=>{this._fill=be(Dt({},this._originalFill),pt.defaultFillStyle)})),this._fill=be(t===0?"black":t,pt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(Dt(Dt({},pt.defaultStrokeStyle),t),()=>{this._stroke=ps(Dt({},this._originalStroke),pt.defaultStrokeStyle)})),this._stroke=ps(t,pt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=am(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=Rr.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Rr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?Dt({},this._dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){var e,s,i,n;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const o=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(e=this._fill)!=null&&e.texture&&this._fill.texture.destroy(o),(s=this._originalFill)!=null&&s.texture&&this._originalFill.texture.destroy(o),(i=this._stroke)!=null&&i.texture&&this._stroke.texture.destroy(o),(n=this._originalStroke)!=null&&n.texture&&this._originalStroke.texture.destroy(o)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(s,i,n)=>(s[i]=n,e==null||e(i,n),this.update(),!0)})}_isFillStyle(t){return(t!=null?t:null)!==null&&!(X.isColorLike(t)||t instanceof Qt||t instanceof ls)}};Fa.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Fa.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let zt=Fa;function VA(r){var t,e,s,i,n;const o=r;if(typeof o.dropShadow=="boolean"&&o.dropShadow){const a=zt.defaultDropShadow;r.dropShadow={alpha:(t=o.dropShadowAlpha)!=null?t:a.alpha,angle:(e=o.dropShadowAngle)!=null?e:a.angle,blur:(s=o.dropShadowBlur)!=null?s:a.blur,color:(i=o.dropShadowColor)!=null?i:a.color,distance:(n=o.dropShadowDistance)!=null?n:a.distance}}if(o.strokeThickness!==void 0){const a=o.stroke;let u={};if(X.isColorLike(a))u.color=a;else if(a instanceof Qt||a instanceof ls)u.fill=a;else if(Object.hasOwnProperty.call(a,"color")||Object.hasOwnProperty.call(a,"fill"))u=a;else throw new Error("Invalid stroke value.");r.stroke=jA(Dt({},u),{width:o.strokeThickness})}if(Array.isArray(o.fillGradientStops)){let a;r.fontSize==null?r.fontSize=zt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?a=parseInt(r.fontSize,10):a=r.fontSize;const u=new Qt({start:{x:0,y:0},end:{x:0,y:(a||0)*1.7}}),l=o.fillGradientStops.map(c=>X.shared.setValue(c).toNumber());l.forEach((c,h)=>{const d=h/(l.length-1);u.addColorStop(d,c)}),r.fill={fill:u}}}const WA=new nt;function Ia(r,t,e,s){const i=WA;i.minX=0,i.minY=0,i.maxX=r.width/s|0,i.maxY=r.height/s|0;const n=et.getOptimalTexture(i.width,i.height,s,!1);return n.source.uploadMethodId="image",n.source.resource=r,n.source.alphaMode="premultiply-alpha-on-upload",n.frame.width=t/s,n.frame.height=e/s,n.source.emit("update",n.source),n.updateUvs(),n}class hm{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const s=L.get().createCanvas();s.width=t,s.height=e;const i=s.getContext("2d");return{canvas:s,context:i}}getOptimalCanvasAndContext(t,e,s=1){t=Math.ceil(t*s-1e-6),e=Math.ceil(e*s-1e-6),t=Be(t),e=Be(e);const i=(t<<17)+(e<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:s,height:i}=e,n=(s<<17)+(i<<1);t.context.clearRect(0,0,s,i),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const le=new hm;let Ne=null,ce=null;function YA(r,t){Ne||(Ne=L.get().createCanvas(256,128),ce=Ne.getContext("2d",{willReadFrequently:!0}),ce.globalCompositeOperation="copy",ce.globalAlpha=1),(Ne.width<r||Ne.height<t)&&(Ne.width=Be(r),Ne.height=Be(t))}function dm(r,t,e){for(let s=0,i=4*e*t;s<t;++s,i+=4)if(r[i+3]!==0)return!1;return!0}function pm(r,t,e,s,i){const n=4*t;for(let o=s,a=s*n+4*e;o<=i;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function fm(...r){var t,e,s;let i=r[0];i.canvas||(i={canvas:r[0],resolution:r[1]});const{canvas:n}=i,o=Math.min((t=i.resolution)!=null?t:1,1),a=(e=i.width)!=null?e:n.width,u=(s=i.height)!=null?s:n.height;let l=i.output;if(YA(a,u),!ce)throw new TypeError("Failed to get canvas 2D context");ce.drawImage(n,0,0,a,u,0,0,a*o,u*o);const c=ce.getImageData(0,0,a,u).data;let h=0,d=0,p=a-1,f=u-1;for(;d<u&&dm(c,a,d);)++d;if(d===u)return z.EMPTY;for(;dm(c,a,f);)--f;for(;pm(c,a,h,d,f);)++h;for(;pm(c,a,p,d,f);)--p;return++p,++f,ce.globalCompositeOperation="source-over",ce.strokeRect(h,d,p-h,f-d),ce.globalCompositeOperation="copy",l!=null||(l=new z),l.set(h/o,d/o,(p-h)/o,(f-d)/o),l}const qA=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function fs(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!qA.includes(i)&&(i=`"${i}"`),e[s]=i}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}const Ua={willReadFrequently:!0},Jt=class O{static get experimentalLetterSpacingSupported(){let t=O._experimentalLetterSpacingSupported;if(t===void 0){const e=L.get().getCanvasRenderingContext2D().prototype;t=O._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,n,o,a,u,l){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=u,this.fontProperties=l}static measureText(t=" ",e,s=O._canvas,i=e.wordWrap){var n;const o=fs(e),a=O.measureFont(o);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const u=O.__context;u.font=o;const l=(i?O._wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),c=new Array(l.length);let h=0;for(let m=0;m<l.length;m++){const _=O._measureText(l[m],e.letterSpacing,u);c[m]=_,h=Math.max(h,_)}const d=((n=e._stroke)==null?void 0:n.width)||0;let p=h+d;e.dropShadow&&(p+=e.dropShadow.distance);const f=e.lineHeight||a.fontSize;let g=Math.max(f,a.fontSize+d)+(l.length-1)*(f+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new O(t,e,p,g,l,c,f+e.leading,h,a)}static _measureText(t,e,s){let i=!1;O.experimentalLetterSpacingSupported&&(O.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,i=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));const n=s.measureText(t);let o=n.width;const a=-n.actualBoundingBoxLeft;let u=n.actualBoundingBoxRight-a;if(o>0)if(i)o-=e,u-=e;else{const l=(O.graphemeSegmenter(t).length-1)*e;o+=l,u+=l}return Math.max(o,u)}static _wordWrap(t,e,s=O._canvas){const i=s.getContext("2d",Ua);let n=0,o="",a="";const u=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,h=O._collapseSpaces(c),d=O._collapseNewlines(c);let p=!h;const f=e.wordWrapWidth+l,g=O._tokenize(t);for(let m=0;m<g.length;m++){let _=g[m];if(O._isNewline(_)){if(!d){a+=O._addLine(o),p=!h,o="",n=0;continue}_=" "}if(h){const x=O.isBreakingSpace(_),v=O.isBreakingSpace(o[o.length-1]);if(x&&v)continue}const b=O._getFromCache(_,l,u,i);if(b>f)if(o!==""&&(a+=O._addLine(o),o="",n=0),O.canBreakWords(_,e.breakWords)){const x=O.wordWrapSplit(_);for(let v=0;v<x.length;v++){let A=x[v],T=A,S=1;for(;x[v+S];){const P=x[v+S];if(!O.canBreakChars(T,P,_,v,e.breakWords))A+=P;else break;T=P,S++}v+=S-1;const B=O._getFromCache(A,l,u,i);B+n>f&&(a+=O._addLine(o),p=!1,o="",n=0),o+=A,n+=B}}else{o.length>0&&(a+=O._addLine(o),o="",n=0);const x=m===g.length-1;a+=O._addLine(_,!x),p=!1,o="",n=0}else b+n>f&&(p=!1,a+=O._addLine(o),o="",n=0),(o.length>0||!O.isBreakingSpace(_)||p)&&(o+=_,n+=b)}return a+=O._addLine(o,!1),a}static _addLine(t,e=!0){return t=O._trimRight(t),t=e?`${t}
`:t,t}static _getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=O._measureText(t,e,i)+e,s[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!O.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:O._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:O._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let i=0;i<t.length;i++){const n=t[i],o=t[i+1];if(O.isBreakingSpace(n,o)||O._isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,n){return!0}static wordWrapSplit(t){return O.graphemeSegmenter(t)}static measureFont(t){if(O._fonts[t])return O._fonts[t];const e=O._context;e.font=t;const s=e.measureText(O.METRICS_STRING+O.BASELINE_SYMBOL),i={ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent,fontSize:s.actualBoundingBoxAscent+s.actualBoundingBoxDescent};return O._fonts[t]=i,i}static clearMetrics(t=""){t?delete O._fonts[t]:O._fonts={}}static get _canvas(){if(!O.__canvas){let t;try{const e=new OffscreenCanvas(0,0),s=e.getContext("2d",Ua);if(s!=null&&s.measureText)return O.__canvas=e,e;t=L.get().createCanvas()}catch(e){t=L.get().createCanvas()}t.width=t.height=10,O.__canvas=t}return O.__canvas}static get _context(){return O.__context||(O.__context=O._canvas.getContext("2d",Ua)),O.__context}};Jt.METRICS_STRING="|\xC9q\xC5",Jt.BASELINE_SYMBOL="M",Jt.BASELINE_MULTIPLIER=1.4,Jt.HEIGHT_MULTIPLIER=2,Jt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>{const e=r.segment(t),s=[];let i=0;for(const n of e)s[i++]=n.segment;return s}}return r=>[...r]})(),Jt.experimentalLetterSpacing=!1,Jt._fonts={},Jt._newlines=[10,13],Jt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let kt=Jt;const mm=1e5;function ms(r,t,e,s=0){var i;if(r.texture===w.WHITE&&!r.fill)return X.shared.setValue(r.color).setAlpha((i=r.alpha)!=null?i:1).toHexa();if(r.fill){if(r.fill instanceof ls){const n=r.fill,o=t.createPattern(n.texture.source.resource,"repeat"),a=n.transform.copyTo(D.shared);return a.scale(n.texture.frame.width,n.texture.frame.height),o.setTransform(a),o}else if(r.fill instanceof Qt){const n=r.fill,o=n.type==="linear",a=n.textureSpace==="local";let u=1,l=1;a&&e&&(u=e.width+s,l=e.height+s);let c,h=!1;if(o){const{start:d,end:p}=n;c=t.createLinearGradient(d.x*u,d.y*l,p.x*u,p.y*l),h=Math.abs(p.x-d.x)<Math.abs((p.y-d.y)*.1)}else{const{center:d,innerRadius:p,outerCenter:f,outerRadius:g}=n;c=t.createRadialGradient(d.x*u,d.y*l,p*u,f.x*u,f.y*l,g*u)}if(h&&a&&e){const d=e.lineHeight/l;for(let p=0;p<e.lines.length;p++){const f=(p*e.lineHeight+s/2)/l;n.colorStops.forEach(g=>{const m=f+g.offset*d;c.addColorStop(Math.floor(m*mm)/mm,X.shared.setValue(g.color).toHex())})}}else n.colorStops.forEach(d=>{c.addColorStop(d.offset,X.shared.setValue(d.color).toHex())});return c}}else{const n=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(D.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),n.setTransform(o),n}return"red"}const gm=new z;let KA=class{getCanvasAndContext(t){const{text:e,style:s,resolution:i=1}=t,n=s._getFinalPadding(),o=kt.measureText(e||" ",s),a=Math.ceil(Math.ceil(Math.max(1,o.width)+n*2)*i),u=Math.ceil(Math.ceil(Math.max(1,o.height)+n*2)*i),l=le.getOptimalCanvasAndContext(a,u);this._renderTextToCanvas(e,s,n,i,l);const c=s.trim?fm({canvas:l.canvas,width:a,height:u,resolution:1,output:gm}):gm.set(0,0,a,u);return{canvasAndContext:l,frame:c}}returnCanvasAndContext(t){le.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,s,i,n){var o,a,u,l,c;const{canvas:h,context:d}=n,p=fs(e),f=kt.measureText(t||" ",e),g=f.lines,m=f.lineHeight,_=f.lineWidths,b=f.maxLineWidth,x=f.fontProperties,v=h.height;if(d.resetTransform(),d.scale(i,i),d.textBaseline=e.textBaseline,(o=e._stroke)!=null&&o.width){const B=e._stroke;d.lineWidth=B.width,d.miterLimit=B.miterLimit,d.lineJoin=B.join,d.lineCap=B.cap}d.font=p;let A,T;const S=e.dropShadow?2:1;for(let B=0;B<S;++B){const P=e.dropShadow&&B===0,C=P?Math.ceil(Math.max(1,v)+s*2):0,E=C*i;if(P){d.fillStyle="black",d.strokeStyle="black";const k=e.dropShadow,Bt=k.color,R=k.alpha;d.shadowColor=X.shared.setValue(Bt).setAlpha(R).toRgbaString();const M=k.blur*i,je=k.distance*i;d.shadowBlur=M,d.shadowOffsetX=Math.cos(k.angle)*je,d.shadowOffsetY=Math.sin(k.angle)*je+E}else{if(d.fillStyle=e._fill?ms(e._fill,d,f):null,(a=e._stroke)!=null&&a.width){const k=e._stroke.width*e._stroke.alignment;d.strokeStyle=ms(e._stroke,d,f,k)}d.shadowColor="black"}let G=(m-x.fontSize)/2;m-x.fontSize<0&&(G=0);const U=(l=(u=e._stroke)==null?void 0:u.width)!=null?l:0;for(let k=0;k<g.length;k++)A=U/2,T=U/2+k*m+x.ascent+G,e.align==="right"?A+=b-_[k]:e.align==="center"&&(A+=(b-_[k])/2),(c=e._stroke)!=null&&c.width&&this._drawLetterSpacing(g[k],e,n,A+s,T+s-C,!0),e._fill!==void 0&&this._drawLetterSpacing(g[k],e,n,A+s,T+s-C)}}_drawLetterSpacing(t,e,s,i,n,o=!1){const{context:a}=s,u=e.letterSpacing;let l=!1;if(kt.experimentalLetterSpacingSupported&&(kt.experimentalLetterSpacing?(a.letterSpacing=`${u}px`,a.textLetterSpacing=`${u}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),u===0||l){o?a.strokeText(t,i,n):a.fillText(t,i,n);return}let c=i;const h=kt.graphemeSegmenter(t);let d=a.measureText(t).width,p=0;for(let f=0;f<h.length;++f){const g=h[f];o?a.strokeText(g,c,n):a.fillText(g,c,n);let m="";for(let _=f+1;_<h.length;++_)m+=h[_];p=a.measureText(m).width,c+=d-p+u,d=p}}};const _r=new KA;class ka{constructor(t){this._renderer=t}getTexture(t,e,s,i){var n;typeof t=="string"&&(t={text:t,style:s,resolution:e}),t.style instanceof zt||(t.style=new zt(t.style)),t.textureStyle instanceof Ft||(t.textureStyle=new Ft(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());const{text:o,style:a,textureStyle:u}=t,l=(n=t.resolution)!=null?n:this._renderer.resolution,{frame:c,canvasAndContext:h}=_r.getCanvasAndContext({text:o,style:a,resolution:l}),d=Ia(h.canvas,c.width,c.height,l);if(u&&(d.source.style=u),a.trim&&(c.pad(a.padding),d.frame.copyFrom(c),d.updateUvs()),a.filters){const p=this._applyFilters(d,a.filters);return this.returnTexture(d),_r.returnCanvasAndContext(h),p}return this._renderer.texture.initSource(d._source),_r.returnCanvasAndContext(h),d}returnTexture(t){const e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",et.returnTexture(t,!0)}renderTextToCanvas(){}_applyFilters(t,e){const s=this._renderer.renderTarget.renderTarget,i=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(s,!1),i}destroy(){this._renderer=null}}ka.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"canvasText"},I.add(ka),I.add(va);var ZA=Object.defineProperty,Ii=Object.getOwnPropertySymbols,_m=Object.prototype.hasOwnProperty,xm=Object.prototype.propertyIsEnumerable,bm=(r,t,e)=>t in r?ZA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,QA=(r,t)=>{for(var e in t||(t={}))_m.call(t,e)&&bm(r,e,t[e]);if(Ii)for(var e of Ii(t))xm.call(t,e)&&bm(r,e,t[e]);return r},JA=(r,t)=>{var e={};for(var s in r)_m.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Ii)for(var s of Ii(r))t.indexOf(s)<0&&xm.call(r,s)&&(e[s]=r[s]);return e};class Dr extends ae{constructor(t){t instanceof pt&&(t={context:t});const e=t||{},{context:s,roundPixels:i}=e,n=JA(e,["context","roundPixels"]);super(QA({label:"Graphics"},n)),this.renderPipeId="graphics",s?this._context=s:this._context=this._ownedContext=new pt,this._context.on("update",this.onViewUpdate,this),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i!=null?i:!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Dr(this._context.clone()):(this._ownedContext=null,new Dr(this._context))}lineStyle(t,e,s){const i={};return t&&(i.width=t),e&&(i.color=e),s&&(i.alpha=s),this.context.strokeStyle=i,this}beginFill(t,e){const s={};return t!==void 0&&(s.color=t),e!==void 0&&(s.alpha=e),this.context.fillStyle=s,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==pt.defaultStrokeStyle.width||t.color!==pt.defaultStrokeStyle.color||t.alpha!==pt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const ym={name:"local-uniform-msdf-bit",vertex:{header:`
struct LocalUniforms {
uColor:vec4<f32>,
uTransformMatrix:mat3x3<f32>,
uDistance: f32,
uRound:f32,
}
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
struct LocalUniforms {
uColor:vec4<f32>,
uTransformMatrix:mat3x3<f32>,
uDistance: f32
}
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
`,main:`
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
`}},vm={name:"local-uniform-msdf-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix *= uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`},fragment:{header:`
uniform float uDistance;
`,main:`
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
`}},Tm={name:"msdf-bit",fragment:{header:`
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
// MSDF
var median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
var screenPxDistance = distance * (median - 0.5);
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}},Am={name:"msdf-bit",fragment:{header:`
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
// MSDF
float median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
float screenPxDistance = distance * (median - 0.5);
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
float gamma = mix(1.0, 1.0 / 2.2, luma);
float coverage = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}};let La,Na;class Sm extends Ot{constructor(t){const e=new rt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new D,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});La!=null||(La=ur({name:"sdf-shader",bits:[_i,bi(t),ym,Tm,cr]})),Na!=null||(Na=lr({name:"sdf-shader",bits:[xi,yi(t),vm,Am,hr]})),super({glProgram:Na,gpuProgram:La,resources:{localUniforms:e,batchSamplers:vi(t)}})}}class $a extends Ct{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const s in this.chars)(e=this.chars[s].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(s=>s.texture.destroy(!0)),this.pages=null)}}var tS=Object.defineProperty,Em=Object.getOwnPropertySymbols,eS=Object.prototype.hasOwnProperty,rS=Object.prototype.propertyIsEnumerable,wm=(r,t,e)=>t in r?tS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cm=(r,t)=>{for(var e in t||(t={}))eS.call(t,e)&&wm(r,e,t[e]);if(Em)for(var e of Em(t))rS.call(t,e)&&wm(r,e,t[e]);return r};const Rm=class xy extends $a{constructor(t){var e,s,i;super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const n=Cm(Cm({},xy.defaultOptions),t);this._textureSize=n.textureSize,this._mipmap=n.mipmap;const o=n.style.clone();n.overrideFill&&(o._fill.color=16777215,o._fill.alpha=1,o._fill.texture=w.WHITE,o._fill.fill=null),this.applyFillAsTint=n.overrideFill;const a=o.fontSize;o.fontSize=this.baseMeasurementFontSize;const u=fs(o);n.overrideSize?o._stroke&&(o._stroke.width*=this.baseRenderedFontSize/a):o.fontSize=this.baseRenderedFontSize=a,this._style=o,this._skipKerning=(e=n.skipKerning)!=null?e:!1,this.resolution=(s=n.resolution)!=null?s:1,this._padding=(i=n.padding)!=null?i:4,n.textureStyle&&(this._textureStyle=n.textureStyle instanceof Ft?n.textureStyle:new Ft(n.textureStyle)),this.fontMetrics=kt.measureFont(u),this.lineHeight=o.lineHeight||this.fontMetrics.fontSize||o.fontSize}ensureCharacters(t){var e,s,i,n;const o=kt.graphemeSegmenter(t).filter(v=>!this._currentChars.includes(v)).filter((v,A,T)=>T.indexOf(v)===A);if(!o.length)return;this._currentChars=[...this._currentChars,...o];let a;this._currentPageIndex===-1?a=this._nextPage():a=this.pages[this._currentPageIndex];let{canvas:u,context:l}=a.canvasAndContext,c=a.texture.source;const h=this._style;let d=this._currentX,p=this._currentY,f=this._currentMaxCharHeight;const g=this.baseRenderedFontSize/this.baseMeasurementFontSize,m=this._padding*g;let _=!1;const b=u.width/this.resolution,x=u.height/this.resolution;for(let v=0;v<o.length;v++){const A=o[v],T=kt.measureText(A,h,u,!1);T.lineHeight=T.height;const S=T.width*g,B=Math.ceil((h.fontStyle==="italic"?2:1)*S),P=T.height*g,C=B+m*2,E=P+m*2;if(_=!1,A!==`
`&&A!=="\r"&&A!==" "&&A!==" "&&(_=!0,f=Math.ceil(Math.max(E,f))),d+C>b&&(p+=f,f=E,d=0,p+f>x)){c.update();const U=this._nextPage();u=U.canvasAndContext.canvas,l=U.canvasAndContext.context,c=U.texture.source,d=0,p=0,f=0}const G=S/g-((s=(e=h.dropShadow)==null?void 0:e.distance)!=null?s:0)-((n=(i=h._stroke)==null?void 0:i.width)!=null?n:0);if(this.chars[A]={id:A.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:G,kerning:{}},_){this._drawGlyph(l,T,d+m,p+m,g,h);const U=c.width*g,k=c.height*g,Bt=new z(d/U*c.width,p/k*c.height,C/U*c.width,E/k*c.height);this.chars[A].texture=new w({source:c,frame:Bt}),d+=Math.ceil(C)}}c.update(),this._currentX=d,this._currentY=p,this._currentMaxCharHeight=f,this._skipKerning&&this._applyKerning(o,l)}get pageTextures(){return this.pages}_applyKerning(t,e){const s=this._measureCache;for(let i=0;i<t.length;i++){const n=t[i];for(let o=0;o<this._currentChars.length;o++){const a=this._currentChars[o];let u=s[n];u||(u=s[n]=e.measureText(n).width);let l=s[a];l||(l=s[a]=e.measureText(a).width);let c=e.measureText(n+a).width,h=c-(u+l);h&&(this.chars[n].kerning[a]=h),c=e.measureText(n+a).width,h=c-(u+l),h&&(this.chars[a].kerning[n]=h)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=le.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const s=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),i=new w({source:new xe({resource:e.canvas,resolution:s,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(i.source.style=this._textureStyle);const n={canvasAndContext:e,texture:i};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,s){var i;e.fontSize=this.baseRenderedFontSize,t.scale(s,s),t.font=fs(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const n=e._stroke,o=(i=n==null?void 0:n.width)!=null?i:0;if(n&&(t.lineWidth=o,t.lineJoin=n.join,t.miterLimit=n.miterLimit,t.strokeStyle=ms(n,t)),e._fill&&(t.fillStyle=ms(e._fill,t)),e.dropShadow){const a=e.dropShadow,u=X.shared.setValue(a.color).toArray(),l=a.blur*s,c=a.distance*s;t.shadowColor=`rgba(${u[0]*255},${u[1]*255},${u[2]*255},${a.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(a.angle)*c,t.shadowOffsetY=Math.sin(a.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,s,i,n,o){var a;const u=e.text,l=e.fontProperties,c=o._stroke,h=((a=c==null?void 0:c.width)!=null?a:0)*n,d=s+h/2,p=i-h/2,f=l.descent*n,g=e.lineHeight*n;o.stroke&&h&&t.strokeText(u,d,p+g-f),o._fill&&t.fillText(u,d,p+g-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:s}=this.pages[t];le.returnCanvasAndContext(e),s.destroy(!0)}this.pages=null}};Rm.defaultOptions={textureSize:512,style:new zt,mipmap:!0};let Xa=Rm;function Ha(r,t,e,s){const i={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};i.offsetY=e.baseLineOffset;let n=i.lines[0],o=null,a=!0;const u={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=f=>{const g=n.width;for(let m=0;m<u.index;m++){const _=f.positions[m];n.chars.push(f.chars[m]),n.charPositions.push(_+g)}n.width+=f.width,a=!1,u.width=0,u.index=0,u.chars.length=0},c=()=>{let f=n.chars.length-1;if(s){let g=n.chars[f];for(;g===" ";)n.width-=e.chars[g].xAdvance,g=n.chars[--f]}i.width=Math.max(i.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,i.lines.push(n),i.height+=e.lineHeight},h=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*h,p=t.wordWrapWidth*h;for(let f=0;f<r.length+1;f++){let g;const m=f===r.length;m||(g=r[f]);const _=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
`||m){if(!a&&t.wordWrap&&n.width+u.width-d>p?(c(),l(u),m||n.charPositions.push(0)):(u.start=n.width,l(u),m||n.charPositions.push(0)),g==="\r"||g===`
`)n.width!==0&&c();else if(!m){const b=_.xAdvance+(_.kerning[o]||0)+d;n.width+=b,n.spaceWidth=b,n.spacesIndex.push(n.charPositions.length),n.chars.push(g)}}else{const b=_.kerning[o]||0,x=_.xAdvance+b+d;u.positions[u.index++]=u.width+b,u.chars.push(g),u.width+=x}o=g}return c(),t.align==="center"?sS(i):t.align==="right"?iS(i):t.align==="justify"&&nS(i),i}function sS(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],s=r.width/2-e.width/2;for(let i=0;i<e.charPositions.length;i++)e.charPositions[i]+=s}}function iS(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],s=r.width-e.width;for(let i=0;i<e.charPositions.length;i++)e.charPositions[i]+=s}}function nS(r){const t=r.width;for(let e=0;e<r.lines.length;e++){const s=r.lines[e];let i=0,n=s.spacesIndex[i++],o=0;const a=s.spacesIndex.length,u=(t-s.width)/a;for(let l=0;l<s.charPositions.length;l++)l===n&&(n=s.spacesIndex[i++],o+=u),s.charPositions[l]+=o}}function Pm(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,s=r.length;e<s;e++){const i=r[e];if(Array.isArray(i)){if(i.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);if(i[0].length===0||i[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");const n=i[0].charCodeAt(0),o=i[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,u=o;a<=u;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(i))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var oS=Object.defineProperty,Dm=Object.getOwnPropertySymbols,aS=Object.prototype.hasOwnProperty,uS=Object.prototype.propertyIsEnumerable,Mm=(r,t,e)=>t in r?oS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,za=(r,t)=>{for(var e in t||(t={}))aS.call(t,e)&&Mm(r,e,t[e]);if(Dm)for(var e of Dm(t))uS.call(t,e)&&Mm(r,e,t[e]);return r};let Ui=0,lS=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null}}getFont(t,e){var s;let i=`${e.fontFamily}-bitmap`,n=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,n=!1;else if(e._stroke||e.dropShadow){let a=e.styleKey;a=a.substring(0,a.lastIndexOf("-")),i=`${a}-bitmap`,n=!1}if(!V.has(i)){const a=new Xa(za({style:e,overrideFill:n,overrideSize:!0},this.defaultOptions));Ui++,Ui>50&&Ut("BitmapText",`You have dynamically created ${Ui} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{Ui--,V.remove(i)}),V.set(i,a)}const o=V.get(i);return(s=o.ensureCharacters)==null||s.call(o,t),o}getLayout(t,e,s=!0){const i=this.getFont(t,e),n=kt.graphemeSegmenter(t);return Ha(n,e,i,s)}measureText(t,e,s=!0){return this.getLayout(t,e,s)}install(...t){var e,s,i,n;let o=t[0];typeof o=="string"&&(o={name:o,style:t[1],chars:(e=t[2])==null?void 0:e.chars,resolution:(s=t[2])==null?void 0:s.resolution,padding:(i=t[2])==null?void 0:i.padding,skipKerning:(n=t[2])==null?void 0:n.skipKerning});const a=o==null?void 0:o.name;if(!a)throw new Error("[BitmapFontManager] Property `name` is required.");o=za(za({},this.defaultOptions),o);const u=o.style,l=u instanceof zt?u:new zt(u),c=l._fill.fill!==null&&l._fill.fill!==void 0,h=new Xa({style:l,overrideFill:c,skipKerning:o.skipKerning,padding:o.padding,resolution:o.resolution,overrideSize:!1,textureStyle:o.textureStyle}),d=Pm(o.chars);return h.ensureCharacters(d.join("")),V.set(`${a}-bitmap`,h),h.once("destroy",()=>V.remove(`${a}-bitmap`)),h}uninstall(t){const e=`${t}-bitmap`,s=V.get(e);s&&s.destroy()}};const gs=new lS;class Om extends Dr{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}}class ja{constructor(t){this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){const e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const s=this._getGpuBitmapText(t);Bm(t,s),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,s)),this._renderer.renderPipes.graphics.addRenderable(s,e),s.context.customShader&&this._updateDistanceField(t)}updateRenderable(t){const e=this._getGpuBitmapText(t);Bm(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:s}=e,i=gs.getFont(t.text,t._style);s.clear(),i.distanceField.type!=="none"&&(s.customShader||(s.customShader=new Sm(this._renderer.limits.maxBatchableTextures)));const n=kt.graphemeSegmenter(t.text),o=t._style;let a=i.baseLineOffset;const u=Ha(n,o,i,!0);let l=0;const c=o.padding,h=u.scale;let d=u.width,p=u.height+u.offsetY;o._stroke&&(d+=o._stroke.width/h,p+=o._stroke.width/h),s.translate(-t._anchor._x*d-c,-t._anchor._y*p-c).scale(h,h);const f=i.applyFillAsTint?o._fill.color:16777215;for(let g=0;g<u.lines.length;g++){const m=u.lines[g];for(let _=0;_<m.charPositions.length;_++){const b=n[l++],x=i.chars[b];x!=null&&x.texture&&s.texture(x.texture,f||"black",Math.round(m.charPositions[_]+x.xOffset),Math.round(a+x.yOffset))}a+=i.lineHeight}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Om;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),e}_updateDistanceField(t){const e=this._getGpuBitmapText(t).context,s=t._style.fontFamily,i=V.get(`${s}-bitmap`),{a:n,b:o,c:a,d:u}=t.groupTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+u*u),h=(Math.abs(l)+Math.abs(c))/2,d=i.baseRenderedFontSize/t._style.fontSize,p=h*i.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=p}destroy(){this._renderer=null}}ja.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"bitmapText"};function Bm(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}I.add(ja);class Gm extends us{constructor(t){super(),this.generatingTexture=!1,this._renderer=t,t.runners.resolutionChange.add(this)}resolutionChange(){const t=this.renderable;t._autoResolution&&t.onViewUpdate()}destroy(){this._renderer.htmlText.returnTexturePromise(this.texturePromise),this.texturePromise=null,this._renderer=null}}class Va{constructor(t){this._renderer=t}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){const s=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t).catch(i=>{console.error(i)}),t._didTextUpdate=!1,Mi(s,t)),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}async _updateGpuText(t){t._didTextUpdate=!1;const e=this._getGpuText(t);if(e.generatingTexture)return;e.texturePromise&&(this._renderer.htmlText.returnTexturePromise(e.texturePromise),e.texturePromise=null),e.generatingTexture=!0,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const s=this._renderer.htmlText.getTexturePromise(t);e.texturePromise=s,e.texture=await s;const i=t.renderGroup||t.parentRenderGroup;i&&(i.structureDidChange=!0),e.generatingTexture=!1,Mi(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Gm(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.texture=w.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}}Va.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"htmlText"};function Fm(){const{userAgent:r}=L.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}const Im="http://www.w3.org/2000/svg",Um="http://www.w3.org/1999/xhtml";class Wa{constructor(){this.svgRoot=document.createElementNS(Im,"svg"),this.foreignObject=document.createElementNS(Im,"foreignObject"),this.domElement=document.createElementNS(Um,"div"),this.styleElement=document.createElementNS(Um,"style"),this.image=new Image;const{foreignObject:t,svgRoot:e,styleElement:s,domElement:i}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(s),t.appendChild(i)}}function km(r){const t=r._stroke,e=r._fill,s=[`div { ${[`color: ${X.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[Nm(t)]:[],...r.dropShadow?[Lm(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return cS(r.tagStyles,s),s.join(" ")}function Lm(r){const t=X.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),s=Math.round(Math.sin(r.angle)*r.distance),i=`${e}px ${s}px`;return r.blur>0?`text-shadow: ${i} ${r.blur}px ${t}`:`text-shadow: ${i} ${t}`}function Nm(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${X.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${X.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}const $m={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Xm={fill:r=>`color: ${X.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:Nm,dropShadow:Lm};function cS(r,t){for(const e in r){const s=r[e],i=[];for(const n in s)Xm[n]?i.push(Xm[n](s[n])):$m[n]&&i.push($m[n].replace("{{VALUE}}",s[n]));t.push(`${e} { ${i.join(";")} }`)}}var hS=Object.defineProperty,Hm=Object.getOwnPropertySymbols,dS=Object.prototype.hasOwnProperty,pS=Object.prototype.propertyIsEnumerable,zm=(r,t,e)=>t in r?hS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jm=(r,t)=>{for(var e in t||(t={}))dS.call(t,e)&&zm(r,e,t[e]);if(Hm)for(var e of Hm(t))pS.call(t,e)&&zm(r,e,t[e]);return r};class Is extends zt{constructor(t={}){var e,s;super(t),this._cssOverrides=[],this.cssOverrides=(e=t.cssOverrides)!=null?e:[],this.tagStyles=(s=t.tagStyles)!=null?s:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}update(){this._cssStyle=null,super.update()}clone(){return new Is({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?jm({},this.dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides,tagStyles:jm({},this.tagStyles)})}get cssStyle(){return this._cssStyle||(this._cssStyle=km(this)),this._cssStyle}addOverride(...t){const e=t.filter(s=>!this.cssOverrides.includes(s));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter(s=>this.cssOverrides.includes(s));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(s=>!e.includes(s)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function Vm(r,t){const e=t.fontFamily,s=[],i={},n=/font-family:([^;"\s]+)/g,o=r.match(n);function a(u){i[u]||(s.push(u),i[u]=!0)}if(Array.isArray(e))for(let u=0;u<e.length;u++)a(e[u]);else a(e);o&&o.forEach(u=>{const l=u.split(":")[1].trim();a(l)});for(const u in t.tagStyles){const l=t.tagStyles[u].fontFamily;a(l)}return s}async function Wm(r){const t=await(await L.get().fetch(r)).blob(),e=new FileReader;return await new Promise((s,i)=>{e.onloadend=()=>s(e.result),e.onerror=i,e.readAsDataURL(t)})}async function Ya(r,t){const e=await Wm(t);return`@font-face {
font-family: "${r.fontFamily}";
src: url('${e}');
font-weight: ${r.fontWeight};
font-style: ${r.fontStyle};
}`}const _s=new Map;async function Ym(r,t,e){const s=r.filter(i=>V.has(`${i}-and-url`)).map((i,n)=>{if(!_s.has(i)){const{url:o}=V.get(`${i}-and-url`);n===0?_s.set(i,Ya({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:i},o)):_s.set(i,Ya({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:i},o))}return _s.get(i)});return(await Promise.all(s)).join(`
`)}function qm(r,t,e,s,i){const{domElement:n,styleElement:o,svgRoot:a}=i;n.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,n.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),o.textContent=s;const{width:u,height:l}=i.image;return a.setAttribute("width",u.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}function Km(r,t){const e=le.getOptimalCanvasAndContext(r.width,r.height,t),{context:s}=e;return s.clearRect(0,0,r.width,r.height),s.drawImage(r,0,0),e}function Zm(r,t,e){return new Promise(async s=>{e&&await new Promise(i=>setTimeout(i,100)),r.onload=()=>{s()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}let Qm;function qa(r,t,e,s){s||(s=Qm||(Qm=new Wa));const{domElement:i,styleElement:n,svgRoot:o}=s;i.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,i.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(n.textContent=e),document.body.appendChild(o);const a=i.getBoundingClientRect();o.remove();const u=t.padding*2;return{width:a.width-u,height:a.height-u}}class Ka{constructor(t){this._renderer=t,this._createCanvas=t.type===vt.WEBGPU}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){const{text:e,style:s,resolution:i,textureStyle:n}=t,o=ut.get(Wa),a=Vm(e,s),u=await Ym(a,s,Is.defaultTextStyle),l=qa(e,s,u,o),c=Math.ceil(Math.ceil(Math.max(1,l.width)+s.padding*2)*i),h=Math.ceil(Math.ceil(Math.max(1,l.height)+s.padding*2)*i),d=o.image,p=2;d.width=(c|0)+p,d.height=(h|0)+p;const f=qm(e,s,i,u,o);await Zm(d,f,Fm()&&a.length>0);const g=d;let m;this._createCanvas&&(m=Km(d,i));const _=Ia(m?m.canvas:g,d.width-p,d.height-p,i);return n&&(_.source.style=n),this._createCanvas&&(this._renderer.texture.initSource(_.source),le.returnCanvasAndContext(m)),ut.return(o),_}returnTexturePromise(t){t.then(e=>{this._cleanUp(e)}).catch(()=>{})}_cleanUp(t){et.returnTexture(t,!0),t.source.resource=null,t.source.uploadMethodId="unknown"}destroy(){this._renderer=null}}Ka.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"htmlText"},I.add(Ka),I.add(Va);var fS=Object.defineProperty,Jm=Object.getOwnPropertySymbols,mS=Object.prototype.hasOwnProperty,gS=Object.prototype.propertyIsEnumerable,tg=(r,t,e)=>t in r?fS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,eg=(r,t)=>{for(var e in t||(t={}))mS.call(t,e)&&tg(r,e,t[e]);if(Jm)for(var e of Jm(t))gS.call(t,e)&&tg(r,e,t[e]);return r};const rg=class by extends Fe{constructor(...t){var e;let s=(e=t[0])!=null?e:{};s instanceof Float32Array&&(s={positions:s,uvs:t[1],indices:t[2]}),s=eg(eg({},by.defaultOptions),s);const i=s.positions||new Float32Array([0,0,1,0,1,1,0,1]);let n=s.uvs;n||(s.positions?n=new Float32Array(i.length):n=new Float32Array([0,0,1,0,1,1,0,1]));const o=s.indices||new Uint32Array([0,1,2,0,2,3]),a=s.shrinkBuffersToFit,u=new yt({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:$.VERTEX|$.COPY_DST}),l=new yt({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:$.VERTEX|$.COPY_DST}),c=new yt({data:o,label:"index-mesh-buffer",shrinkToFit:a,usage:$.INDEX|$.COPY_DST});super({attributes:{aPosition:{buffer:u,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:s.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};rg.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let $e=rg;var _S=Object.defineProperty,xS=Object.defineProperties,bS=Object.getOwnPropertyDescriptors,sg=Object.getOwnPropertySymbols,yS=Object.prototype.hasOwnProperty,vS=Object.prototype.propertyIsEnumerable,ig=(r,t,e)=>t in r?_S(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ng=(r,t)=>{for(var e in t||(t={}))yS.call(t,e)&&ig(r,e,t[e]);if(sg)for(var e of sg(t))vS.call(t,e)&&ig(r,e,t[e]);return r},og=(r,t)=>xS(r,bS(t));const xr={name:"local-uniform-bit",vertex:{header:`
struct LocalUniforms {
uTransformMatrix:mat3x3<f32>,
uColor:vec4<f32>,
uRound:f32,
}
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`}},ag=og(ng({},xr),{vertex:og(ng({},xr.vertex),{header:xr.vertex.header.replace("group(1)","group(2)")})}),ki={name:"local-uniform-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix = uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`}},ug={name:"tiling-bit",vertex:{header:`
struct TilingUniforms {
uMapCoord:mat3x3<f32>,
uClampFrame:vec4<f32>,
uClampOffset:vec2<f32>,
uTextureTransform:mat3x3<f32>,
uSizeAnchor:vec4<f32>
};
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d<f32>;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
`},fragment:{header:`
struct TilingUniforms {
uMapCoord:mat3x3<f32>,
uClampFrame:vec4<f32>,
uClampOffset:vec2<f32>,
uTextureTransform:mat3x3<f32>,
uSizeAnchor:vec4<f32>
};
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d<f32>;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
var unclamped = coord;
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
var bias = 0.;
if(unclamped.x == coord.x && unclamped.y == coord.y)
{
bias = -32.;
}
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
`}},lg={name:"tiling-bit",vertex:{header:`
uniform mat3 uTextureTransform;
uniform vec4 uSizeAnchor;
`,main:`
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
`},fragment:{header:`
uniform sampler2D uTexture;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
`,main:`
vec2 coord = vUV + ceil(uClampOffset - vUV);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
`}};let Za,Qa;class cg extends Ot{constructor(){Za!=null||(Za=ur({name:"tiling-sprite-shader",bits:[xr,ug,cr]})),Qa!=null||(Qa=lr({name:"tiling-sprite-shader",bits:[ki,lg,hr]}));const t=new rt({uMapCoord:{value:new D,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new D,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Qa,gpuProgram:Za,resources:{localUniforms:new rt({uTransformMatrix:{value:new D,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:w.EMPTY.source,uSampler:w.EMPTY.source.style}})}updateUniforms(t,e,s,i,n,o){const a=this.resources.tilingUniforms,u=o.width,l=o.height,c=o.textureMatrix,h=a.uniforms.uTextureTransform;h.set(s.a*u/t,s.b*u/e,s.c*l/t,s.d*l/e,s.tx/t,s.ty/e),h.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=n,o&&(this.resources.uTexture=o.source,this.resources.uSampler=o.source.style)}}class hg extends $e{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function dg(r,t){const e=r.anchor.x,s=r.anchor.y;t[0]=-e*r.width,t[1]=-s*r.height,t[2]=(1-e)*r.width,t[3]=-s*r.height,t[4]=(1-e)*r.width,t[5]=(1-s)*r.height,t[6]=-e*r.width,t[7]=(1-s)*r.height}function pg(r,t,e,s){let i=0;const n=r.length/(t||2),o=s.a,a=s.b,u=s.c,l=s.d,c=s.tx,h=s.ty;for(e*=t;i<n;){const d=r[e],p=r[e+1];r[e]=o*d+u*p+c,r[e+1]=a*d+l*p+h,e+=t,i++}}function fg(r,t){const e=r.texture,s=e.frame.width,i=e.frame.height;let n=0,o=0;r.applyAnchorToTexture&&(n=r.anchor.x,o=r.anchor.y),t[0]=t[6]=-n,t[2]=t[4]=1-n,t[1]=t[3]=-o,t[5]=t[7]=1-o;const a=D.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/s,r.height/i),pg(t,2,0,a)}const Li=new hg;class mg{constructor(){this.canBatch=!0,this.geometry=new $e({indices:Li.indices.slice(),positions:Li.positions.slice(),uvs:Li.uvs.slice()})}destroy(){var t;this.geometry.destroy(),(t=this.shader)==null||t.destroy()}}class Ja{constructor(t){this._state=Pt.default2d,this._renderer=t}validateRenderable(t){const e=this._getTilingSpriteData(t),s=e.canBatch;this._updateCanBatch(t);const i=e.canBatch;if(i&&i===s){const{batchableMesh:n}=e;return!n._batcher.checkAndUpdateTexture(n,t.texture)}return s!==i}addRenderable(t,e){const s=this._renderer.renderPipes.batch;this._updateCanBatch(t);const i=this._getTilingSpriteData(t),{geometry:n,canBatch:o}=i;if(o){i.batchableMesh||(i.batchableMesh=new Di);const a=i.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,s.addToBatch(a,e)}else s.break(e),i.shader||(i.shader=new cg),this.updateRenderable(t),e.add(t)}execute(t){const{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;const s=e.resources.localUniforms.uniforms;s.uTransformMatrix=t.groupTransform,s.uRound=this._renderer._roundPixels|t._roundPixels,fr(t.groupColorAlpha,s.uColor,0),this._state.blendMode=ir(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Li,shader:e,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:s}=e;if(s){const{batchableMesh:i}=e;t.didViewUpdate&&this._updateBatchableMesh(t),i._batcher.updateElement(i)}else if(t.didViewUpdate){const{shader:i}=e;i.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){const e=new mg;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){const e=this._getTilingSpriteData(t),{geometry:s}=e,i=t.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),fg(t,s.uvs),dg(t,s.positions)}destroy(){this._renderer=null}_updateCanBatch(t){const e=this._getTilingSpriteData(t),s=t.texture;let i=!0;return this._renderer.type===vt.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=s.textureMatrix.isSimple&&(i||s.source.isPowerOfTwo),e.canBatch}}Ja.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"tilingSprite"},I.add(Ja);var TS=Object.defineProperty,gg=Object.getOwnPropertySymbols,AS=Object.prototype.hasOwnProperty,SS=Object.prototype.propertyIsEnumerable,_g=(r,t,e)=>t in r?TS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xg=(r,t)=>{for(var e in t||(t={}))AS.call(t,e)&&_g(r,e,t[e]);if(gg)for(var e of gg(t))SS.call(t,e)&&_g(r,e,t[e]);return r};const bg=class yy extends $e{constructor(...t){var e;super({});let s=(e=t[0])!=null?e:{};typeof s=="number"&&(s={width:s,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(s)}build(t){var e,s,i,n;t=xg(xg({},yy.defaultOptions),t),this.verticesX=(e=this.verticesX)!=null?e:t.verticesX,this.verticesY=(s=this.verticesY)!=null?s:t.verticesY,this.width=(i=this.width)!=null?i:t.width,this.height=(n=this.height)!=null?n:t.height;const o=this.verticesX*this.verticesY,a=[],u=[],l=[],c=this.verticesX-1,h=this.verticesY-1,d=this.width/c,p=this.height/h;for(let g=0;g<o;g++){const m=g%this.verticesX,_=g/this.verticesX|0;a.push(m*d,_*p),u.push(m/c,_/h)}const f=c*h;for(let g=0;g<f;g++){const m=g%c,_=g/c|0,b=_*this.verticesX+m,x=_*this.verticesX+m+1,v=(_+1)*this.verticesX+m,A=(_+1)*this.verticesX+m+1;l.push(b,x,v,x,A,v)}this.buffers[0].data=new Float32Array(a),this.buffers[1].data=new Float32Array(u),this.indexBuffer.data=new Uint32Array(l),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};bg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let Ni=bg;var ES=Object.defineProperty,yg=Object.getOwnPropertySymbols,wS=Object.prototype.hasOwnProperty,CS=Object.prototype.propertyIsEnumerable,vg=(r,t,e)=>t in r?ES(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Tg=(r,t)=>{for(var e in t||(t={}))wS.call(t,e)&&vg(r,e,t[e]);if(yg)for(var e of yg(t))CS.call(t,e)&&vg(r,e,t[e]);return r};const Ag=class vy extends Ni{constructor(t={}){t=Tg(Tg({},vy.defaultOptions),t),super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){var e,s,i,n,o,a,u,l,c,h;this.width=(e=t.width)!=null?e:this.width,this.height=(s=t.height)!=null?s:this.height,this._originalWidth=(i=t.originalWidth)!=null?i:this._originalWidth,this._originalHeight=(n=t.originalHeight)!=null?n:this._originalHeight,this._leftWidth=(o=t.leftWidth)!=null?o:this._leftWidth,this._rightWidth=(a=t.rightWidth)!=null?a:this._rightWidth,this._topHeight=(u=t.topHeight)!=null?u:this._topHeight,this._bottomHeight=(l=t.bottomHeight)!=null?l:this._bottomHeight,this._anchorX=(c=t.anchor)==null?void 0:c.x,this._anchorY=(h=t.anchor)==null?void 0:h.y,this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,{width:e,height:s,_leftWidth:i,_rightWidth:n,_topHeight:o,_bottomHeight:a,_anchorX:u,_anchorY:l}=this,c=i+n,h=e>c?1:e/c,d=o+a,p=s>d?1:s/d,f=Math.min(h,p),g=u*e,m=l*s;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=i*f-g,t[4]=t[12]=t[20]=t[28]=e-n*f-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=o*f-m,t[17]=t[19]=t[21]=t[23]=s-a*f-m,t[25]=t[27]=t[29]=t[31]=s-m,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,s=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=s*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-s*this._bottomHeight,this.getBuffer("aUV").update()}};Ag.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let ye=Ag;class Sg extends Di{constructor(){super(),this.geometry=new ye}destroy(){this.geometry.destroy()}}class tu{constructor(t){this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=t._gpuData[this._renderer.uid]=new Sg,s=e;return s.renderable=t,s.transform=t.groupTransform,s.texture=t._texture,s.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,s),e}destroy(){this._renderer=null}}tu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"nineSliceSprite"},I.add(tu);class eu{constructor(t){this._renderer=t}push(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}eu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"filter"};function Eg(r,t){t.clear();const e=t.matrix;for(let s=0;s<r.length;s++){const i=r[s];i.globalDisplayStatus<7||(t.matrix=i.worldTransform,t.addBounds(i.bounds))}return t.matrix=e,t}const RS=new Fe({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});let PS=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new nt,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.outputOffset={x:0,y:0},this.globalFrame={x:0,y:0,width:0,height:0}}};class ru{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new rt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Zt({}),this.renderer=t}get activeBackTexture(){var t;return(t=this._activeFilterData)==null?void 0:t.backTexture}push(t){const e=this.renderer,s=t.filterEffect.filters,i=this._pushFilterData();i.skip=!1,i.filters=s,i.container=t.container,i.outputRenderSurface=e.renderTarget.renderSurface;const n=e.renderTarget.renderTarget.colorTexture.source,o=n.resolution,a=n.antialias;if(s.length===0){i.skip=!0;return}const u=i.bounds;if(t.renderables?Eg(t.renderables,u):t.filterEffect.filterArea?(u.clear(),u.addRect(t.filterEffect.filterArea),u.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,u),t.container){const f=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;f&&u.applyMatrix(f)}if(this._calculateFilterBounds(i,e.renderTarget.rootViewPort,a,o,1),i.skip)return;const l=this._getPreviousFilterData();let c=o,h=0,d=0;l&&(h=l.bounds.minX,d=l.bounds.minY,c=l.inputTexture.source._resolution),i.outputOffset.x=u.minX-h,i.outputOffset.y=u.minY-d;const p=i.globalFrame;if(p.x=h*c,p.y=d*c,p.width=n.width*c,p.height=n.height*c,i.backTexture=w.EMPTY,i.blendRequired){e.renderTarget.finishRenderPass();const f=e.renderTarget.getRenderTarget(i.outputRenderSurface);i.backTexture=this.getBackTexture(f,u,l==null?void 0:l.bounds)}i.inputTexture=et.getOptimalTexture(u.width,u.height,i.resolution,i.antialias),e.renderTarget.bind(i.inputTexture,!0),e.globalUniforms.push({offset:u})}generateFilteredTexture({texture:t,filters:e}){const s=this._pushFilterData();this._activeFilterData=s,s.skip=!1,s.filters=e;const i=t.source,n=i.resolution,o=i.antialias;if(e.length===0)return s.skip=!0,t;const a=s.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(s,a.rectangle,o,n,0),s.skip)return t;const u=n,l=0,c=0;s.outputOffset.x=-a.minX,s.outputOffset.y=-a.minY;const h=s.globalFrame;h.x=l*u,h.y=c*u,h.width=i.width*u,h.height=i.height*u,s.outputRenderSurface=et.getOptimalTexture(a.width,a.height,s.resolution,s.antialias),s.backTexture=w.EMPTY,s.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(s,!0);const d=s.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){const t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,!1),e.blendRequired&&et.returnTexture(e.backTexture),et.returnTexture(e.inputTexture))}getBackTexture(t,e,s){const i=t.colorTexture.source._resolution,n=et.getOptimalTexture(e.width,e.height,i,!1);let o=e.minX,a=e.minY;s&&(o-=s.minX,a-=s.minY),o=Math.floor(o*i),a=Math.floor(a*i);const u=Math.ceil(e.width*i),l=Math.ceil(e.height*i);return this.renderer.renderTarget.copyToTexture(t,n,{x:o,y:a},{width:u,height:l},{x:0,y:0}),n}applyFilter(t,e,s,i){const n=this.renderer,o=this._activeFilterData,a=o.outputRenderSurface,u=this._filterGlobalUniforms,l=u.uniforms,c=l.uOutputFrame,h=l.uInputSize,d=l.uInputPixel,p=l.uInputClamp,f=l.uGlobalFrame,g=l.uOutputTexture;a===s?(c[0]=o.outputOffset.x,c[1]=o.outputOffset.y):(c[0]=0,c[1]=0),c[2]=e.frame.width,c[3]=e.frame.height,h[0]=e.source.width,h[1]=e.source.height,h[2]=1/h[0],h[3]=1/h[1],d[0]=e.source.pixelWidth,d[1]=e.source.pixelHeight,d[2]=1/d[0],d[3]=1/d[1],p[0]=.5*d[2],p[1]=.5*d[3],p[2]=e.frame.width*h[2]-.5*d[2],p[3]=e.frame.height*h[3]-.5*d[3],f[0]=o.globalFrame.x,f[1]=o.globalFrame.y,f[2]=o.globalFrame.width,f[3]=o.globalFrame.height,s instanceof w&&(s.source.resource=null);const m=this.renderer.renderTarget.getRenderTarget(s);if(n.renderTarget.bind(s,!!i),s instanceof w?(g[0]=s.frame.width,g[1]=s.frame.height):(g[0]=m.width,g[1]=m.height),g[2]=m.isRoot?-1:1,u.update(),n.renderPipes.uniformBatch){const _=n.renderPipes.uniformBatch.getUboResource(u);this._globalFilterBindGroup.setResource(_,0)}else this._globalFilterBindGroup.setResource(u,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:RS,shader:t,state:t._state,topology:"triangle-list"}),n.type===vt.WEBGL&&n.renderTarget.finishRenderPass()}calculateSpriteMatrix(t,e){const s=this._activeFilterData,i=t.set(s.inputTexture._source.width,0,0,s.inputTexture._source.height,s.bounds.minX,s.bounds.minY),n=e.worldTransform.copyTo(D.shared),o=e.renderGroup||e.parentRenderGroup;return o&&o.cacheToLocalTransform&&n.prepend(o.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/e.texture.frame.width,1/e.texture.frame.height),i.translate(e.anchor.x,e.anchor.y),i}destroy(){}_applyFiltersToTexture(t,e){const s=t.inputTexture,i=t.bounds,n=t.filters;if(this._globalFilterBindGroup.setResource(s.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),n.length===1)n[0].apply(this,s,t.outputRenderSurface,e);else{let o=t.inputTexture;const a=et.getOptimalTexture(i.width,i.height,o.source._resolution,!1);let u=a,l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,o,u,!0);const c=o;o=u,u=c}n[l].apply(this,o,t.outputRenderSurface,e),et.returnTexture(a)}}_calculateFilterBounds(t,e,s,i,n){var o,a;const u=this.renderer,l=t.bounds,c=t.filters;let h=1/0,d=0,p=!0,f=!1,g=!1,m=!0;for(let _=0;_<c.length;_++){const b=c[_];if(h=Math.min(h,b.resolution==="inherit"?i:b.resolution),d+=b.padding,b.antialias==="off"?p=!1:b.antialias==="inherit"&&p&&(p=s),b.clipToViewport||(m=!1),!(b.compatibleRenderers&u.type)){g=!1;break}if(b.blendRequired&&!((a=(o=u.backBuffer)==null?void 0:o.useBackBuffer)==null||a)){g=!1;break}g=b.enabled||g,f||(f=b.blendRequired)}if(!g){t.skip=!0;return}if(m&&l.fitBounds(0,e.width/i,0,e.height/i),l.scale(h).ceil().scale(1/h).pad((d|0)*n),!l.isPositive){t.skip=!0;return}t.antialias=p,t.resolution=h,t.blendRequired=f}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new PS),this._filterStackIndex++,t}}ru.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"filter"},I.add(ru),I.add(eu);var DS={__proto__:null};const su=[];I.handleByNamedList(y.Environment,su);async function iu(r){if(!r)for(let t=0;t<su.length;t++){const e=su[t];if(e.value.test()){await e.value.load();return}}}async function MS(r){return iu(!r)}let xs;function nu(){if(typeof xs=="boolean")return xs;try{xs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(r){xs=!1}return xs}var Tt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(Tt||{});class ou{constructor(t){this.items=[],this._name=t}emit(t,e,s,i,n,o,a,u){const{name:l,items:c}=this;for(let h=0,d=c.length;h<d;h++)c[h][l](t,e,s,i,n,o,a,u);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}var OS=Object.defineProperty,wg=Object.getOwnPropertySymbols,BS=Object.prototype.hasOwnProperty,GS=Object.prototype.propertyIsEnumerable,Cg=(r,t,e)=>t in r?OS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$i=(r,t)=>{for(var e in t||(t={}))BS.call(t,e)&&Cg(r,e,t[e]);if(wg)for(var e of wg(t))GS.call(t,e)&&Cg(r,e,t[e]);return r};const FS=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Rg=class Ty extends Ct{constructor(t){var e;super(),this.uid=Y("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const s=[...FS,...(e=this.config.runners)!=null?e:[]];this._addRunners(...s),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await iu(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const s in this._systemsHash){const i=this._systemsHash[s].constructor.defaultOptions;t=$i($i({},i),t)}t=$i($i({},Ty.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let s=0;s<this.runners.init.items.length;s++)await this.runners.init.items[s].init(t);this._initOptions=t}render(t,e){var s,i;let n=t;if(n instanceof mt&&(n={container:n},e&&(n.target=e.renderTexture)),n.target||(n.target=this.view.renderTarget),n.target===this.view.renderTarget&&(this._lastObjectRendered=n.container,(s=n.clearColor)!=null||(n.clearColor=this.background.colorRgba),(i=n.clear)!=null||(n.clear=this.background.clearBeforeRender)),n.clearColor){const o=Array.isArray(n.clearColor)&&n.clearColor.length===4;n.clearColor=o?n.clearColor:X.shared.setValue(n.clearColor).toArray()}n.transform||(n.container.updateLocalTransform(),n.transform=n.container.localTransform),n.container.enableRenderGroup(),this.runners.prerender.emit(n),this.runners.renderStart.emit(n),this.runners.render.emit(n),this.runners.renderEnd.emit(n),this.runners.postrender.emit(n)}resize(t,e,s){const i=this.view.resolution;this.view.resize(t,e,s),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),s!==void 0&&s!==i&&this.runners.resolutionChange.emit(s)}clear(t={}){var e;const s=this;t.target||(t.target=s.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),(e=t.clear)!=null||(t.clear=Tt.ALL);const{clear:i,clearColor:n,target:o}=t;X.shared.setValue(n!=null?n:this.background.colorRgba),s.renderTarget.clear(o,i,X.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new ou(e)})}_addSystems(t){let e;for(e in t){const s=t[e];this._addSystem(s.value,s.name)}}_addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}_addPipes(t,e){const s=e.reduce((i,n)=>(i[n.name]=n.value,i),{});t.forEach(i=>{const n=i.value,o=i.name,a=s[o];this.renderPipes[o]=new n(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!nu())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};Rg.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let bs=Rg,au;function ys(r){return au!==void 0||(au=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:r!=null?r:bs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!L.get().getWebGLRenderingContext())return!1;let s=L.get().createCanvas().getContext("webgl",e);const i=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch(s){return!1}})()),au}let uu;async function vs(r={}){return uu!==void 0||(uu=await(async()=>{const t=L.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})()),uu}var IS=Object.defineProperty,Pg=Object.getOwnPropertySymbols,US=Object.prototype.hasOwnProperty,kS=Object.prototype.propertyIsEnumerable,Dg=(r,t,e)=>t in r?IS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ts=(r,t)=>{for(var e in t||(t={}))US.call(t,e)&&Dg(r,e,t[e]);if(Pg)for(var e of Pg(t))kS.call(t,e)&&Dg(r,e,t[e]);return r};const Mg=["webgl","webgpu","canvas"];async function Og(r){var t;let e=[];r.preference?(e.push(r.preference),Mg.forEach(o=>{o!==r.preference&&e.push(o)})):e=Mg.slice();let s,i={};for(let o=0;o<e.length;o++){const a=e[o];if(a==="webgpu"&&await vs()){const{WebGPURenderer:u}=await Promise.resolve().then(function(){return kR});s=u,i=Ts(Ts({},r),r.webgpu);break}else if(a==="webgl"&&ys((t=r.failIfMajorPerformanceCaveat)!=null?t:bs.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:u}=await Promise.resolve().then(function(){return yR});s=u,i=Ts(Ts({},r),r.webgl);break}else if(a==="canvas")throw i=Ts({},r),new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!s)throw new Error("No available renderer for the current environment");const n=new s;return await n.init(i),n}const LS=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,As="8.10.1";class lu{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,As)}static destroy(){}}lu.extension=y.Application;class cu{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,As)}destroy(){this._renderer=null}}cu.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"initHook",priority:-10};var NS=Object.defineProperty,Bg=Object.getOwnPropertySymbols,$S=Object.prototype.hasOwnProperty,XS=Object.prototype.propertyIsEnumerable,Gg=(r,t,e)=>t in r?NS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,HS=(r,t)=>{for(var e in t||(t={}))$S.call(t,e)&&Gg(r,e,t[e]);if(Bg)for(var e of Bg(t))XS.call(t,e)&&Gg(r,e,t[e]);return r};const Fg=class _c{constructor(...t){this.stage=new mt}async init(t){t=HS({},t),this.renderer=await Og(t),_c._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const s=_c._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Fg._plugins=[];let Ig=Fg;I.handleByList(y.Application,Ig._plugins),I.add(lu);class hu extends $a{constructor(t,e){var s;super();const{textures:i,data:n}=t;Object.keys(n.pages).forEach(o=>{const a=n.pages[parseInt(o,10)],u=i[a.id];this.pages.push({texture:u})}),Object.keys(n.chars).forEach(o=>{var a;const u=n.chars[o],{frame:l,source:c}=i[u.page],h=new z(u.x+l.x,u.y+l.y,u.width,u.height),d=new w({source:c,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:u.xOffset,yOffset:u.yOffset,xAdvance:u.xAdvance,kerning:(a=u.kerning)!=null?a:{},texture:d}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=(s=n.distanceField)!=null?s:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){gs.install(t)}static uninstall(t){gs.uninstall(t)}}const Xi={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){var t,e,s;const i=r.match(/^[a-z]+\s+.+$/gm),n={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const f in i){const g=i[f].match(/^[a-z]+/gm)[0],m=i[f].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),_={};for(const b in m){const x=m[b].split("="),v=x[0],A=x[1].replace(/"/gm,""),T=parseFloat(A),S=isNaN(T)?A:T;_[v]=S}n[g].push(_)}const o={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[a]=n.info,[u]=n.common,[l]=(t=n.distanceField)!=null?t:[];l&&(o.distanceField={range:parseInt(l.distanceRange,10),type:l.fieldType}),o.fontSize=parseInt(a.size,10),o.fontFamily=a.face,o.lineHeight=parseInt(u.lineHeight,10);const c=n.page;for(let f=0;f<c.length;f++)o.pages.push({id:parseInt(c[f].id,10)||0,file:c[f].file});const h={};o.baseLineOffset=o.lineHeight-parseInt(u.base,10);const d=n.char;for(let f=0;f<d.length;f++){const g=d[f],m=parseInt(g.id,10);let _=(s=(e=g.letter)!=null?e:g.char)!=null?s:String.fromCharCode(m);_==="space"&&(_=" "),h[m]=_,o.chars[_]={id:m,page:parseInt(g.page,10)||0,x:parseInt(g.x,10),y:parseInt(g.y,10),width:parseInt(g.width,10),height:parseInt(g.height,10),xOffset:parseInt(g.xoffset,10),yOffset:parseInt(g.yoffset,10),xAdvance:parseInt(g.xadvance,10),kerning:{}}}const p=n.kerning||[];for(let f=0;f<p.length;f++){const g=parseInt(p[f].first,10),m=parseInt(p[f].second,10),_=parseInt(p[f].amount,10);o.chars[h[m]].kerning[h[g]]=_}return o}},du={test(r){const t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){var t,e;const s={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},i=r.getElementsByTagName("info")[0],n=r.getElementsByTagName("common")[0],o=r.getElementsByTagName("distanceField")[0];o&&(s.distanceField={type:o.getAttribute("fieldType"),range:parseInt(o.getAttribute("distanceRange"),10)});const a=r.getElementsByTagName("page"),u=r.getElementsByTagName("char"),l=r.getElementsByTagName("kerning");s.fontSize=parseInt(i.getAttribute("size"),10),s.fontFamily=i.getAttribute("face"),s.lineHeight=parseInt(n.getAttribute("lineHeight"),10);for(let h=0;h<a.length;h++)s.pages.push({id:parseInt(a[h].getAttribute("id"),10)||0,file:a[h].getAttribute("file")});const c={};s.baseLineOffset=s.lineHeight-parseInt(n.getAttribute("base"),10);for(let h=0;h<u.length;h++){const d=u[h],p=parseInt(d.getAttribute("id"),10);let f=(e=(t=d.getAttribute("letter"))!=null?t:d.getAttribute("char"))!=null?e:String.fromCharCode(p);f==="space"&&(f=" "),c[p]=f,s.chars[f]={id:p,page:parseInt(d.getAttribute("page"),10)||0,x:parseInt(d.getAttribute("x"),10),y:parseInt(d.getAttribute("y"),10),width:parseInt(d.getAttribute("width"),10),height:parseInt(d.getAttribute("height"),10),xOffset:parseInt(d.getAttribute("xoffset"),10),yOffset:parseInt(d.getAttribute("yoffset"),10),xAdvance:parseInt(d.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<l.length;h++){const d=parseInt(l[h].getAttribute("first"),10),p=parseInt(l[h].getAttribute("second"),10),f=parseInt(l[h].getAttribute("amount"),10);s.chars[c[p]].kerning[c[d]]=f}return s}},pu={test(r){return typeof r=="string"&&r.includes("<font>")?du.test(L.get().parseXML(r)):!1},parse(r){return du.parse(L.get().parseXML(r))}},zS=[".xml",".fnt"],Ug={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof hu,getCacheableAssets(r,t){const e={};return r.forEach(s=>{e[s]=t,e[`${s}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},kg={extension:{type:y.LoadParser,priority:wt.Normal},name:"loadBitmapFont",test(r){return zS.includes(bt.extname(r).toLowerCase())},async testParse(r){return Xi.test(r)||pu.test(r)},async parse(r,t,e){const s=Xi.test(r)?Xi.parse(r):pu.parse(r),{src:i}=t,{pages:n}=s,o=[],a=s.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let c=0;c<n.length;++c){const h=n[c].file;let d=bt.join(bt.dirname(i),h);d=Zs(d,i),o.push({src:d,data:a})}const u=await e.load(o),l=o.map(c=>u[c.src]);return new hu({data:s,textures:l},i)},async load(r,t){return await(await L.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(s=>e.unload(s.texture.source._sourceOrigin))),r.destroy()}};class Lg{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<e;s++)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())}}const Ng={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof w),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(n===0?"":n+1)]=i})}),e}};async function fu(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const $g={extension:{type:y.DetectionParser,priority:1},test:async()=>fu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")},Xg=["png","jpg","jpeg"],Hg={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Xg],remove:async r=>r.filter(t=>!Xg.includes(t))},jS="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Hi(r){return jS?!1:document.createElement("video").canPlayType(r)!==""}const zg={extension:{type:y.DetectionParser,priority:0},test:async()=>Hi("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")},jg={extension:{type:y.DetectionParser,priority:0},test:async()=>Hi("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")},Vg={extension:{type:y.DetectionParser,priority:0},test:async()=>Hi("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")},Wg={extension:{type:y.DetectionParser,priority:0},test:async()=>fu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};var VS=Object.defineProperty,WS=Object.defineProperties,YS=Object.getOwnPropertyDescriptors,Yg=Object.getOwnPropertySymbols,qS=Object.prototype.hasOwnProperty,KS=Object.prototype.propertyIsEnumerable,qg=(r,t,e)=>t in r?VS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ZS=(r,t)=>{for(var e in t||(t={}))qS.call(t,e)&&qg(r,e,t[e]);if(Yg)for(var e of Yg(t))KS.call(t,e)&&qg(r,e,t[e]);return r},QS=(r,t)=>WS(r,YS(t));class Kg{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var i,n;let o=null,a=null;if(e.loadParser&&(a=this._parserHash[e.loadParser]),!a){for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];if(l.load&&(i=l.test)!=null&&i.call(l,t,e,this)){a=l;break}}if(!a)return null}o=await a.load(t,e,this),s.parser=a;for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];l.parse&&l.parse&&await((n=l.testParse)==null?void 0:n.call(l,o,e,this))&&(o=await l.parse(o,e,this)||o,s.parser=l)}return o})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const i={},n=Wr(t),o=Gt(t,l=>({alias:[l],src:l,data:{}})),a=o.length,u=o.map(async l=>{const c=bt.toAbsolute(l.src);if(!i[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),i[l.src]=await this.promiseCache[c].promise,e&&e(++s/a)}catch(h){throw delete this.promiseCache[c],delete i[l.src],new Error(`[Loader.load] Failed to load ${c}.
${h}`)}});return await Promise.all(u),n?i[o[0].src]:i}async unload(t){const e=Gt(t,s=>({alias:[s],src:s})).map(async s=>{var i,n;const o=bt.toAbsolute(s.src),a=this.promiseCache[o];if(a){const u=await a.promise;delete this.promiseCache[o],await((n=(i=a.parser)==null?void 0:i.unload)==null?void 0:n.call(i,u,s,this))}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name&&t[e.name],QS(ZS({},t),{[e.name]:e})),{})}}function Xe(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Lt(r,t){const e=r.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const JS=".json",t3="application/json",Zg={extension:{type:y.LoadParser,priority:wt.Low},name:"loadJson",test(r){return Xe(r,t3)||Lt(r,JS)},async load(r){return await(await L.get().fetch(r)).json()}},e3=".txt",r3="text/plain",Qg={name:"loadTxt",extension:{type:y.LoadParser,priority:wt.Low,name:"loadTxt"},test(r){return Xe(r,r3)||Lt(r,e3)},async load(r){return await(await L.get().fetch(r)).text()}};var s3=Object.defineProperty,i3=Object.defineProperties,n3=Object.getOwnPropertyDescriptors,Jg=Object.getOwnPropertySymbols,o3=Object.prototype.hasOwnProperty,a3=Object.prototype.propertyIsEnumerable,t_=(r,t,e)=>t in r?s3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,u3=(r,t)=>{for(var e in t||(t={}))o3.call(t,e)&&t_(r,e,t[e]);if(Jg)for(var e of Jg(t))a3.call(t,e)&&t_(r,e,t[e]);return r},l3=(r,t)=>i3(r,n3(t));const c3=["normal","bold","100","200","300","400","500","600","700","800","900"],h3=[".ttf",".otf",".woff",".woff2"],d3=["font/ttf","font/otf","font/woff","font/woff2"],p3=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function e_(r){const t=bt.extname(r),e=bt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(p3)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const f3=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function m3(r){return f3.test(r)?r:encodeURI(r)}const r_={extension:{type:y.LoadParser,priority:wt.Low},name:"loadWebFont",test(r){return Xe(r,d3)||Lt(r,h3)},async load(r,t){var e,s,i,n,o,a;const u=L.get().getFontFaceSet();if(u){const l=[],c=(s=(e=t.data)==null?void 0:e.family)!=null?s:e_(r),h=(o=(n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(p=>c3.includes(p)))!=null?o:["normal"],d=(a=t.data)!=null?a:{};for(let p=0;p<h.length;p++){const f=h[p],g=new FontFace(c,`url(${m3(r)})`,l3(u3({},d),{weight:f}));await g.load(),u.add(g),l.push(g)}return V.set(`${c}-and-url`,{url:r,fontFaces:l}),l.length===1?l[0]:l}return null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{V.remove(`${t.family}-and-url`),L.get().getFontFaceSet().delete(t)})}};function zi(r,t=1){var e;const s=(e=_e.RETINA_PREFIX)==null?void 0:e.exec(r);return s?parseFloat(s[1]):t}function ve(r,t,e){r.label=e,r._sourceOrigin=e;const s=new w({source:r,label:e}),i=()=>{delete t.promiseCache[e],V.has(e)&&V.remove(e)};return s.source.once("destroy",()=>{t.promiseCache[e]&&i()}),s.once("destroy",()=>{r.destroyed||i()}),s}var g3=Object.defineProperty,ji=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,i_=Object.prototype.propertyIsEnumerable,n_=(r,t,e)=>t in r?g3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_3=(r,t)=>{for(var e in t||(t={}))s_.call(t,e)&&n_(r,e,t[e]);if(ji)for(var e of ji(t))i_.call(t,e)&&n_(r,e,t[e]);return r},x3=(r,t)=>{var e={};for(var s in r)s_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&ji)for(var s of ji(r))t.indexOf(s)<0&&i_.call(r,s)&&(e[s]=r[s]);return e};const b3=".svg",y3="image/svg+xml",o_={extension:{type:y.LoadParser,priority:wt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return Xe(r,y3)||Lt(r,b3)},async load(r,t,e){var s,i;return((i=(s=t.data)==null?void 0:s.parseAsGraphicsContext)!=null?i:this.config.parseAsGraphicsContext)?T3(r):v3(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function v3(r,t,e,s){var i,n,o,a,u,l;const c=await(await L.get().fetch(r)).blob(),h=URL.createObjectURL(c),d=new Image;d.src=h,d.crossOrigin=s,await d.decode(),URL.revokeObjectURL(h);const p=document.createElement("canvas"),f=p.getContext("2d"),g=((i=t.data)==null?void 0:i.resolution)||zi(r),m=(o=(n=t.data)==null?void 0:n.width)!=null?o:d.width,_=(u=(a=t.data)==null?void 0:a.height)!=null?u:d.height;p.width=m*g,p.height=_*g,f.drawImage(d,0,0,m*g,_*g);const b=(l=t.data)!=null?l:{},{parseAsGraphicsContext:x}=b,v=x3(b,["parseAsGraphicsContext"]),A=new xe(_3({resource:p,alphaMode:"premultiply-alpha-on-upload",resolution:g},v));return ve(A,e,r)}async function T3(r){const t=await(await L.get().fetch(r)).text(),e=new pt;return e.svg(t),e}const A3=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})();
`;let br=null,mu=class{constructor(){br||(br=URL.createObjectURL(new Blob([A3],{type:"application/javascript"}))),this.worker=new Worker(br)}};mu.revokeObjectURL=function(){br&&(URL.revokeObjectURL(br),br=null)};const S3='(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n';let yr=null,a_=class{constructor(){yr||(yr=URL.createObjectURL(new Blob([S3],{type:"application/javascript"}))),this.worker=new Worker(yr)}};a_.revokeObjectURL=function(){yr&&(URL.revokeObjectURL(yr),yr=null)};let u_=0,gu,E3=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new mu;e.addEventListener("message",s=>{e.terminate(),mu.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var s;return this._run("loadImageBitmap",[t,(s=e==null?void 0:e.data)==null?void 0:s.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){gu===void 0&&(gu=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<gu&&(this._createdWorkers++,t=new a_().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((i,n)=>{this._queue.push({id:t,arguments:e,resolve:i,reject:n})});return this._next(),s}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),s=e.id;this._resolveHash[u_]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:u_++,id:s})}};const _u=new E3;var w3=Object.defineProperty,l_=Object.getOwnPropertySymbols,C3=Object.prototype.hasOwnProperty,R3=Object.prototype.propertyIsEnumerable,c_=(r,t,e)=>t in r?w3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,P3=(r,t)=>{for(var e in t||(t={}))C3.call(t,e)&&c_(r,e,t[e]);if(l_)for(var e of l_(t))R3.call(t,e)&&c_(r,e,t[e]);return r};const D3=[".jpeg",".jpg",".png",".webp",".avif"],M3=["image/jpeg","image/png","image/webp","image/avif"];async function h_(r,t){var e;const s=await L.get().fetch(r);if(!s.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${s.status} ${s.statusText}`);const i=await s.blob();return((e=t==null?void 0:t.data)==null?void 0:e.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const xu={name:"loadTextures",extension:{type:y.LoadParser,priority:wt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Xe(r,M3)||Lt(r,D3)},async load(r,t,e){var s;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await _u.isImageBitmapSupported()?i=await _u.loadImageBitmap(r,t):i=await h_(r,t):i=await new Promise((o,a)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=a)});const n=new xe(P3({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((s=t.data)==null?void 0:s.resolution)||zi(r)},t.data));return ve(n,e,r)},unload(r){r.destroy(!0)}};var O3=Object.defineProperty,B3=Object.defineProperties,G3=Object.getOwnPropertyDescriptors,d_=Object.getOwnPropertySymbols,F3=Object.prototype.hasOwnProperty,I3=Object.prototype.propertyIsEnumerable,p_=(r,t,e)=>t in r?O3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,bu=(r,t)=>{for(var e in t||(t={}))F3.call(t,e)&&p_(r,e,t[e]);if(d_)for(var e of d_(t))I3.call(t,e)&&p_(r,e,t[e]);return r},f_=(r,t)=>B3(r,G3(t));const m_=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],U3=m_.map(r=>`video/${r.substring(1)}`);function g_(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=x_(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function __(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",s),r.addEventListener("error",i),r.load();function s(){n(),t()}function i(o){n(),e(o)}function n(){r.removeEventListener("canplaythrough",s),r.removeEventListener("error",i)}})}function x_(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}const b_={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(r){const t=Xe(r,U3),e=Lt(r,m_);return t||e},async load(r,t,e){var s,i;const n=bu(f_(bu({},ts.defaultOptions),{resolution:((s=t.data)==null?void 0:s.resolution)||zi(r),alphaMode:((i=t.data)==null?void 0:i.alphaMode)||await Do()}),t.data),o=document.createElement("video"),a={preload:n.autoLoad!==!1?"auto":void 0,"webkit-playsinline":n.playsinline!==!1?"":void 0,playsinline:n.playsinline!==!1?"":void 0,muted:n.muted===!0?"":void 0,loop:n.loop===!0?"":void 0,autoplay:n.autoPlay!==!1?"":void 0};Object.keys(a).forEach(c=>{const h=a[c];h!==void 0&&o.setAttribute(c,h)}),n.muted===!0&&(o.muted=!0),g_(o,r,n.crossorigin);const u=document.createElement("source");let l;if(r.startsWith("data:"))l=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){const c=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();l=ts.MIME_TYPES[c]||`video/${c}`}return u.src=r,l&&(u.type=l),new Promise(c=>{const h=async()=>{const d=new ts(f_(bu({},n),{resource:o}));o.removeEventListener("canplay",h),t.data.preload&&await __(o),c(ve(d,e,r))};n.preload&&!n.autoPlay&&o.load(),o.addEventListener("canplay",h),o.appendChild(u)})},unload(r){r.destroy(!0)}},yu={extension:{type:y.ResolveParser,name:"resolveTexture"},test:xu.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=_e.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:r.split(".").pop(),src:r}}},y_={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:r=>_e.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:yu.parse};class v_{constructor(){this._detections=[],this._initialized=!1,this.resolver=new _e,this.loader=new Kg,this.cache=V,this._backgroundLoader=new Lg(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,i;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let u=t.manifest;typeof u=="string"&&(u=await this.load(u)),this.resolver.addManifest(u)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,o=typeof n=="number"?[n]:n,a=await this._detectFormats({preferredFormats:(i=t.texturePreference)==null?void 0:i.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:a,resolution:o}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const s=Wr(t),i=Gt(t).map(a=>{if(typeof a!="string"){const u=this.resolver.getAlias(a);return u.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(u)?u[0]:u}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(i),o=await this._mapLoadToResolve(n,e);return s?o[i[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),n={},o=Object.keys(i);let a=0,u=0;const l=()=>{e==null||e(++a/u)},c=o.map(h=>{const d=i[h];return u+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[h]=p})});return await Promise.all(c),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return V.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=V.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const i=await this.loader.load(s,e);this._backgroundLoader.active=!0;const n={};return s.forEach(o=>{const a=i[o.src],u=[o.src];o.alias&&u.push(...o.alias),u.forEach(l=>{n[l]=a}),V.set(u,a)}),n}async unload(t){this._initialized||await this.init();const e=Gt(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Gt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{V.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Ss=new v_;I.handleByList(y.LoadParser,Ss.loader.parsers).handleByList(y.ResolveParser,Ss.resolver.parsers).handleByList(y.CacheParser,Ss.cache.parsers).handleByList(y.DetectionParser,Ss.detections),I.add(Ng,Hg,$g,Wg,zg,jg,Vg,Zg,Qg,r_,o_,xu,b_,kg,Ug,yu,y_);const T_={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};I.handle(y.Asset,r=>{const t=r.ref;Object.entries(T_).filter(([e])=>!!t[e]).forEach(([e,s])=>{var i;return I.add(Object.assign(t[e],{extension:(i=t[e].extension)!=null?i:s}))})},r=>{const t=r.ref;Object.keys(T_).filter(e=>!!t[e]).forEach(e=>I.remove(t[e]))});const k3={extension:{type:y.DetectionParser,priority:3},test:async()=>!!(await vs()||ys()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>t!=="basis")};class Es extends q{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let Vi;function vu(){if(Vi)return Vi;const r=document.createElement("canvas").getContext("webgl");return r?(Vi=[...r.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...r.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...r.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...r.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Vi):[]}let Wi;async function Tu(){if(Wi)return Wi;const r=await L.get().getNavigator().gpu.requestAdapter();return Wi=[...r.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...r.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Wi}let Au;async function Su(){return Au!==void 0||(Au=await(async()=>{const r=await vs(),t=ys();if(r&&t){const e=await Tu(),s=vu();return e.filter(i=>s.includes(i))}else{if(r)return await Tu();if(t)return vu()}return[]})()),Au}const A_=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let Yi;async function ws(){if(Yi!==void 0)return Yi;const r=await Su();return Yi=[...A_,...r],Yi}const L3='(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e<s;++e)for(let o=0;o<t;++o){const B=r.getImageTranscodedSizeInBytes(o,e,a),f=new Uint8Array(B);if(!r.transcodeImage(f,o,e,a,1,0))throw new Error("transcodeImage failed");m.push(f)}return m}const w={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function d(r){const a=w[r];if(a)return a;throw new Error(`Unsupported transcoderFormat: ${r}`)}const n={jsUrl:"basis/basis_transcoder.js",wasmUrl:"basis/basis_transcoder.wasm"};let u,i,c;async function l(){if(!c){const r=new URL(n.jsUrl,location.origin).href,a=new URL(n.wasmUrl,location.origin).href;importScripts(r),c=new Promise(t=>{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)}})();\n';let vr=null,S_=class{constructor(){vr||(vr=URL.createObjectURL(new Blob([L3],{type:"application/javascript"}))),this.worker=new Worker(vr)}};S_.revokeObjectURL=function(){vr&&(URL.revokeObjectURL(vr),vr=null)};const qi={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};function N3(r){Object.assign(qi,r)}let Cs;const E_={};function $3(r){return Cs||(Cs=new S_().worker,Cs.onmessage=t=>{const{success:e,url:s,textureOptions:i}=t.data;e||console.warn("Failed to load Basis texture",s),E_[s](i)},Cs.postMessage({type:"init",jsUrl:qi.jsUrl,wasmUrl:qi.wasmUrl,supportedTextures:r})),Cs}function w_(r,t){const e=$3(t);return new Promise(s=>{E_[r]=s,e.postMessage({type:"load",url:r})})}const X3={extension:{type:y.LoadParser,priority:wt.High,name:"loadBasis"},name:"loadBasis",test(r){return Lt(r,[".basis"])},async load(r,t,e){const s=await ws(),i=await w_(r,s),n=new Es(i);return ve(n,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};function H3(r,t){const e=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const i=[];for(let n=0;n<s;++n)for(let o=0;o<e;++o){const a=r.getImageTranscodedSizeInBytes(o,n,t),u=new Uint8Array(a);if(!r.transcodeImage(u,o,n,t,1,0))throw new Error("transcodeImage failed");i.push(u)}return i}const z3={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function j3(r){const t=z3[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const V3={MAGIC:0,SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19,PF_FLAGS:20,FOURCC:21,RGB_BITCOUNT:22,R_BIT_MASK:23,G_BIT_MASK:24,B_BIT_MASK:25,A_BIT_MASK:26},W3={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4};var Eu=(r=>(r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",r))(Eu||{}),wu=(r=>(r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",r))(wu||{});function lt(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var At=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.R8G8B8=20]="R8G8B8",r[r.A8R8G8B8=21]="A8R8G8B8",r[r.X8R8G8B8=22]="X8R8G8B8",r[r.R5G6B5=23]="R5G6B5",r[r.X1R5G5B5=24]="X1R5G5B5",r[r.A1R5G5B5=25]="A1R5G5B5",r[r.A4R4G4B4=26]="A4R4G4B4",r[r.R3G3B2=27]="R3G3B2",r[r.A8=28]="A8",r[r.A8R3G3B2=29]="A8R3G3B2",r[r.X4R4G4B4=30]="X4R4G4B4",r[r.A2B10G10R10=31]="A2B10G10R10",r[r.A8B8G8R8=32]="A8B8G8R8",r[r.X8B8G8R8=33]="X8B8G8R8",r[r.G16R16=34]="G16R16",r[r.A2R10G10B10=35]="A2R10G10B10",r[r.A16B16G16R16=36]="A16B16G16R16",r[r.A8P8=40]="A8P8",r[r.P8=41]="P8",r[r.L8=50]="L8",r[r.A8L8=51]="A8L8",r[r.A4L4=52]="A4L4",r[r.V8U8=60]="V8U8",r[r.L6V5U5=61]="L6V5U5",r[r.X8L8V8U8=62]="X8L8V8U8",r[r.Q8W8V8U8=63]="Q8W8V8U8",r[r.V16U16=64]="V16U16",r[r.A2W10V10U10=67]="A2W10V10U10",r[r.Q16W16V16U16=110]="Q16W16V16U16",r[r.R16F=111]="R16F",r[r.G16R16F=112]="G16R16F",r[r.A16B16G16R16F=113]="A16B16G16R16F",r[r.R32F=114]="R32F",r[r.G32R32F=115]="G32R32F",r[r.A32B32G32R32F=116]="A32B32G32R32F",r[r.UYVY=lt("UYVY")]="UYVY",r[r.R8G8_B8G8=lt("RGBG")]="R8G8_B8G8",r[r.YUY2=lt("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=lt("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=lt("DXT1")]="DXT1",r[r.DXT2=lt("DXT2")]="DXT2",r[r.DXT3=lt("DXT3")]="DXT3",r[r.DXT4=lt("DXT4")]="DXT4",r[r.DXT5=lt("DXT5")]="DXT5",r[r.ATI1=lt("ATI1")]="ATI1",r[r.AT1N=lt("AT1N")]="AT1N",r[r.ATI2=lt("ATI2")]="ATI2",r[r.AT2N=lt("AT2N")]="AT2N",r[r.BC4U=lt("BC4U")]="BC4U",r[r.BC4S=lt("BC4S")]="BC4S",r[r.BC5U=lt("BC5U")]="BC5U",r[r.BC5S=lt("BC5S")]="BC5S",r[r.DX10=lt("DX10")]="DX10",r))(At||{});const Cu={[At.DXT1]:"bc1-rgba-unorm",[At.DXT2]:"bc2-rgba-unorm",[At.DXT3]:"bc2-rgba-unorm",[At.DXT4]:"bc3-rgba-unorm",[At.DXT5]:"bc3-rgba-unorm",[At.ATI1]:"bc4-r-unorm",[At.BC4U]:"bc4-r-unorm",[At.BC4S]:"bc4-r-snorm",[At.ATI2]:"bc5-rg-unorm",[At.BC5U]:"bc5-rg-unorm",[At.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},St={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},F={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:V3,HEADER_DX10_FIELDS:W3,DXGI_FORMAT:Eu,D3D10_RESOURCE_DIMENSION:wu,D3DFMT:At},C_={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function R_(r,t){const{format:e,fourCC:s,width:i,height:n,dataOffset:o,mipmapCount:a}=q3(r);if(!t.includes(e))throw new Error(`Unsupported texture format: ${s} ${e}, supported: ${t}`);if(a<=1)return{format:e,width:i,height:n,resource:[new Uint8Array(r,o)],alphaMode:"no-premultiply-alpha"};const u=Y3(e,i,n,o,a,r);return{format:e,width:i,height:n,resource:u,alphaMode:"no-premultiply-alpha"}}function Y3(r,t,e,s,i,n){const o=[],a=C_[r];let u=t,l=e,c=s;for(let h=0;h<i;++h){const d=Math.ceil(Math.max(4,u)/4)*4,p=Math.ceil(Math.max(4,l)/4)*4,f=a?d/4*p/4*a:u*l*4,g=new Uint8Array(n,c,f);o.push(g),c+=f,u=Math.max(u>>1,1),l=Math.max(l>>1,1)}return o}function q3(r){const t=new Uint32Array(r,0,F.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[F.HEADER_FIELDS.MAGIC]!==F.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const e=t[F.HEADER_FIELDS.HEIGHT],s=t[F.HEADER_FIELDS.WIDTH],i=Math.max(1,t[F.HEADER_FIELDS.MIPMAP_COUNT]),n=t[F.HEADER_FIELDS.PF_FLAGS],o=t[F.HEADER_FIELDS.FOURCC],a=K3(t,n,o,r),u=F.MAGIC_SIZE+F.HEADER_SIZE+(o===F.D3DFMT.DX10?F.HEADER_DX10_SIZE:0);return{format:a,fourCC:o,width:s,height:e,dataOffset:u,mipmapCount:i}}function K3(r,t,e,s){if(t&F.PIXEL_FORMAT_FLAGS.FOURCC){if(e===F.D3DFMT.DX10){const i=new Uint32Array(s,F.MAGIC_SIZE+F.HEADER_SIZE,F.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(i[F.HEADER_DX10_FIELDS.MISC_FLAG]===F.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(i[F.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===F.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const n=i[F.HEADER_DX10_FIELDS.DXGI_FORMAT];if(n in St)return St[n];throw new Error(`DDSParser cannot parse texture data with DXGI format ${n}`)}if(e in Cu)return Cu[e];throw new Error(`DDSParser cannot parse texture data with fourCC format ${e}`)}if(t&F.PIXEL_FORMAT_FLAGS.RGB||t&F.PIXEL_FORMAT_FLAGS.RGBA)return Z3(r);throw t&F.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&F.PIXEL_FORMAT_FLAGS.LUMINANCE||t&F.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&F.PIXEL_FORMAT_FLAGS.ALPHA||t&F.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}function Z3(r){const t=r[F.HEADER_FIELDS.RGB_BITCOUNT],e=r[F.HEADER_FIELDS.R_BIT_MASK],s=r[F.HEADER_FIELDS.G_BIT_MASK],i=r[F.HEADER_FIELDS.B_BIT_MASK],n=r[F.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(e===255&&s===65280&&i===16711680&&n===4278190080)return St[F.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(e===16711680&&s===65280&&i===255&&n===4278190080)return St[F.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(e===1072693248&&s===1047552&&i===1023&&n===3221225472)return St[F.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(e===65535&&s===4294901760&&i===0&&n===0)return St[F.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(e===4294967295&&s===0&&i===0&&n===0)return St[F.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(e===31744&&s===992&&i===31&&n===32768)return St[F.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(e===63488&&s===2016&&i===31&&n===0)return St[F.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(e===3840&&s===240&&i===15&&n===61440)return St[F.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(e===255&&s===0&&i===0&&n===65280)return St[F.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(e===65535&&s===0&&i===0&&n===0)return St[F.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(e===255&&s===0&&i===0&&n===0)return St[F.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM];break}throw new Error(`DDSParser does not support uncompressed texture with configuration:
bitCount = ${t}, rBitMask = ${e}, gBitMask = ${s}, aBitMask = ${n}`)}const Q3={extension:{type:y.LoadParser,priority:wt.High,name:"loadDDS"},name:"loadDDS",test(r){return Lt(r,[".dds"])},async load(r,t,e){const s=await ws(),i=await(await fetch(r)).arrayBuffer(),n=R_(i,s),o=new Es(n);return ve(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};var P_=(r=>(r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGBA=6408]="RGBA",r[r.RGBA8UI=36220]="RGBA8UI",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.RGBA8I=36238]="RGBA8I",r[r.RGBA8=32856]="RGBA8",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(P_||{}),J3=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(J3||{}),tE=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(tE||{});const eE={33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},rE=[171,75,84,88,32,49,49,187,13,10,26,10],sE={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},iE=64,nE=67305985,oE={5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},aE={6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},uE={32819:2,32820:2,33635:2},lE={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},J={FILE_HEADER_SIZE:iE,FILE_IDENTIFIER:rE,FORMATS_TO_COMPONENTS:aE,INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:lE,INTERNAL_FORMAT_TO_TEXTURE_FORMATS:eE,FIELDS:sE,TYPES_TO_BYTES_PER_COMPONENT:oE,TYPES_TO_BYTES_PER_PIXEL:uE,ENDIANNESS:nE};function D_(r,t){const e=new DataView(r);if(!pE(e))throw new Error("Invalid KTX identifier in header");const{littleEndian:s,glType:i,glFormat:n,glInternalFormat:o,pixelWidth:a,pixelHeight:u,numberOfMipmapLevels:l,offset:c}=dE(e),h=J.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[o];if(!h)throw new Error(`Unknown texture format ${o}`);if(!t.includes(h))throw new Error(`Unsupported texture format: ${h}, supportedFormats: ${t}`);const d=hE(i,n,o),p=cE(e,i,d,a,u,c,l,s);return{format:h,width:a,height:u,resource:p,alphaMode:"no-premultiply-alpha"}}function cE(r,t,e,s,i,n,o,a){const u=s+3&-4,l=i+3&-4;let c=s*i;t===0&&(c=u*l);let h=c*e,d=s,p=i,f=u,g=l,m=n;const _=new Array(o);for(let b=0;b<o;b++){const x=r.getUint32(m,a);let v=m+4;_[b]=new Uint8Array(r.buffer,v,h),v+=h,m+=x+4,m=m%4!==0?m+4-m%4:m,d=d>>1||1,p=p>>1||1,f=d+4-1&-4,g=p+4-1&-4,h=f*g*e}return _}function hE(r,t,e){let s=J.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e];if(r!==0&&(J.TYPES_TO_BYTES_PER_COMPONENT[r]?s=J.TYPES_TO_BYTES_PER_COMPONENT[r]*J.FORMATS_TO_COMPONENTS[t]:s=J.TYPES_TO_BYTES_PER_PIXEL[r]),s===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return s}function dE(r){const t=r.getUint32(J.FIELDS.ENDIANNESS,!0)===J.ENDIANNESS,e=r.getUint32(J.FIELDS.GL_TYPE,t),s=r.getUint32(J.FIELDS.GL_FORMAT,t),i=r.getUint32(J.FIELDS.GL_INTERNAL_FORMAT,t),n=r.getUint32(J.FIELDS.PIXEL_WIDTH,t),o=r.getUint32(J.FIELDS.PIXEL_HEIGHT,t)||1,a=r.getUint32(J.FIELDS.PIXEL_DEPTH,t)||1,u=r.getUint32(J.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,l=r.getUint32(J.FIELDS.NUMBER_OF_FACES,t),c=r.getUint32(J.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),h=r.getUint32(J.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(o===0||a!==1)throw new Error("Only 2D textures are supported");if(l!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");return{littleEndian:t,glType:e,glFormat:s,glInternalFormat:i,pixelWidth:n,pixelHeight:o,numberOfMipmapLevels:c,offset:J.FILE_HEADER_SIZE+h}}function pE(r){for(let t=0;t<J.FILE_IDENTIFIER.length;t++)if(r.getUint8(t)!==J.FILE_IDENTIFIER[t])return!1;return!0}const fE={extension:{type:y.LoadParser,priority:wt.High,name:"loadKTX"},name:"loadKTX",test(r){return Lt(r,".ktx")},async load(r,t,e){const s=await ws(),i=await(await fetch(r)).arrayBuffer(),n=D_(i,s),o=new Es(n);return ve(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},mE='(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e<o.length;e++)o[e]=n(o[e]);r.format=s[t].convertedFormat}}function i(r){const t=r.byteLength/3,n=new Uint32Array(t);for(let o=0;o<t;++o)n[o]=r[o*3]+(r[o*3+1]<<8)+(r[o*3+2]<<16)+4278190080;return new Uint8Array(n.buffer)}function d(r){const t=[];for(let n=0;n<r.numLevels;n++){const o=r.getImageData(n,0,0),e=new Uint8Array(o.byteLength);e.set(o),t.push(e)}return t}const w={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function p(r){const t=w[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const h={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function F(r){const t=h[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function U(r){return r.classId===2?F(r.vkFormat):p(r.glInternalformat)}const T={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function y(r){const t=T[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const a={jsUrl:"",wasmUrl:""};let l,u,c;async function g(){if(!c){const r=new URL(a.jsUrl,location.origin).href,t=new URL(a.wasmUrl,location.origin).href;importScripts(r),c=new Promise(n=>{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=y(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=async r=>{var t;const n=r.data,o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}})();\n';let Tr=null;class M_{constructor(){Tr||(Tr=URL.createObjectURL(new Blob([mE],{type:"application/javascript"}))),this.worker=new Worker(Tr)}}M_.revokeObjectURL=function(){Tr&&(URL.revokeObjectURL(Tr),Tr=null)};const Ki={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"https://files.pixijs.download/transcoders/ktx/libktx.wasm"};function gE(r){Object.assign(Ki,r)}let Rs;const O_={};function _E(r){return Rs||(Rs=new M_().worker,Rs.onmessage=t=>{const{success:e,url:s,textureOptions:i}=t.data;e||console.warn("Failed to load KTX texture",s),O_[s](i)},Rs.postMessage({type:"init",jsUrl:Ki.jsUrl,wasmUrl:Ki.wasmUrl,supportedTextures:r})),Rs}function B_(r,t){const e=_E(t);return new Promise(s=>{O_[r]=s,e.postMessage({type:"load",url:r})})}const xE={extension:{type:y.LoadParser,priority:wt.High,name:"loadKTX2"},name:"loadKTX2",test(r){return Lt(r,".ktx2")},async load(r,t,e){const s=await ws(),i=await B_(r,s),n=new Es(i);return ve(n,e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},Ru={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:G_},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:G_}};function bE(r){const t=r.format;if(Ru[t]){const e=Ru[t].convertFunction,s=r.resource;for(let i=0;i<s.length;i++)s[i]=e(s[i]);r.format=Ru[t].convertedFormat}}function G_(r){const t=r.byteLength/3,e=new Uint32Array(t);for(let s=0;s<t;++s)e[s]=r[s*3]+(r[s*3+1]<<8)+(r[s*3+2]<<16)+4278190080;return new Uint8Array(e.buffer)}function yE(r){const t=[];for(let e=0;e<r.numLevels;e++){const s=r.getImageData(e,0,0),i=new Uint8Array(s.byteLength);i.set(s),t.push(i)}return t}const vE={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function F_(r){const t=vE[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const TE={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function I_(r){const t=TE[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function AE(r){return r.classId===2?I_(r.vkFormat):F_(r.glInternalformat)}const SE={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function EE(r){const t=SE[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const Zi=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],wE={extension:y.ResolveParser,test:r=>Lt(r,[".ktx",".ktx2",".dds"]),parse:r=>{var t,e;let s;const i=r.split(".");if(i.length>2){const n=i[i.length-2];Zi.includes(n)&&(s=n)}else s=i[i.length-1];return{resolution:parseFloat((e=(t=_e.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:s,src:r}}};let Qi;const CE={extension:{type:y.DetectionParser,priority:2},test:async()=>!!(await vs()||ys()),add:async r=>{const t=await Su();return Qi=RE(t),[...Qi,...r]},remove:async r=>Qi?r.filter(t=>!(t in Qi)):r};function RE(r){const t=["basis"],e={};return r.forEach(s=>{const i=s.split("-")[0];i&&!e[i]&&(e[i]=!0,t.push(i))}),t.sort((s,i)=>{const n=Zi.indexOf(s),o=Zi.indexOf(i);return n===-1?1:o===-1?-1:n-o}),t}const PE=new nt,Pu=class{cull(t,e,s=!0){this._cullRecursive(t,e,s)}_cullRecursive(t,e,s=!0){var i;if(t.cullable&&t.measurable&&t.includeInBuild){const n=(i=t.cullArea)!=null?i:Zr(t,s,PE);t.culled=n.x>=e.x+e.width||n.y>=e.y+e.height||n.x+n.width<=e.x||n.y+n.height<=e.y}else t.culled=!1;if(!(!t.cullableChildren||t.culled||!t.renderable||!t.measurable||!t.includeInBuild))for(let n=0;n<t.children.length;n++)this._cullRecursive(t.children[n],e,s)}};Pu.shared=new Pu;let U_=Pu;class k_{static init(){this._renderRef=this.render.bind(this),this.render=()=>{U_.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}k_.extension={priority:10,type:y.Application,name:"culler"};const DE={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self!="undefined"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(function(){return DS})}};var ME=Object.defineProperty,Ji=Object.getOwnPropertySymbols,L_=Object.prototype.hasOwnProperty,N_=Object.prototype.propertyIsEnumerable,$_=(r,t,e)=>t in r?ME(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Du=(r,t)=>{for(var e in t||(t={}))L_.call(t,e)&&$_(r,e,t[e]);if(Ji)for(var e of Ji(t))N_.call(t,e)&&$_(r,e,t[e]);return r},OE=(r,t)=>{var e={};for(var s in r)L_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Ji)for(var s of Ji(r))t.indexOf(s)<0&&N_.call(r,s)&&(e[s]=r[s]);return e};const X_=class xc extends Ot{constructor(t){t=Du(Du({},xc.defaultOptions),t),super(t),this.enabled=!0,this._state=Pt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,s,i){t.applyFilter(this,e,s,i)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const e=t,{gpu:s,gl:i}=e,n=OE(e,["gpu","gl"]);let o,a;return s&&(o=Et.from(s)),i&&(a=Rt.from(i)),new xc(Du({gpuProgram:o,glProgram:a},n))}};X_.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let he=X_;var H_=`
in vec2 vTextureCoord;
in vec4 vColor;
out vec4 finalColor;
uniform float uBlend;
uniform sampler2D uTexture;
uniform sampler2D uBackTexture;
{FUNCTIONS}
void main()
{
vec4 back = texture(uBackTexture, vTextureCoord);
vec4 front = texture(uTexture, vTextureCoord);
float blendedAlpha = front.a + back.a * (1.0 - front.a);
{MAIN}
}
`,z_=`in vec2 aPosition;
out vec2 vTextureCoord;
out vec2 backgroundUv;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`,j_=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct BlendUniforms {
uBlend:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(0) @binding(3) var uBackTexture: texture_2d<f32>;
@group(1) @binding(0) var<uniform> blendUniforms : BlendUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition)
);
}
{FUNCTIONS}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>
) -> @location(0) vec4<f32> {
var back = textureSample(uBackTexture, uSampler, uv);
var front = textureSample(uTexture, uSampler, uv);
var blendedAlpha = front.a + back.a * (1.0 - front.a);
var out = vec4<f32>(0.0,0.0,0.0,0.0);
{MAIN}
return out;
}`,BE=Object.defineProperty,V_=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,W_=(r,t,e)=>t in r?BE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Y_=(r,t)=>{for(var e in t||(t={}))GE.call(t,e)&&W_(r,e,t[e]);if(V_)for(var e of V_(t))FE.call(t,e)&&W_(r,e,t[e]);return r};class IE extends he{constructor(t){const e=t.gpu,s=q_(Y_({source:j_},e)),i=Et.from({vertex:{source:s,entryPoint:"mainVertex"},fragment:{source:s,entryPoint:"mainFragment"}}),n=t.gl,o=q_(Y_({source:H_},n)),a=Rt.from({vertex:z_,fragment:o}),u=new rt({uBlend:{value:1,type:"f32"}});super({gpuProgram:i,glProgram:a,blendRequired:!0,resources:{blendUniforms:u,uBackTexture:w.EMPTY}})}}function q_(r){const{source:t,functions:e,main:s}=r;return t.replace("{FUNCTIONS}",e).replace("{MAIN}",s)}const UE=`
float getLuminosity(vec3 c) {
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
}
vec3 setLuminosity(vec3 c, float lum) {
float modLum = lum - getLuminosity(c);
vec3 color = c.rgb + vec3(modLum);
// clip back into legal range
modLum = getLuminosity(color);
vec3 modLumVec = vec3(modLum);
float cMin = min(color.r, min(color.g, color.b));
float cMax = max(color.r, max(color.g, color.b));
if(cMin < 0.0) {
color = mix(modLumVec, color, modLum / (modLum - cMin));
}
if(cMax > 1.0) {
color = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum));
}
return color;
}
float getSaturation(vec3 c) {
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
}
vec3 setSaturationMinMidMax(vec3 cSorted, float s) {
vec3 colorSorted = cSorted;
if(colorSorted.z > colorSorted.x) {
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
colorSorted.z = s;
}
else {
colorSorted.y = 0.0;
colorSorted.z = 0.0;
}
colorSorted.x = 0.0;
return colorSorted;
}
vec3 setSaturation(vec3 c, float s) {
vec3 color = c;
if(color.r <= color.g && color.r <= color.b) {
if(color.g <= color.b) {
color = setSaturationMinMidMax(color.rgb, s).rgb;
}
else {
color = setSaturationMinMidMax(color.rbg, s).rbg;
}
}
else if(color.g <= color.r && color.g <= color.b) {
if(color.r <= color.b) {
color = setSaturationMinMidMax(color.grb, s).grb;
}
else {
color = setSaturationMinMidMax(color.gbr, s).gbr;
}
}
else {
// Using bgr for both fixes part of hue
if(color.r <= color.g) {
color = setSaturationMinMidMax(color.brg, s).brg;
}
else {
color = setSaturationMinMidMax(color.bgr, s).bgr;
}
}
return color;
}
`,kE=`
fn getLuminosity(c: vec3<f32>) -> f32
{
return 0.3*c.r + 0.59*c.g + 0.11*c.b;
}
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32>
{
var modLum: f32 = lum - getLuminosity(c);
var color: vec3<f32> = c.rgb + modLum;
// clip back into legal range
modLum = getLuminosity(color);
let modLumVec = vec3<f32>(modLum);
let cMin: f32 = min(color.r, min(color.g, color.b));
let cMax: f32 = max(color.r, max(color.g, color.b));
if(cMin < 0.0)
{
color = mix(modLumVec, color, modLum / (modLum - cMin));
}
if(cMax > 1.0)
{
color = mix(modLumVec, color, (1 - modLum) / (cMax - modLum));
}
return color;
}
fn getSaturation(c: vec3<f32>) -> f32
{
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
}
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32>
{
var colorSorted = cSorted;
if(colorSorted.z > colorSorted.x)
{
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
colorSorted.z = s;
}
else
{
colorSorted.y = 0;
colorSorted.z = 0;
}
colorSorted.x = 0;
return colorSorted;
}
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32>
{
var color = c;
if (color.r <= color.g && color.r <= color.b)
{
if (color.g <= color.b)
{
color = vec3<f32>(setSaturationMinMidMax(color.rgb, s)).rgb;
}
else
{
color = vec3<f32>(setSaturationMinMidMax(color.rbg, s)).rbg;
}
}
else if (color.g <= color.r && color.g <= color.b)
{
if (color.r <= color.b)
{
color = vec3<f32>(setSaturationMinMidMax(color.grb, s)).grb;
}
else
{
color = vec3<f32>(setSaturationMinMidMax(color.gbr, s)).gbr;
}
}
else
{
// Using bgr for both fixes part of hue
if (color.r <= color.g)
{
color = vec3<f32>(setSaturationMinMidMax(color.brg, s)).brg;
}
else
{
color = vec3<f32>(setSaturationMinMidMax(color.bgr, s)).bgr;
}
}
return color;
}
`;var tn=`in vec2 aPosition;
out vec2 vTextureCoord;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`,K_=`
in vec2 vTextureCoord;
out vec4 finalColor;
uniform float uAlpha;
uniform sampler2D uTexture;
void main()
{
finalColor = texture(uTexture, vTextureCoord) * uAlpha;
}
`,Mu=`struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct AlphaUniforms {
uAlpha:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> alphaUniforms : AlphaUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition)
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var sample = textureSample(uTexture, uSampler, uv);
return sample * alphaUniforms.uAlpha;
}`,LE=Object.defineProperty,NE=Object.defineProperties,$E=Object.getOwnPropertyDescriptors,en=Object.getOwnPropertySymbols,Z_=Object.prototype.hasOwnProperty,Q_=Object.prototype.propertyIsEnumerable,J_=(r,t,e)=>t in r?LE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ou=(r,t)=>{for(var e in t||(t={}))Z_.call(t,e)&&J_(r,e,t[e]);if(en)for(var e of en(t))Q_.call(t,e)&&J_(r,e,t[e]);return r},XE=(r,t)=>NE(r,$E(t)),HE=(r,t)=>{var e={};for(var s in r)Z_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&en)for(var s of en(r))t.indexOf(s)<0&&Q_.call(r,s)&&(e[s]=r[s]);return e};const t0=class Ay extends he{constructor(t){t=Ou(Ou({},Ay.defaultOptions),t);const e=Et.from({vertex:{source:Mu,entryPoint:"mainVertex"},fragment:{source:Mu,entryPoint:"mainFragment"}}),s=Rt.from({vertex:tn,fragment:K_,name:"alpha-filter"}),i=t,{alpha:n}=i,o=HE(i,["alpha"]),a=new rt({uAlpha:{value:n,type:"f32"}});super(XE(Ou({},o),{gpuProgram:e,glProgram:s,resources:{alphaUniforms:a}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};t0.defaultOptions={alpha:1};let zE=t0;const Bu={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]},jE=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join(`
`);function e0(r){const t=Bu[r],e=t.length;let s=jE,i="";const n="finalColor += texture(uTexture, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let u=n.replace("%index%",a.toString());o=a,a>=e&&(o=r-a-1),u=u.replace("%value%",t[o].toString()),i+=u,i+=`
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const VE=`
in vec2 aPosition;
uniform float uStrength;
out vec2 vBlurTexCoords[%size%];
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
float pixelStrength = uInputSize.%dimension% * uStrength;
vec2 textureCoord = filterTextureCoord();
%blur%
}`;function r0(r,t){const e=Math.ceil(r/2);let s=VE,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),i+=a,i+=`
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s=s.replace("%dimension%",t?"z":"w"),s}function s0(r,t){const e=r0(t,r),s=e0(t);return Rt.from({vertex:e,fragment:s,name:`blur-${r?"horizontal":"vertical"}-pass-filter`})}var i0=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct BlurUniforms {
uStrength:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> blurUniforms : BlurUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
%blur-struct%
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
let filteredCord = filterTextureCoord(aPosition);
let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength;
return VSOutput(
filterVertexPosition(aPosition),
%blur-vertex-out%
);
}
@fragment
fn mainFragment(
@builtin(position) position: vec4<f32>,
%blur-fragment-in%
) -> @location(0) vec4<f32> {
var finalColor = vec4(0.0);
%blur-sampling%
return finalColor;
}`;function n0(r,t){const e=Bu[t],s=e.length,i=[],n=[],o=[];for(let h=0;h<t;h++){i[h]=`@location(${h}) offset${h}: vec2<f32>,`,r?n[h]=`filteredCord + vec2(${h-s+1} * pixelStrength, 0.0),`:n[h]=`filteredCord + vec2(0.0, ${h-s+1} * pixelStrength),`;const d=h<s?h:t-h-1,p=e[d].toString();o[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${p};`}const a=i.join(`
`),u=n.join(`
`),l=o.join(`
`),c=i0.replace("%blur-struct%",a).replace("%blur-vertex-out%",u).replace("%blur-fragment-in%",a).replace("%blur-sampling%",l).replace("%dimension%",r?"z":"w");return Et.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}})}var WE=Object.defineProperty,o0=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,a0=(r,t,e)=>t in r?WE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gu=(r,t)=>{for(var e in t||(t={}))YE.call(t,e)&&a0(r,e,t[e]);if(o0)for(var e of o0(t))qE.call(t,e)&&a0(r,e,t[e]);return r};const u0=class Sy extends he{constructor(t){t=Gu(Gu({},Sy.defaultOptions),t);const e=s0(t.horizontal,t.kernelSize),s=n0(t.horizontal,t.kernelSize);super(Gu({glProgram:e,gpuProgram:s,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,s,i){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)t.applyFilter(this,e,s,i);else{const n=et.getSameSizeTexture(e);let o=e,a=n;this._state.blend=!1;const u=t.renderer.type===vt.WEBGPU;for(let l=0;l<this.passes-1;l++){t.applyFilter(this,o,a,l===0?!0:u);const c=a;a=o,o=c}this._state.blend=!0,t.applyFilter(this,o,s,i),et.returnTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}};u0.defaultOptions={strength:8,quality:4,kernelSize:5};let rn=u0;var KE=Object.defineProperty,ZE=Object.defineProperties,QE=Object.getOwnPropertyDescriptors,sn=Object.getOwnPropertySymbols,l0=Object.prototype.hasOwnProperty,c0=Object.prototype.propertyIsEnumerable,h0=(r,t,e)=>t in r?KE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ps=(r,t)=>{for(var e in t||(t={}))l0.call(t,e)&&h0(r,e,t[e]);if(sn)for(var e of sn(t))c0.call(t,e)&&h0(r,e,t[e]);return r},JE=(r,t)=>ZE(r,QE(t)),tw=(r,t)=>{var e={};for(var s in r)l0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&sn)for(var s of sn(r))t.indexOf(s)<0&&c0.call(r,s)&&(e[s]=r[s]);return e};class d0 extends he{constructor(...t){var e;let s=(e=t[0])!=null?e:{};typeof s=="number"&&(s={strength:s},t[1]!==void 0&&(s.quality=t[1]),t[2]!==void 0&&(s.resolution=t[2]||"inherit"),t[3]!==void 0&&(s.kernelSize=t[3])),s=Ps(Ps({},rn.defaultOptions),s);const i=s,{strength:n,strengthX:o,strengthY:a,quality:u}=i,l=tw(i,["strength","strengthX","strengthY","quality"]);super(JE(Ps({},l),{compatibleRenderers:vt.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new rn(Ps({horizontal:!0},s)),this.blurYFilter=new rn(Ps({horizontal:!1},s)),this.quality=u,this.strengthX=o!=null?o:n,this.strengthY=a!=null?a:n,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=et.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,a,s,i),et.returnTexture(a)}else o?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,s,i)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,s,i))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(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 strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}d0.defaultOptions={strength:8,quality:4,kernelSize:5};var p0=`
in vec2 vTextureCoord;
in vec4 vColor;
out vec4 finalColor;
uniform float uColorMatrix[20];
uniform float uAlpha;
uniform sampler2D uTexture;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main()
{
vec4 color = texture(uTexture, vTextureCoord);
float randomValue = rand(gl_FragCoord.xy * 0.2);
float diff = (randomValue - 0.5) * 0.5;
if (uAlpha == 0.0) {
finalColor = color;
return;
}
if (color.a > 0.0) {
color.rgb /= color.a;
}
vec4 result;
result.r = (uColorMatrix[0] * color.r);
result.r += (uColorMatrix[1] * color.g);
result.r += (uColorMatrix[2] * color.b);
result.r += (uColorMatrix[3] * color.a);
result.r += uColorMatrix[4];
result.g = (uColorMatrix[5] * color.r);
result.g += (uColorMatrix[6] * color.g);
result.g += (uColorMatrix[7] * color.b);
result.g += (uColorMatrix[8] * color.a);
result.g += uColorMatrix[9];
result.b = (uColorMatrix[10] * color.r);
result.b += (uColorMatrix[11] * color.g);
result.b += (uColorMatrix[12] * color.b);
result.b += (uColorMatrix[13] * color.a);
result.b += uColorMatrix[14];
result.a = (uColorMatrix[15] * color.r);
result.a += (uColorMatrix[16] * color.g);
result.a += (uColorMatrix[17] * color.b);
result.a += (uColorMatrix[18] * color.a);
result.a += uColorMatrix[19];
vec3 rgb = mix(color.rgb, result.rgb, uAlpha);
// Premultiply alpha again.
rgb *= result.a;
finalColor = vec4(rgb, result.a);
}
`,Fu=`struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct ColorMatrixUniforms {
uColorMatrix:array<vec4<f32>, 5>,
uAlpha:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> colorMatrixUniforms : ColorMatrixUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition),
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
) -> @location(0) vec4<f32> {
var c = textureSample(uTexture, uSampler, uv);
if (colorMatrixUniforms.uAlpha == 0.0) {
return c;
}
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (c.a > 0.0) {
c.r /= c.a;
c.g /= c.a;
c.b /= c.a;
}
var cm = colorMatrixUniforms.uColorMatrix;
var result = vec4<f32>(0.);
result.r = (cm[0][0] * c.r);
result.r += (cm[0][1] * c.g);
result.r += (cm[0][2] * c.b);
result.r += (cm[0][3] * c.a);
result.r += cm[1][0];
result.g = (cm[1][1] * c.r);
result.g += (cm[1][2] * c.g);
result.g += (cm[1][3] * c.b);
result.g += (cm[2][0] * c.a);
result.g += cm[2][1];
result.b = (cm[2][2] * c.r);
result.b += (cm[2][3] * c.g);
result.b += (cm[3][0] * c.b);
result.b += (cm[3][1] * c.a);
result.b += cm[3][2];
result.a = (cm[3][3] * c.r);
result.a += (cm[4][0] * c.g);
result.a += (cm[4][1] * c.b);
result.a += (cm[4][2] * c.a);
result.a += cm[4][3];
var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha);
rgb.r *= result.a;
rgb.g *= result.a;
rgb.b *= result.a;
return vec4(rgb, result.a);
}`,ew=Object.defineProperty,rw=Object.defineProperties,sw=Object.getOwnPropertyDescriptors,f0=Object.getOwnPropertySymbols,iw=Object.prototype.hasOwnProperty,nw=Object.prototype.propertyIsEnumerable,m0=(r,t,e)=>t in r?ew(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ow=(r,t)=>{for(var e in t||(t={}))iw.call(t,e)&&m0(r,e,t[e]);if(f0)for(var e of f0(t))nw.call(t,e)&&m0(r,e,t[e]);return r},aw=(r,t)=>rw(r,sw(t));class uw extends he{constructor(t={}){const e=new rt({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),s=Et.from({vertex:{source:Fu,entryPoint:"mainVertex"},fragment:{source:Fu,entryPoint:"mainFragment"}}),i=Rt.from({vertex:tn,fragment:p0,name:"color-matrix-filter"});super(aw(ow({},t),{gpuProgram:s,glProgram:i,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.matrix,t),s=this._colorMatrix(s)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=s,this.resources.colorMatrixUniforms.update()}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,n]=X.shared.setValue(t).toArray(),o=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),u=s+(1-s)*o,l=o*(1-s)-a*i,c=o*(1-s)+a*i,h=o*(1-s)+a*i,d=s+o*(1-s),p=o*(1-s)-a*i,f=o*(1-s)-a*i,g=o*(1-s)+a*i,m=s+o*(1-s),_=[u,l,c,0,0,h,d,p,0,0,f,g,m,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,i,n){t||(t=.2),e||(e=.15),s||(s=16770432),i||(i=3375104);const o=X.shared,[a,u,l]=o.setValue(s).toArray(),[c,h,d]=o.setValue(i).toArray(),p=[.3,.59,.11,0,0,a,u,l,t,0,c,h,d,e,0,a-c,u-h,l-d,0,0];this._loadMatrix(p,n)}night(t,e){t||(t=.1);const s=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}}var g0=`
in vec2 vTextureCoord;
in vec2 vFilterUv;
out vec4 finalColor;
uniform sampler2D uTexture;
uniform sampler2D uMapTexture;
uniform vec4 uInputClamp;
uniform highp vec4 uInputSize;
uniform mat2 uRotation;
uniform vec2 uScale;
void main()
{
vec4 map = texture(uMapTexture, vFilterUv);
vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale;
finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw));
}
`,_0=`in vec2 aPosition;
out vec2 vTextureCoord;
out vec2 vFilterUv;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
uniform mat3 uFilterMatrix;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
vec2 getFilterCoord( void )
{
return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy;
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
vFilterUv = getFilterCoord();
}
`,Iu=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct DisplacementUniforms {
uFilterMatrix:mat3x3<f32>,
uScale:vec2<f32>,
uRotation:mat2x2<f32>
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> filterUniforms : DisplacementUniforms;
@group(1) @binding(1) var uMapTexture: texture_2d<f32>;
@group(1) @binding(2) var uMapSampler : sampler;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
@location(1) filterUv : vec2<f32>,
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
{
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition),
getFilterCoord(aPosition)
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@location(1) filterUv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var map = textureSample(uMapTexture, uMapSampler, filterUv);
var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale;
return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw));
}`,lw=Object.defineProperty,cw=Object.defineProperties,hw=Object.getOwnPropertyDescriptors,nn=Object.getOwnPropertySymbols,x0=Object.prototype.hasOwnProperty,b0=Object.prototype.propertyIsEnumerable,y0=(r,t,e)=>t in r?lw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dw=(r,t)=>{for(var e in t||(t={}))x0.call(t,e)&&y0(r,e,t[e]);if(nn)for(var e of nn(t))b0.call(t,e)&&y0(r,e,t[e]);return r},pw=(r,t)=>cw(r,hw(t)),fw=(r,t)=>{var e={};for(var s in r)x0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&nn)for(var s of nn(r))t.indexOf(s)<0&&b0.call(r,s)&&(e[s]=r[s]);return e};class mw extends he{constructor(...t){let e=t[0];e instanceof jt&&(e={sprite:e,scale:t[1]});const s=e,{sprite:i,scale:n}=s,o=fw(s,["sprite","scale"]);let a=n!=null?n:20;typeof a=="number"&&(a=new it(a,a));const u=new rt({uFilterMatrix:{value:new D,type:"mat3x3<f32>"},uScale:{value:a,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),l=Rt.from({vertex:_0,fragment:g0,name:"displacement-filter"}),c=Et.from({vertex:{source:Iu,entryPoint:"mainVertex"},fragment:{source:Iu,entryPoint:"mainFragment"}}),h=i.texture.source;super(pw(dw({},o),{gpuProgram:c,glProgram:l,resources:{filterUniforms:u,uMapTexture:h,uMapSampler:h.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,s,i){const n=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(n.uFilterMatrix,this._sprite);const o=this._sprite.worldTransform,a=Math.sqrt(o.a*o.a+o.b*o.b),u=Math.sqrt(o.c*o.c+o.d*o.d);a!==0&&u!==0&&(n.uRotation[0]=o.a/a,n.uRotation[1]=o.b/a,n.uRotation[2]=o.c/u,n.uRotation[3]=o.d/u),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,s,i)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var v0=`
in vec2 vTextureCoord;
in vec4 vColor;
out vec4 finalColor;
uniform float uNoise;
uniform float uSeed;
uniform sampler2D uTexture;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main()
{
vec4 color = texture(uTexture, vTextureCoord);
float randomValue = rand(gl_FragCoord.xy * uSeed);
float diff = (randomValue - 0.5) * uNoise;
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (color.a > 0.0) {
color.rgb /= color.a;
}
color.r += diff;
color.g += diff;
color.b += diff;
// Premultiply alpha again.
color.rgb *= color.a;
finalColor = color;
}
`,Uu=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct NoiseUniforms {
uNoise:f32,
uSeed:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> noiseUniforms : NoiseUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition)
);
}
fn rand(co:vec2<f32>) -> f32
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy);
var sample = textureSample(uTexture, uSampler, uv);
var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed);
var diff = (randomValue - 0.5) * noiseUniforms.uNoise;
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (sample.a > 0.0) {
sample.r /= sample.a;
sample.g /= sample.a;
sample.b /= sample.a;
}
sample.r += diff;
sample.g += diff;
sample.b += diff;
// Premultiply alpha again.
sample.r *= sample.a;
sample.g *= sample.a;
sample.b *= sample.a;
return sample;
}`,gw=Object.defineProperty,_w=Object.defineProperties,xw=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,T0=Object.prototype.hasOwnProperty,A0=Object.prototype.propertyIsEnumerable,S0=(r,t,e)=>t in r?gw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ku=(r,t)=>{for(var e in t||(t={}))T0.call(t,e)&&S0(r,e,t[e]);if(on)for(var e of on(t))A0.call(t,e)&&S0(r,e,t[e]);return r},bw=(r,t)=>_w(r,xw(t)),yw=(r,t)=>{var e={};for(var s in r)T0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&on)for(var s of on(r))t.indexOf(s)<0&&A0.call(r,s)&&(e[s]=r[s]);return e};const E0=class Ey extends he{constructor(t={}){t=ku(ku({},Ey.defaultOptions),t);const e=Et.from({vertex:{source:Uu,entryPoint:"mainVertex"},fragment:{source:Uu,entryPoint:"mainFragment"}}),s=Rt.from({vertex:tn,fragment:v0,name:"noise-filter"}),i=t,{noise:n,seed:o}=i,a=yw(i,["noise","seed"]);super(bw(ku({},a),{gpuProgram:e,glProgram:s,resources:{noiseUniforms:new rt({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=n,this.seed=o!=null?o:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}};E0.defaultOptions={noise:.5};let vw=E0;var w0=`in vec2 vMaskCoord;
in vec2 vTextureCoord;
uniform sampler2D uTexture;
uniform sampler2D uMaskTexture;
uniform float uAlpha;
uniform vec4 uMaskClamp;
uniform float uInverse;
out vec4 finalColor;
void main(void)
{
float clip = step(3.5,
step(uMaskClamp.x, vMaskCoord.x) +
step(uMaskClamp.y, vMaskCoord.y) +
step(vMaskCoord.x, uMaskClamp.z) +
step(vMaskCoord.y, uMaskClamp.w));
// TODO look into why this is needed
float npmAlpha = uAlpha;
vec4 original = texture(uTexture, vTextureCoord);
vec4 masky = texture(uMaskTexture, vMaskCoord);
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
float a = alphaMul * masky.r * npmAlpha * clip;
if (uInverse == 1.0) {
a = 1.0 - a;
}
finalColor = original * a;
}
`,C0=`in vec2 aPosition;
out vec2 vTextureCoord;
out vec2 vMaskCoord;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
uniform mat3 uFilterMatrix;
vec4 filterVertexPosition( vec2 aPosition )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( vec2 aPosition )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
vec2 getFilterCoord( vec2 aPosition )
{
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
}
void main(void)
{
gl_Position = filterVertexPosition(aPosition);
vTextureCoord = filterTextureCoord(aPosition);
vMaskCoord = getFilterCoord(aPosition);
}
`,Lu=`struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct MaskUniforms {
uFilterMatrix:mat3x3<f32>,
uMaskClamp:vec4<f32>,
uAlpha:f32,
uInverse:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
@location(1) filterUv : vec2<f32>,
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
{
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition),
getFilterCoord(aPosition)
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@location(1) filterUv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var maskClamp = filterUniforms.uMaskClamp;
var uAlpha = filterUniforms.uAlpha;
var clip = step(3.5,
step(maskClamp.x, filterUv.x) +
step(maskClamp.y, filterUv.y) +
step(filterUv.x, maskClamp.z) +
step(filterUv.y, maskClamp.w));
var mask = textureSample(uMaskTexture, uSampler, filterUv);
var source = textureSample(uTexture, uSampler, uv);
var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
var a: f32 = alphaMul * mask.r * uAlpha * clip;
if (filterUniforms.uInverse == 1.0) {
a = 1.0 - a;
}
return source * a;
}
`,Tw=Object.defineProperty,Aw=Object.defineProperties,Sw=Object.getOwnPropertyDescriptors,an=Object.getOwnPropertySymbols,R0=Object.prototype.hasOwnProperty,P0=Object.prototype.propertyIsEnumerable,D0=(r,t,e)=>t in r?Tw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ew=(r,t)=>{for(var e in t||(t={}))R0.call(t,e)&&D0(r,e,t[e]);if(an)for(var e of an(t))P0.call(t,e)&&D0(r,e,t[e]);return r},ww=(r,t)=>Aw(r,Sw(t)),Cw=(r,t)=>{var e={};for(var s in r)R0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&an)for(var s of an(r))t.indexOf(s)<0&&P0.call(r,s)&&(e[s]=r[s]);return e};class M0 extends he{constructor(t){const e=t,{sprite:s}=e,i=Cw(e,["sprite"]),n=new po(s.texture),o=new rt({uFilterMatrix:{value:new D,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),a=Et.from({vertex:{source:Lu,entryPoint:"mainVertex"},fragment:{source:Lu,entryPoint:"mainFragment"}}),u=Rt.from({vertex:C0,fragment:w0,name:"mask-filter"});super(ww(Ew({},i),{gpuProgram:a,glProgram:u,resources:{filterUniforms:o,uMaskTexture:s.texture.source}})),this.sprite=s,this._textureMatrix=n}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,s,i){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,s,i)}}var Rw=`fn getLuminosity(c: vec3<f32>) -> f32 {
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
}
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32> {
let d: f32 = lum - getLuminosity(c);
let newColor: vec3<f32> = c.rgb + vec3<f32>(d, d, d);
// clip back into legal range
let newLum: f32 = getLuminosity(newColor);
let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b));
let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b));
let t1: f32 = newLum / (newLum - cMin);
let t2: f32 = (1.0 - newLum) / (cMax - newLum);
let finalColor = mix(vec3<f32>(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0));
return finalColor;
}
fn getSaturation(c: vec3<f32>) -> f32 {
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
}
// Set saturation if color components are sorted in ascending order.
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32> {
var result: vec3<f32>;
if (cSorted.z > cSorted.x) {
let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x));
result = vec3<f32>(0.0, newY, s);
} else {
result = vec3<f32>(0.0, 0.0, 0.0);
}
return vec3<f32>(result.x, result.y, result.z);
}
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
var result: vec3<f32> = c;
if (c.r <= c.g && c.r <= c.b) {
if (c.g <= c.b) {
result = setSaturationMinMidMax(result, s);
} else {
var temp: vec3<f32> = vec3<f32>(result.r, result.b, result.g);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.r, temp.b, temp.g);
}
} else if (c.g <= c.r && c.g <= c.b) {
if (c.r <= c.b) {
var temp: vec3<f32> = vec3<f32>(result.g, result.r, result.b);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.g, temp.r, temp.b);
} else {
var temp: vec3<f32> = vec3<f32>(result.g, result.b, result.r);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.g, temp.b, temp.r);
}
} else {
if (c.r <= c.g) {
var temp: vec3<f32> = vec3<f32>(result.b, result.r, result.g);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.b, temp.r, temp.g);
} else {
var temp: vec3<f32> = vec3<f32>(result.b, result.g, result.r);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.b, temp.g, temp.r);
}
}
return result;
}`;function Nu(r,t,e,s,i,n,o,a){const u=o-e,l=a-s,c=i-e,h=n-s,d=r-e,p=t-s,f=u*u+l*l,g=u*c+l*h,m=u*d+l*p,_=c*c+h*h,b=c*d+h*p,x=1/(f*_-g*g),v=(_*m-g*b)*x,A=(f*b-g*m)*x;return v>=0&&A>=0&&v+A<1}class Tc{constructor(t=0,e=0,s=0,i=0,n=0,o=0){this.type="triangle",this.x=t,this.y=e,this.x2=s,this.y2=i,this.x3=n,this.y3=o}contains(t,e){const s=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),i=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(s<0!=i<0&&s!==0&&i!==0)return!1;const n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return n===0||n<0==s+i<=0}strokeContains(t,e,s,i=.5){const n=s/2,o=n*n,{x:a,x2:u,x3:l,y:c,y2:h,y3:d}=this;return cs(t,e,a,c,u,d)<=o||cs(t,e,u,h,l,d)<=o||cs(t,e,l,d,a,c)<=o}clone(){return new Tc(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t||(t=new z);const e=Math.min(this.x,this.x2,this.x3),s=Math.max(this.x,this.x2,this.x3),i=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=i,t.width=s-e,t.height=n-i,t}}const O0=class wy{constructor(t){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{const{queue:e}=this;let s=0;for(;e.length&&s<wy.uploadsPerFrame;){const i=e.shift();this.uploadQueueItem(i),s++}e.length?dt.system.addOnce(this._tick,this,ge.UTILITY):this._resolve()},this.renderer=t,this.queue=[],this.resolves=[]}getQueue(){return[...this.queue]}add(t){const e=Array.isArray(t)?t:[t];for(const s of e)s instanceof mt?this._addContainer(s):this.resolveQueueItem(s,this.queue);return this}_addContainer(t){this.resolveQueueItem(t,this.queue);for(const e of t.children)this._addContainer(e)}upload(t){return t&&this.add(t),new Promise(e=>{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),dt.system.addOnce(this._tick,this,ge.UTILITY)):e()})}dedupeQueue(){const t=Object.create(null);let e=0;for(let s=0;s<this.queue.length;s++){const i=this.queue[s];t[i.uid]||(t[i.uid]=!0,this.queue[e++]=i)}this.queue.length=e}_resolve(){const{resolves:t}=this,e=t.slice(0);t.length=0;for(const s of e)s()}};O0.uploadsPerFrame=4;let B0=O0;var Pw=Object.defineProperty,un=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,F0=Object.prototype.propertyIsEnumerable,I0=(r,t,e)=>t in r?Pw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dw=(r,t)=>{for(var e in t||(t={}))G0.call(t,e)&&I0(r,e,t[e]);if(un)for(var e of un(t))F0.call(t,e)&&I0(r,e,t[e]);return r},Mw=(r,t)=>{var e={};for(var s in r)G0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&un)for(var s of un(r))t.indexOf(s)<0&&F0.call(r,s)&&(e[s]=r[s]);return e};class Ar extends ae{constructor(...t){var e;let s=t[0];s instanceof Fe&&(s={geometry:s,shader:t[1]},t[3]&&(s.geometry.topology=t[3]));const i=s,{geometry:n,shader:o,texture:a,roundPixels:u,state:l}=i,c=Mw(i,["geometry","shader","texture","roundPixels","state"]);super(Dw({label:"Mesh"},c)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=o!=null?o:null,this.texture=(e=a!=null?a:o==null?void 0:o.texture)!=null?e:w.WHITE,this.state=l!=null?l:Pt.for2d(),this._geometry=n,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=u!=null?u:!1}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&((e=this._geometry)==null||e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t||(t=w.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return this._shader||this.state.data&12?!1:this._geometry instanceof $e?this._geometry.batchMode==="auto"?this._geometry.positions.length/2<=100:this._geometry.batchMode==="batch":!1}get bounds(){return this._geometry.bounds}updateBounds(){this._bounds=this._geometry.bounds}containsPoint(t){const{x:e,y:s}=t;if(!this.bounds.containsPoint(e,s))return!1;const i=this.geometry.getBuffer("aPosition").data,n=this.geometry.topology==="triangle-strip"?3:1;if(this.geometry.getIndex()){const o=this.geometry.getIndex().data,a=o.length;for(let u=0;u+2<a;u+=n){const l=o[u]*2,c=o[u+1]*2,h=o[u+2]*2;if(Nu(e,s,i[l],i[l+1],i[c],i[c+1],i[h],i[h+1]))return!0}}else{const o=i.length/2;for(let a=0;a+2<o;a+=n){const u=a*2,l=(a+1)*2,c=(a+2)*2;if(Nu(e,s,i[u],i[u+1],i[l],i[l+1],i[c],i[c+1]))return!0}}return!1}destroy(t){var e;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const s=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(s)}(e=this._geometry)==null||e.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null,this._gpuData=null}}var Ow=Object.defineProperty,Bw=Object.defineProperties,Gw=Object.getOwnPropertyDescriptors,ln=Object.getOwnPropertySymbols,U0=Object.prototype.hasOwnProperty,k0=Object.prototype.propertyIsEnumerable,L0=(r,t,e)=>t in r?Ow(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fw=(r,t)=>{for(var e in t||(t={}))U0.call(t,e)&&L0(r,e,t[e]);if(ln)for(var e of ln(t))k0.call(t,e)&&L0(r,e,t[e]);return r},Iw=(r,t)=>Bw(r,Gw(t)),Uw=(r,t)=>{var e={};for(var s in r)U0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&ln)for(var s of ln(r))t.indexOf(s)<0&&k0.call(r,s)&&(e[s]=r[s]);return e};class Us extends jt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const s=e,{animationSpeed:i=1,autoPlay:n=!1,autoUpdate:o=!0,loop:a=!0,onComplete:u=null,onFrameChange:l=null,onLoop:c=null,textures:h,updateAnchor:d=!1}=s,p=Uw(s,["animationSpeed","autoPlay","autoUpdate","loop","onComplete","onFrameChange","onLoop","textures","updateAnchor"]),[f]=h;super(Iw(Fw({},p),{texture:f instanceof w?f:f.texture})),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=a,this.updateAnchor=d,this.onComplete=u,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=h,n&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(dt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(dt.shared.add(this.update,this,ge.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,s=this.animationSpeed*e,i=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=s/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=s;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;s<t.length;++s)e.push(w.from(t[s]));return new Us(e)}static fromImages(t){const e=[];for(let s=0;s<t.length;++s)e.push(w.from(t[s]));return new Us(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof w)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(dt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(dt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class N0{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t!=null?t:new D,this.observer=e,this.position=new st(this,0,0),this.scale=new st(this,1,1),this.pivot=new st(this,0,0),this.skew=new st(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(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.dirty=!1),t}_onUpdate(t){var e;this.dirty=!0,t===this.skew&&this.updateSkew(),(e=this.observer)==null||e._onUpdate(this)}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.dirty=!0}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}var kw=Object.defineProperty,cn=Object.getOwnPropertySymbols,$0=Object.prototype.hasOwnProperty,X0=Object.prototype.propertyIsEnumerable,H0=(r,t,e)=>t in r?kw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ds=(r,t)=>{for(var e in t||(t={}))$0.call(t,e)&&H0(r,e,t[e]);if(cn)for(var e of cn(t))X0.call(t,e)&&H0(r,e,t[e]);return r},Lw=(r,t)=>{var e={};for(var s in r)$0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&cn)for(var s of cn(r))t.indexOf(s)<0&&X0.call(r,s)&&(e[s]=r[s]);return e};const z0=class Fn extends ae{constructor(...t){let e=t[0]||{};e instanceof w&&(e={texture:e}),t.length>1&&(e.width=t[1],e.height=t[2]),e=Ds(Ds({},Fn.defaultOptions),e);const s=e!=null?e:{},{texture:i,anchor:n,tilePosition:o,tileScale:a,tileRotation:u,width:l,height:c,applyAnchorToTexture:h,roundPixels:d}=s,p=Lw(s,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Ds({label:"TilingSprite"},p)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new st({_onUpdate:()=>{this.onViewUpdate()}}),this.applyAnchorToTexture=h,this.texture=i,this._width=l!=null?l:i.width,this._height=c!=null?c:i.height,this._tileTransform=new N0({observer:{_onUpdate:()=>this.onViewUpdate()}}),n&&(this.anchor=n),this.tilePosition=o,this.tileScale=a,this.tileRotation=u,this.roundPixels=d!=null?d:!1}static from(t,e={}){return typeof t=="string"?new Fn(Ds({texture:V.get(t)},e)):new Fn(Ds({texture:t},e))}get uvRespectAnchor(){return Ut("uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture}set uvRespectAnchor(t){Ut("uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture=t}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){typeof t=="number"?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}set texture(t){t||(t=w.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var s;typeof t=="object"&&(e=(s=t.height)!=null?s:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}updateBounds(){const t=this._bounds,e=this._anchor,s=this._width,i=this._height;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*i,t.maxY=t.minY+i}containsPoint(t){const e=this._width,s=this._height,i=-e*this._anchor._x;let n=0;return t.x>=i&&t.x<=i+e&&(n=-s*this._anchor._y,t.y>=n&&t.y<=n+s)}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};z0.defaultOptions={texture:w.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let j0=z0;var Nw=Object.defineProperty,hn=Object.getOwnPropertySymbols,V0=Object.prototype.hasOwnProperty,W0=Object.prototype.propertyIsEnumerable,Y0=(r,t,e)=>t in r?Nw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$w=(r,t)=>{for(var e in t||(t={}))V0.call(t,e)&&Y0(r,e,t[e]);if(hn)for(var e of hn(t))W0.call(t,e)&&Y0(r,e,t[e]);return r},Xw=(r,t)=>{var e={};for(var s in r)V0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&hn)for(var s of hn(r))t.indexOf(s)<0&&W0.call(r,s)&&(e[s]=r[s]);return e};class dn extends ae{constructor(t,e){const s=t,{text:i,resolution:n,style:o,anchor:a,width:u,height:l,roundPixels:c}=s,h=Xw(s,["text","resolution","style","anchor","width","height","roundPixels"]);super($w({},h)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i!=null?i:"",this.style=o,this.resolution=n!=null?n:null,this.allowChildren=!1,this._anchor=new st({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=c!=null?c:!1,u!==void 0&&(this.width=u),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t||(t={}),(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){var s;typeof t=="object"?(e=(s=t.height)!=null?s:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,s=this.bounds.height,i=-e*this.anchor.x;let n=0;return t.x>=i&&t.x<=i+e&&(n=-s*this.anchor.y,t.y>=n&&t.y<=n+s)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function pn(r,t){var e;let s=(e=r[0])!=null?e:{};return(typeof s=="string"||r[1])&&(s={text:s,style:r[1]}),s}class $u extends dn{constructor(...t){const e=pn(t,"Text");super(e,zt),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Ft?e.textureStyle:new Ft(e.textureStyle))}updateBounds(){const t=this._bounds,e=this._anchor;let s=0,i=0;if(this._style.trim){const{frame:n,canvasAndContext:o}=_r.getCanvasAndContext({text:this.text,style:this._style,resolution:1});_r.returnCanvasAndContext(o),s=n.width,i=n.height}else{const n=kt.measureText(this._text,this._style);s=n.width,i=n.height}t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*i,t.maxY=t.minY+i}}class q0 extends B0{resolveQueueItem(t,e){return t instanceof mt?this.resolveContainerQueueItem(t,e):t instanceof q||t instanceof w?e.push(t.source):t instanceof pt&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof jt||t instanceof j0||t instanceof Ar?e.push(t.texture.source):t instanceof $u?e.push(t):t instanceof Dr?e.push(t.context):t instanceof Us&&t.textures.forEach(s=>{s.source?e.push(s.source):e.push(s.texture.source)})}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getGpuContext(t);const{instructions:e}=t;for(const s of e)if(s.action==="texture"){const{image:i}=s.data;return i.source}else if(s.action==="fill"){const{texture:i}=s.data.style;return i.source}return null}}class K0 extends dn{constructor(...t){var e,s,i;const n=pn(t,"BitmapText");(e=n.style)!=null||(n.style=n.style||{}),(i=(s=n.style).fill)!=null||(s.fill=16777215),super(n,zt),this.renderPipeId="bitmapText"}updateBounds(){const t=this._bounds,e=this._anchor,s=gs.measureText(this.text,this._style),i=s.scale,n=s.offsetY*i;let o=s.width*i,a=s.height*i;const u=this._style._stroke;u&&(o+=u.width,a+=u.width),t.minX=-e._x*o,t.maxX=t.minX+o,t.minY=-e._y*(a+n),t.maxY=t.minY+a}set resolution(t){}get resolution(){return this._resolution}}class Z0 extends dn{constructor(...t){const e=pn(t,"HtmlText");super(e,Is),this.renderPipeId="htmlText",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Ft?e.textureStyle:new Ft(e.textureStyle))}updateBounds(){const t=this._bounds,e=this._anchor,s=qa(this.text,this._style),{width:i,height:n}=s;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}class Q0 extends q0{uploadQueueItem(t){t instanceof q?this.uploadTextureSource(t):t instanceof $u?this.uploadText(t):t instanceof Z0?this.uploadHTMLText(t):t instanceof K0?this.uploadBitmapText(t):t instanceof pt&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getGpuContext(t);const{instructions:e}=t;for(const s of e)if(s.action==="texture"){const{image:i}=s.data;this.uploadTextureSource(i.source)}else if(s.action==="fill"){const{texture:i}=s.data.style;this.uploadTextureSource(i.source)}return null}}class J0 extends Q0{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}J0.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"prepare"};class Xu{constructor(){this._tempState=Pt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,s){const i=t.renderer,n=this._didUploadHash[s.uid];i.shader.bind(s,n),n||(this._didUploadHash[s.uid]=!0),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(e,s.glProgram)}execute(t,e){const s=t.renderer;this._tempState.blendMode=e.blendMode,s.state.set(this._tempState);const i=e.textures.textures;for(let n=0;n<e.textures.count;n++)s.texture.bind(i[n],n);s.geometry.draw(e.topology,e.size,e.start)}}Xu.extension={type:[y.WebGLPipesAdaptor],name:"batch"};function Hw(r){const t=[];let e=0;for(let s=0;s<r;s++)t[e]={texture:{sampleType:"float",viewDimension:"2d",multisampled:!1},binding:e,visibility:GPUShaderStage.FRAGMENT},e++,t[e]={sampler:{type:"filtering"},binding:e,visibility:GPUShaderStage.FRAGMENT},e++;return t}function zw(r){const t={};let e=0;for(let s=0;s<r;s++)t[`textureSource${s+1}`]=e++,t[`textureSampler${s+1}`]=e++;return t}const fn=Pt.for2d();class Hu{start(t,e,s){const i=t.renderer,n=i.encoder,o=s.gpuProgram;this._shader=s,this._geometry=e,n.setGeometry(e,o),fn.blendMode="normal",i.pipeline.getPipeline(e,o,fn);const a=i.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,o)}execute(t,e){const s=this._shader.gpuProgram,i=t.renderer,n=i.encoder;if(!e.bindGroup){const u=e.textures;e.bindGroup=pi(u.textures,u.count,i.limits.maxBatchableTextures)}fn.blendMode=e.blendMode;const o=i.bindGroup.getBindGroup(e.bindGroup,s,1),a=i.pipeline.getPipeline(this._geometry,s,fn,e.topology);e.bindGroup._touch(i.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,o),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}}Hu.extension={type:[y.WebGPUPipesAdaptor],name:"batch"};const zu=class Cy{constructor(t,e){this.state=Pt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null);var s,i;this.renderer=t,this._adaptor=e,(i=(s=this._adaptor).init)==null||i.call(s,this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Ai({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(const s in this._activeBatches)this._activeBatches[s].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let s=this._activeBatches[t.batcherName];s||(s=this._activeBatches[t.batcherName]=Cy.getBatcher(t.batcherName),s.begin()),this._activeBatch=s}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);const e=this._activeBatches;for(const s in e){const i=e[s],n=i.geometry;n.indexBuffer.setDataWithSize(i.indexBuffer,i.indexSize,!0),n.buffers[0].setDataWithSize(i.attributeBuffer.float32View,i.attributeSize,!1)}}upload(t){const e=this._batchersByInstructionSet[t.uid];for(const s in e){const i=e[s],n=i.geometry;i.dirty&&(i.dirty=!1,n.buffers[0].update(i.attributeSize*4))}}execute(t){if(t.action==="startBatch"){const e=t.batcher,s=e.geometry,i=e.shader;this._adaptor.start(this,s,i)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};zu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"batch"},zu._availableBatchers=Object.create(null);let ju=zu;I.handleByMap(y.Batcher,ju._availableBatchers),I.add(Ai);function jw(r){const t=r.split(/([\n{}])/g).map(s=>s.trim()).filter(s=>s.length);let e="";return t.map(s=>{let i=e+s;return s==="{"?e+=" ":s==="}"&&(e=e.substr(0,e.length-4),i=e+s),i}).join(`
`)}const t2={name:"texture-bit",vertex:{header:`
struct TextureUniforms {
uTextureMatrix:mat3x3<f32>,
}
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
`,main:`
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
`},fragment:{header:`
@group(2) @binding(0) var uTexture: texture_2d<f32>;
@group(2) @binding(1) var uSampler: sampler;
`,main:`
outColor = textureSample(uTexture, uSampler, vUV);
`}},e2={name:"texture-bit",vertex:{header:`
uniform mat3 uTextureMatrix;
`,main:`
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
`},fragment:{header:`
uniform sampler2D uTexture;
`,main:`
outColor = texture(uTexture, vUV);
`}},Vw=new nt;let Ww=class extends Kr{constructor(){super(),this.filters=[new M0({sprite:new jt(w.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}};class Vu{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,s){const i=this._renderer;if(i.renderPipes.batch.break(s),s.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){const n=t.mask;n.includeInBuild=!0,n.collectRenderables(s,i,null),n.includeInBuild=!1}i.renderPipes.batch.break(s),s.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){const e=this._renderer,s=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){const i=ut.get(Ww);if(i.inverse=t.inverse,s){t.mask.mask.measurable=!0;const n=Zr(t.mask.mask,!0,Vw);t.mask.mask.measurable=!1,n.ceil();const o=e.renderTarget.renderTarget.colorTexture.source,a=et.getOptimalTexture(n.width,n.height,o._resolution,o.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});const u=i.sprite;u.texture=a,u.worldTransform.tx=n.minX,u.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer,filterTexture:a})}else i.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){const i=this._activeMaskStage[this._activeMaskStage.length-1];s&&(e.type===vt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();const i=this._activeMaskStage.pop();s&&et.returnTexture(i.filterTexture),ut.return(i.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}Vu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"alphaMask"};class Wu{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,s){this._renderer.renderPipes.batch.break(s);const i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&t.mask;const n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,s.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,s){this._renderer.renderPipes.batch.break(s);const i=this._colorStack;this._colorStackIndex--;const n=i[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,s.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}Wu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"colorMask"};class Yw{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){ci(this.mask,t,e)}addLocalBounds(t,e){hi(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}}class Yu{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,s){var i,n;const o=t,a=this._renderer;a.renderPipes.batch.break(s),a.renderPipes.blendMode.setBlendMode(o.mask,"none",s),s.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const u=o.mask;u.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});const l=this._maskHash.get(o);l.instructionsStart=s.instructionSize,u.collectRenderables(s,a,null),u.includeInBuild=!1,a.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const c=s.instructionSize-l.instructionsStart-1;l.instructionsLength=c;const h=a.renderTarget.renderTarget.uid;(n=(i=this._maskStackHash)[h])!=null||(i[h]=0)}pop(t,e,s){const i=t,n=this._renderer;n.renderPipes.batch.break(s),n.renderPipes.blendMode.setBlendMode(i.mask,"none",s),s.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});const o=this._maskHash.get(t);for(let a=0;a<o.instructionsLength;a++)s.instructions[s.instructionSize++]=s.instructions[o.instructionsStart++];s.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e,s;const i=this._renderer,n=i.renderTarget.renderTarget.uid;let o=(s=(e=this._maskStackHash)[n])!=null?s:e[n]=0;t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Q.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(Q.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Q.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Q.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,Tt.STENCIL),i.stencil.setStencilMode(Q.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(Q.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Q.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[n]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}Yu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"stencilMask"};var Ms=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Ms||{});class r2{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class qu{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gl=this._renderer.gl,this._gpuBuffers=Object.create(null),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,s=this.getGlBuffer(t);e.bindBuffer(s.type,s.buffer)}bindBufferBase(t,e){const{_gl:s}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,s.bindBufferBase(s.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let s=0,i=this._nextBindBaseIndex;for(;s<2;){i>=this._maxBindings&&(i=this._minBaseLocation,s++);const n=this._boundBufferBases[i];if(n&&n._lastBindCallId===this._bindCallId){i++;continue}break}return e=i,this._nextBindBaseIndex=i+1,s>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){const e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,s,i){const{_gl:n}=this;s||(s=0),e||(e=0),this._boundBufferBases[e]=null,n.bindBufferRange(n.UNIFORM_BUFFER,e||0,t.buffer,s*256,i||256)}updateBuffer(t){const{_gl:e}=this,s=this.getGlBuffer(t);if(t._updateID===s.updateID)return s;s.updateID=t._updateID,e.bindBuffer(s.type,s.buffer);const i=t.data,n=t.descriptor.usage&$.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return i?s.byteLength>=i.byteLength?e.bufferSubData(s.type,0,i,0,t._updateSize/i.BYTES_PER_ELEMENT):(s.byteLength=i.byteLength,e.bufferData(s.type,i,n)):(s.byteLength=t.descriptor.size,e.bufferData(s.type,s.byteLength,n)),s}destroyAll(){const t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){const s=this._gpuBuffers[t.uid],i=this._gl;e||i.deleteBuffer(s.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){const{_gl:e}=this;let s=Ms.ARRAY_BUFFER;t.descriptor.usage&$.INDEX?s=Ms.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&$.UNIFORM&&(s=Ms.UNIFORM_BUFFER);const i=new r2(e.createBuffer(),s);return this._gpuBuffers[t.uid]=i,t.on("destroy",this.onBufferDestroy,this),i}resetState(){this._boundBufferBases=Object.create(null)}}qu.extension={type:[y.WebGLSystem],name:"buffer"};var qw=Object.defineProperty,Kw=Object.defineProperties,Zw=Object.getOwnPropertyDescriptors,s2=Object.getOwnPropertySymbols,Qw=Object.prototype.hasOwnProperty,Jw=Object.prototype.propertyIsEnumerable,i2=(r,t,e)=>t in r?qw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mn=(r,t)=>{for(var e in t||(t={}))Qw.call(t,e)&&i2(r,e,t[e]);if(s2)for(var e of s2(t))Jw.call(t,e)&&i2(r,e,t[e]);return r},n2=(r,t)=>Kw(r,Zw(t));const Ku=class Ry{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),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}init(t){var e,s;t=mn(mn({},Ry.defaultOptions),t);let i=this.multiView=t.multiView;if(t.context&&i&&(Ut("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),i=!1),i?this.canvas=L.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const n=this._renderer.background.alpha<1,o=(e=t.premultipliedAlpha)!=null?e:!0,a=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:n,premultipliedAlpha:o,antialias:a,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:(s=t.powerPreference)!=null?s:"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&Ut("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof L.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);const e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let s;const i=this.canvas;if(t===2&&(s=i.getContext("webgl2",e)),!s&&(s=i.getContext("webgl",e),!s))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=s,this.initFromContext(this.gl)}getExtensions(){const{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions=n2(mn({},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"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")});else{this.extensions=n2(mn({},e),{colorBufferFloat:t.getExtension("EXT_color_buffer_float")});const s=t.getExtension("WEBGL_provoking_vertex");s&&s.provokingVertexWEBGL(s.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var e;this.gl.isContextLost()&&((e=this.extensions.loseContext)==null||e.restoreContext())},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(t=this.extensions.loseContext)==null||t.loseContext()}forceContextLoss(){var t;(t=this.extensions.loseContext)==null||t.loseContext(),this._contextLossForced=!0}validateContext(t){const e=t.getContextAttributes();e&&e.stencil;const s=this.supports,i=this.webGLVersion===2,n=this.extensions;s.uint32Indices=i||!!n.uint32ElementIndex,s.uniformBufferObject=i,s.vertexArrayObject=i||!!n.vertexArrayObject,s.srgbTextures=i||!!n.srgb,s.nonPowOf2wrapping=i,s.nonPowOf2mipmaps=i,s.msaa=i,s.uint32Indices}};Ku.extension={type:[y.WebGLSystem],name:"context"},Ku.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let o2=Ku;function Zu(r,t){var e,s,i;for(const n in r.attributes){const o=r.attributes[n],a=t[n];a?((e=o.format)!=null||(o.format=a.format),(s=o.offset)!=null||(o.offset=a.offset),(i=o.instance)!=null||(o.instance=a.instance)):Ut(`Attribute ${n} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}tC(r)}function tC(r){var t,e;const{buffers:s,attributes:i}=r,n={},o={};for(const a in s){const u=s[a];n[u.uid]=0,o[u.uid]=0}for(const a in i){const u=i[a];n[u.buffer.uid]+=ue(u.format).stride}for(const a in i){const u=i[a];(t=u.stride)!=null||(u.stride=n[u.buffer.uid]),(e=u.start)!=null||(u.start=o[u.buffer.uid]),o[u.buffer.uid]+=ue(u.format).stride}}var gn=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(gn||{}),Qu=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Qu||{}),a2=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(a2||{}),H=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(H||{});const u2={uint8x2:H.UNSIGNED_BYTE,uint8x4:H.UNSIGNED_BYTE,sint8x2:H.BYTE,sint8x4:H.BYTE,unorm8x2:H.UNSIGNED_BYTE,unorm8x4:H.UNSIGNED_BYTE,snorm8x2:H.BYTE,snorm8x4:H.BYTE,uint16x2:H.UNSIGNED_SHORT,uint16x4:H.UNSIGNED_SHORT,sint16x2:H.SHORT,sint16x4:H.SHORT,unorm16x2:H.UNSIGNED_SHORT,unorm16x4:H.UNSIGNED_SHORT,snorm16x2:H.SHORT,snorm16x4:H.SHORT,float16x2:H.HALF_FLOAT,float16x4:H.HALF_FLOAT,float32:H.FLOAT,float32x2:H.FLOAT,float32x3:H.FLOAT,float32x4:H.FLOAT,uint32:H.UNSIGNED_INT,uint32x2:H.UNSIGNED_INT,uint32x3:H.UNSIGNED_INT,uint32x4:H.UNSIGNED_INT,sint32:H.INT,sint32x2:H.INT,sint32x3:H.INT,sint32x4:H.INT};function l2(r){var t;return(t=u2[r])!=null?t:u2.float32}const eC={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ju{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){const t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=i=>e.bindVertexArrayOES(i),t.deleteVertexArray=i=>e.deleteVertexArrayOES(i));const s=this._renderer.context.extensions.vertexAttribDivisorANGLE;s&&(t.drawArraysInstanced=(i,n,o,a)=>{s.drawArraysInstancedANGLE(i,n,o,a)},t.drawElementsInstanced=(i,n,o,a,u)=>{s.drawElementsInstancedANGLE(i,n,o,a,u)},t.vertexAttribDivisor=(i,n)=>s.vertexAttribDivisorANGLE(i,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){const s=this.gl;this._activeGeometry=t;const i=this.getVao(t,e);this._activeVao!==i&&(this._activeVao=i,s.bindVertexArray(i)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let s=0;s<t.buffers.length;s++){const i=t.buffers[s];e.updateBuffer(i)}}checkCompatibility(t,e){const s=t.attributes,i=e._attributeData;for(const n in i)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,i=e._attributeData,n=["g",t.uid];for(const o in s)i[o]&&n.push(o,i[o].location);return n.join("-")}getVao(t,e){var s;return((s=this._geometryVaoHash[t.uid])==null?void 0:s[e._key])||this.initGeometryVao(t,e)}initGeometryVao(t,e,s=!0){const i=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);const o=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));const a=this._geometryVaoHash[t.uid];let u=a[o];if(u)return a[e._key]=u,u;Zu(t,e._attributeData);const l=t.buffers;u=i.createVertexArray(),i.bindVertexArray(u);for(let c=0;c<l.length;c++){const h=l[c];n.bind(h)}return this.activateVao(t,e),a[e._key]=u,a[o]=u,i.bindVertexArray(null),u}onGeometryDestroy(t,e){const s=this._geometryVaoHash[t.uid],i=this.gl;if(s){if(e)for(const n in s)this._activeVao!==s[n]&&this.unbind(),i.deleteVertexArray(s[n]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){const e=this.gl;for(const s in this._geometryVaoHash){if(t)for(const i in this._geometryVaoHash[s]){const n=this._geometryVaoHash[s];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[i])}this._geometryVaoHash[s]=null}}activateVao(t,e){var s,i;const n=this._renderer.gl,o=this._renderer.buffer,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let u=null;for(const l in a){const c=a[l],h=c.buffer,d=o.getGlBuffer(h),p=e._attributeData[l];if(p){u!==d&&(o.bind(h),u=d);const f=p.location;n.enableVertexAttribArray(f);const g=ue(c.format),m=l2(c.format);if(((s=p.format)==null?void 0:s.substring(1,4))==="int"?n.vertexAttribIPointer(f,g.size,m,c.stride,c.offset):n.vertexAttribPointer(f,g.size,m,g.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const _=(i=c.divisor)!=null?i:1;n.vertexAttribDivisor(f,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,i){const{gl:n}=this._renderer,o=this._activeGeometry,a=eC[t||o.topology];if(i!=null||(i=o.instanceCount),o.indexBuffer){const u=o.indexBuffer.data.BYTES_PER_ELEMENT,l=u===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;i>1?n.drawElementsInstanced(a,e||o.indexBuffer.data.length,l,(s||0)*u,i):n.drawElements(a,e||o.indexBuffer.data.length,l,(s||0)*u)}else i>1?n.drawArraysInstanced(a,s||0,e||o.getSize(),i):n.drawArrays(a,s||0,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}Ju.extension={type:[y.WebGLSystem],name:"geometry"};var rC=Object.defineProperty,c2=Object.getOwnPropertySymbols,sC=Object.prototype.hasOwnProperty,iC=Object.prototype.propertyIsEnumerable,h2=(r,t,e)=>t in r?rC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,d2=(r,t)=>{for(var e in t||(t={}))sC.call(t,e)&&h2(r,e,t[e]);if(c2)for(var e of c2(t))iC.call(t,e)&&h2(r,e,t[e]);return r};const nC=new Fe({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),tl=class Py{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){const{useBackBuffer:e,antialias:s}=d2(d2({},Py.defaultOptions),t);this.useBackBuffer=e,this._antialias=s,this._renderer.context.supports.msaa||(Ut("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Pt.for2d();const i=new Rt({vertex:`
attribute vec2 aPosition;
out vec2 vUv;
void main() {
gl_Position = vec4(aPosition, 0.0, 1.0);
vUv = (aPosition + 1.0) / 2.0;
// flip dem UVs
vUv.y = 1.0 - vUv.y;
}`,fragment:`
in vec2 vUv;
out vec4 finalColor;
uniform sampler2D uTexture;
void main() {
finalColor = texture(uTexture, vUv);
}`,name:"big-triangle"});this._bigTriangleShader=new Ot({glProgram:i,resources:{uTexture:w.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const s=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=s.colorTexture,t.target=this._getBackBufferTexture(s.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:nC,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new w({source:new q({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};tl.extension={type:[y.WebGLSystem],name:"backBuffer",priority:1},tl.defaultOptions={useBackBuffer:!1};let p2=tl;class el{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}}el.extension={type:[y.WebGLSystem],name:"colorMask"};class rl{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:s,shader:i,state:n,skipSync:o,topology:a,size:u,start:l,instanceCount:c}=t;e.shader.bind(i,o),e.geometry.bind(s,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,u,l,c!=null?c:s.instanceCount)}destroy(){this._renderer=null}}rl.extension={type:[y.WebGLSystem],name:"encoder"};class sl{constructor(t){this._renderer=t}contextChange(){const t=this._renderer.gl;this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=Fo(this.maxTextures,t),this.maxUniformBindings=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS)}destroy(){}}sl.extension={type:[y.WebGLSystem],name:"limits"};class f2{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const de=[];de[Q.NONE]=void 0,de[Q.DISABLED]={stencilWriteMask:0,stencilReadMask:0},de[Q.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},de[Q.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},de[Q.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},de[Q.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class il{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Q.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Q.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Q.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){const s=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,n=de[t],o=this._stencilCache;if(s.stencilMode=t,s.stencilReference=e,t===Q.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(t!==o.stencilMode||o.stencilReference!==e)&&(o.stencilMode=t,o.stencilReference=e,i.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}}il.extension={type:[y.WebGLSystem],name:"stencil"};class nl{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!nu())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const e=this.getUniformGroupData(t);t.buffer||(t.buffer=new yt({data:new Float32Array(e.layout.size/4),usage:$.UNIFORM|$.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let s=this._syncFunctionHash[e];if(!s){const i=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(i),o=this._generateUboSync(n.uboElements);s=this._syncFunctionHash[e]={layout:n,syncFunction:o}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,s){const i=this.getUniformGroupData(t);t.buffer||(t.buffer=new yt({data:new Float32Array(i.layout.size/4),usage:$.UNIFORM|$.COPY_DST}));let n=null;return e||(e=t.buffer.data,n=t.buffer.dataInt32),s||(s=0),i.syncFunction(t.uniforms,e,n,s),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const ol={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function m2(r){const t=r.map(n=>({data:n,offset:0,size:0})),e=16;let s=0,i=0;for(let n=0;n<t.length;n++){const o=t[n];if(s=ol[o.data.type],!s)throw new Error(`Unknown type ${o.data.type}`);o.data.size>1&&(s=Math.max(s,e)*o.data.size);const a=s===12?16:s;o.size=s;const u=i%e;u>0&&e-u<a?i+=(e-u)%16:i+=(s-u%s)%s,o.offset=i,i+=s}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}const Te=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
var matrix = uv[name].toArray(true);
data[offset] = matrix[0];
data[offset + 1] = matrix[1];
data[offset + 2] = matrix[2];
data[offset + 4] = matrix[3];
data[offset + 5] = matrix[4];
data[offset + 6] = matrix[5];
data[offset + 8] = matrix[6];
data[offset + 9] = matrix[7];
data[offset + 10] = matrix[8];
`,uniform:`
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.width!==void 0,ubo:`
v = uv[name];
data[offset] = v.x;
data[offset + 1] = v.y;
data[offset + 2] = v.width;
data[offset + 3] = v.height;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
cv[0] = v.x;
cv[1] = v.y;
cv[2] = v.width;
cv[3] = v.height;
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
}
`},{type:"vec2<f32>",test:r=>r.type==="vec2<f32>"&&r.size===1&&r.value.x!==void 0,ubo:`
v = uv[name];
data[offset] = v.x;
data[offset + 1] = v.y;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.x || cv[1] !== v.y) {
cv[0] = v.x;
cv[1] = v.y;
gl.uniform2f(ud[name].location, v.x, v.y);
}
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
v = uv[name];
data[offset] = v.red;
data[offset + 1] = v.green;
data[offset + 2] = v.blue;
data[offset + 3] = v.alpha;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
cv[3] = v.alpha;
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
}
`},{type:"vec3<f32>",test:r=>r.type==="vec3<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
v = uv[name];
data[offset] = v.red;
data[offset + 1] = v.green;
data[offset + 2] = v.blue;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
}
`}];function al(r,t,e,s){const i=[`
var v = null;
var v2 = null;
var t = 0;
var index = 0;
var name = null;
var arrayOffset = null;
`];let n=0;for(let a=0;a<r.length;a++){const u=r[a],l=u.data.name;let c=!1,h=0;for(let d=0;d<Te.length;d++)if(Te[d].test(u.data)){h=u.offset/4,i.push(`name = "${l}";`,`offset += ${h-n};`,Te[d][t]||Te[d].ubo),c=!0;break}if(!c)if(u.data.size>1)h=u.offset/4,i.push(e(u,h-n));else{const d=s[u.data.type];h=u.offset/4,i.push(`
v = uv.${l};
offset += ${h-n};
${d};
`)}n=h}const o=i.join(`
`);return new Function("uv","data","dataInt32","offset",o)}var oC=Object.defineProperty,aC=Object.defineProperties,uC=Object.getOwnPropertyDescriptors,g2=Object.getOwnPropertySymbols,lC=Object.prototype.hasOwnProperty,cC=Object.prototype.propertyIsEnumerable,_2=(r,t,e)=>t in r?oC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hC=(r,t)=>{for(var e in t||(t={}))lC.call(t,e)&&_2(r,e,t[e]);if(g2)for(var e of g2(t))cC.call(t,e)&&_2(r,e,t[e]);return r},dC=(r,t)=>aC(r,uC(t));function Sr(r,t){return`
for (let i = 0; i < ${r*t}; i++) {
data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
}
`}const ul={f32:`
data[offset] = v;`,i32:`
dataInt32[offset] = v;`,"vec2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];`,"vec3<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];`,"vec4<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 3] = v[3];`,"vec2<i32>":`
dataInt32[offset] = v[0];
dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
dataInt32[offset] = v[0];
dataInt32[offset + 1] = v[1];
dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
dataInt32[offset] = v[0];
dataInt32[offset + 1] = v[1];
dataInt32[offset + 2] = v[2];
dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 4] = v[2];
data[offset + 5] = v[3];`,"mat3x3<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 4] = v[3];
data[offset + 5] = v[4];
data[offset + 6] = v[5];
data[offset + 8] = v[6];
data[offset + 9] = v[7];
data[offset + 10] = v[8];`,"mat4x4<f32>":`
for (let i = 0; i < 16; i++) {
data[offset + i] = v[i];
}`,"mat3x2<f32>":Sr(3,2),"mat4x2<f32>":Sr(4,2),"mat2x3<f32>":Sr(2,3),"mat4x3<f32>":Sr(4,3),"mat2x4<f32>":Sr(2,4),"mat3x4<f32>":Sr(3,4)},x2=dC(hC({},ul),{"mat2x2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 3] = v[3];
`});function b2(r,t){const e=Math.max(ol[r.data.type]/16,1),s=r.data.value.length/r.data.size,i=(4-s%4)%4,n=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
v = uv.${r.data.name};
offset += ${t};
arrayOffset = offset;
t = 0;
for(var i=0; i < ${r.data.size*e}; i++)
{
for(var j = 0; j < ${s}; j++)
{
${n}[arrayOffset++] = v[t++];
}
${i!==0?`arrayOffset += ${i};`:""}
}
`}function y2(r){return al(r,"uboStd40",b2,ul)}class ll extends nl{constructor(){super({createUboElements:m2,generateUboSync:y2})}}ll.extension={type:[y.WebGLSystem],name:"ubo"};class v2{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}copyToTexture(t,e,s,i,n){const o=this._renderTargetSystem,a=this._renderer,u=o.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,u.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,s.x,s.y,i.width,i.height),e}startRenderPass(t,e=!0,s,i){const n=this._renderTargetSystem,o=t.colorTexture,a=n.getGpuRenderTarget(t);let u=i.y;t.isRoot&&(u=o.pixelHeight-i.height),t.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});const l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);const c=this._viewPortCache;(c.x!==i.x||c.y!==u||c.width!==i.width||c.height!==i.height)&&(c.x=i.x,c.y=u,c.width=i.width,c.height=i.height,l.viewport(i.x,u,i.width,i.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,s)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,e.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,e.framebuffer),s.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer.gl,s=new f2;return t.colorTexture instanceof Kt?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),e.bindFramebuffer(e.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(s=>{e.deleteRenderbuffer(s)}),t.msaaRenderBuffer=null}clear(t,e,s){if(!e)return;const i=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Tt.ALL:Tt.NONE);const n=this._renderer.gl;if(e&Tt.COLOR){s!=null||(s=i.defaultClearColor);const o=this._clearColorCache,a=s;(o[0]!==a[0]||o[1]!==a[1]||o[2]!==a[2]||o[3]!==a[3])&&(o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const s=this._renderer,i=s.gl,n=i.createFramebuffer();if(e.resolveTargetFramebuffer=n,i.bindFramebuffer(i.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((o,a)=>{const u=o.source;u.antialias&&(s.context.supports.msaa?e.msaa=!0:Ut("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),s.texture.bindSource(u,0);const l=s.texture.getGlSource(u).texture;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,3553,l,0)}),e.msaa){const o=i.createFramebuffer();e.framebuffer=o,i.bindFramebuffer(i.FRAMEBUFFER,o),t.colorTextures.forEach((a,u)=>{const l=i.createRenderbuffer();e.msaaRenderBuffer[u]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){const s=t.colorTexture.source;if(e.width=s.pixelWidth,e.height=s.pixelHeight,t.colorTextures.forEach((i,n)=>{n!==0&&i.source.resize(s.width,s.height,s._resolution)}),e.msaa){const i=this._renderer,n=i.gl,o=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,o),t.colorTextures.forEach((a,u)=>{const l=a.source;i.texture.bindSource(l,0);const c=i.texture.getGlSource(l).internalFormat,h=e.msaaRenderBuffer[u];n.bindRenderbuffer(n.RENDERBUFFER,h),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,c,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+u,n.RENDERBUFFER,h)})}}_initStencil(t){if(t.framebuffer===null)return;const e=this._renderer.gl,s=e.createRenderbuffer();t.depthStencilRenderBuffer=s,e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,s),this._resizeStencil(t)}_resizeStencil(t){const e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){const e=t.colorTexture.resource;this._renderer.context.multiView&&Kt.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Kt.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,s=t.colorTexture;s.context2D.drawImage(e,0,s.pixelHeight-e.height)}}}function T2(r,t,e,s,i,n){const o=n?1:-1;return r.identity(),r.a=1/s*2,r.d=o*(1/i*2),r.tx=-1-t*r.a,r.ty=-o-e*r.d,r}var pC=Object.defineProperty,A2=Object.getOwnPropertySymbols,fC=Object.prototype.hasOwnProperty,mC=Object.prototype.propertyIsEnumerable,S2=(r,t,e)=>t in r?pC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gC=(r,t)=>{for(var e in t||(t={}))fC.call(t,e)&&S2(r,e,t[e]);if(A2)for(var e of A2(t))mC.call(t,e)&&S2(r,e,t[e]);return r};const Er=new Map;function cl(r,t){if(!Er.has(r)){const e=new w({source:new Kt(gC({resource:r},t))}),s=()=>{Er.get(r)===e&&Er.delete(r)};e.once("destroy",s),e.source.once("destroy",s),Er.set(r,e)}return Er.get(r)}function _C(r){return Er.has(r)}function E2(r){const t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var xC=Object.defineProperty,w2=Object.getOwnPropertySymbols,bC=Object.prototype.hasOwnProperty,yC=Object.prototype.propertyIsEnumerable,C2=(r,t,e)=>t in r?xC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,R2=(r,t)=>{for(var e in t||(t={}))bC.call(t,e)&&C2(r,e,t[e]);if(w2)for(var e of w2(t))yC.call(t,e)&&C2(r,e,t[e]);return r};const P2=class Dy{constructor(t={}){if(this.uid=Y("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=R2(R2({},Dy.defaultOptions),t),this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new q({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(s=>s.source)];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof w||t.depthStencilTexture instanceof q?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new q({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,s=this.resolution,i=!1){this.dirtyId++,this.colorTextures.forEach((n,o)=>{i&&o===0||n.source.resize(t,e,s)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,s)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};P2.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let _n=P2;class hl{constructor(t){this.rootViewPort=new z,this.viewport=new z,this.onRenderTargetChange=new ou("onRenderTargetChange"),this.projectionMatrix=new D,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:s,frame:i}){var n,o;this._renderTargetStack.length=0,this.push(t,e,s,i),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=E2(this.rootRenderTarget),(o=(n=this.adaptor).prerender)==null||o.call(n,this.rootRenderTarget)}postrender(){var t,e;(e=(t=this.adaptor).postrender)==null||e.call(t,this.rootRenderTarget)}bind(t,e=!0,s,i){const n=this.getRenderTarget(t),o=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;const a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);const u=n.colorTexture,l=this.viewport,c=u.pixelWidth,h=u.pixelHeight;if(!i&&t instanceof w&&(i=t.frame),i){const d=u._resolution;l.x=i.x*d+.5|0,l.y=i.y*d+.5|0,l.width=i.width*d+.5|0,l.height=i.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=h;return T2(this.projectionMatrix,0,0,l.width/u.resolution,l.height/u.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,s,l),o&&this.onRenderTargetChange.emit(n),n}clear(t,e=Tt.ALL,s){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,s,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Tt.ALL,s,i){const n=this.bind(t,e,s,i);return this._renderTargetStack.push({renderTarget:n,frame:i}),n}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),(e=this._renderSurfaceToRenderTargetHash.get(t))!=null?e:this._initRenderTarget(t)}copyToTexture(t,e,s,i,n){s.x<0&&(i.width+=s.x,n.x-=s.x,s.x=0),s.y<0&&(i.height+=s.y,n.y-=s.y,s.y=0);const{pixelWidth:o,pixelHeight:a}=t;return i.width=Math.min(i.width,o-s.x),i.height=Math.min(i.height,a-s.y),this.adaptor.copyToTexture(t,e,s,i,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Kt.test(t)&&(t=cl(t).source),t instanceof _n?e=t:t instanceof q&&(e=new _n({colorTextures:[t]}),t.source instanceof Kt&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const s=this._gpuRenderTargetHash[e.uid];s&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(s))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}class dl extends hl{constructor(t){super(t),this.adaptor=new v2,this.adaptor.init(t,this)}}dl.extension={type:[y.WebGLSystem],name:"renderTarget"};class xn extends Ct{constructor({buffer:t,offset:e,size:s}){super(),this.uid=Y("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Y("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=s,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Y("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function D2(r,t){const e=[],s=[`
var g = s.groups;
var sS = r.shader;
var p = s.glProgram;
var ugS = r.uniformGroup;
var resources;
`];let i=!1,n=0;const o=t._getProgramData(r.glProgram);for(const u in r.groups){const l=r.groups[u];e.push(`
resources = g[${u}].resources;
`);for(const c in l.resources){const h=l.resources[c];if(h instanceof rt)if(h.ubo){const d=r._uniformBindMap[u][Number(c)];e.push(`
sS.bindUniformBlock(
resources[${c}],
'${d}',
${r.glProgram._uniformBlockData[d].index}
);
`)}else e.push(`
ugS.updateUniformGroup(resources[${c}], p, sD);
`);else if(h instanceof xn){const d=r._uniformBindMap[u][Number(c)];e.push(`
sS.bindUniformBlock(
resources[${c}],
'${d}',
${r.glProgram._uniformBlockData[d].index}
);
`)}else if(h instanceof q){const d=r._uniformBindMap[u][c],p=o.uniformData[d];p&&(i||(i=!0,s.push(`
var tS = r.texture;
`)),t._gl.uniform1i(p.location,n),e.push(`
tS.bind(resources[${c}], ${n});
`),n++)}}}const a=[...s,...e].join(`
`);return new Function("r","s","sD",a)}class vC{}class M2{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function pl(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function fl(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function ml(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return fl(2*t);case"bvec3":return fl(3*t);case"bvec4":return fl(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}let bn=null;const O2={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"},TC={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function gl(r,t){if(!bn){const e=Object.keys(O2);bn={};for(let s=0;s<e.length;++s){const i=e[s];bn[r[i]]=O2[i]}}return bn[t]}function B2(r,t){const e=gl(r,t);return TC[e]||"float32"}function G2(r,t,e=!1){const s={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let o=0;o<i;o++){const a=t.getActiveAttrib(r,o);if(a.name.startsWith("gl_"))continue;const u=B2(t,a.type);s[a.name]={location:0,format:u,stride:ue(u).stride,offset:0,instance:!1,start:0}}const n=Object.keys(s);if(e){n.sort((o,a)=>o>a?1:-1);for(let o=0;o<n.length;o++)s[n[o]].location=o,t.bindAttribLocation(r,o,n[o]);t.linkProgram(r)}else for(let o=0;o<n.length;o++)s[n[o]].location=t.getAttribLocation(r,n[o]);return s}function F2(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let i=0;i<s;i++){const n=t.getActiveUniformBlockName(r,i),o=t.getUniformBlockIndex(r,n),a=t.getActiveUniformBlockParameter(r,i,t.UNIFORM_BLOCK_DATA_SIZE);e[n]={name:n,index:o,size:a}}return e}function I2(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const n=t.getActiveUniform(r,i),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),u=gl(t,n.type);e[o]={name:o,index:i,type:u,size:n.size,isArray:a,value:ml(u,n.size)}}return e}function U2(r,t){const e=r.getShaderSource(t).split(`
`).map((l,c)=>`${c}: ${l}`),s=r.getShaderInfoLog(t),i=s.split(`
`),n={},o=i.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const u=e.join(`
`);a[0]=u,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function k2(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||U2(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||U2(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function L2(r,t){const e=pl(r,r.VERTEX_SHADER,t.vertex),s=pl(r,r.FRAGMENT_SHADER,t.fragment),i=r.createProgram();r.attachShader(i,e),r.attachShader(i,s);const n=t.transformFeedbackVaryings;n&&(typeof r.transformFeedbackVaryings!="function"||r.transformFeedbackVaryings(i,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(i),r.getProgramParameter(i,r.LINK_STATUS)||k2(r,i,e,s),t._attributeData=G2(i,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=I2(i,r),t._uniformBlockData=F2(i,r),r.deleteShader(e),r.deleteShader(s);const o={};for(const a in t._uniformData){const u=t._uniformData[a];o[a]={location:r.getUniformLocation(i,a),value:ml(u.type,u.size)}}return new M2(i,o)}const yn={textureCount:0,blockIndex:0};class _l{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(t,e){if(this._setProgram(t.glProgram),e)return;yn.textureCount=0,yn.blockIndex=0;let s=this._shaderSyncFunctions[t.glProgram._key];s||(s=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),s(this._renderer,t,yn)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,yn)}bindUniformBlock(t,e,s=0){const i=this._renderer.buffer,n=this._getProgramData(this._activeProgram),o=t._bufferResource;o||this._renderer.ubo.updateUniformGroup(t);const a=t.buffer,u=i.updateBuffer(a),l=i.freeLocationForBufferBase(u);if(o){const{offset:h,size:d}=t;h===0&&d===a.data.byteLength?i.bindBufferBase(u,l):i.bindBufferRange(u,l,h)}else i.getLastBindBaseLocation(u)!==l&&i.bindBufferBase(u,l);const c=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[s]!==l&&(n.uniformBlockBindings[s]=l,this._renderer.gl.uniformBlockBinding(n.program,c,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;const e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){const e=t._key;return this._programDataHash[e]=L2(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return D2(t,e)}resetState(){this._activeProgram=null}}_l.extension={type:[y.WebGLSystem],name:"shader"};const N2={f32:`if (cv !== v) {
cu.value = v;
gl.uniform1f(location, v);
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2f(location, v[0], v[1]);
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3f(location, v[0], v[1], v[2]);
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
}`,i32:`if (cv !== v) {
cu.value = v;
gl.uniform1i(location, v);
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,u32:`if (cv !== v) {
cu.value = v;
gl.uniform1ui(location, v);
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2ui(location, v[0], v[1]);
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3ui(location, v[0], v[1], v[2]);
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
}`,bool:`if (cv !== v) {
cu.value = v;
gl.uniform1i(location, v);
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},$2={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};function X2(r,t){const e=[`
var v = null;
var cv = null;
var cu = null;
var t = 0;
var gl = renderer.gl;
var name = null;
`];for(const s in r.uniforms){if(!t[s]){r.uniforms[s]instanceof rt?r.uniforms[s].ubo?e.push(`
renderer.shader.bindUniformBlock(uv.${s}, "${s}");
`):e.push(`
renderer.shader.updateUniformGroup(uv.${s});
`):r.uniforms[s]instanceof xn&&e.push(`
renderer.shader.bindBufferResource(uv.${s}, "${s}");
`);continue}const i=r.uniformStructures[s];let n=!1;for(let o=0;o<Te.length;o++){const a=Te[o];if(i.type===a.type&&a.test(i)){e.push(`name = "${s}";`,Te[o].uniform),n=!0;break}}if(!n){const o=(i.size===1?N2:$2)[i.type].replace("location",`ud["${s}"].location`);e.push(`
cu = ud["${s}"];
cv = cu.value;
v = uv["${s}"];
${o};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
`))}class xl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,s){const i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,s))}_getUniformSyncFunction(t,e){var s;return((s=this._uniformGroupSyncHash[t._signature])==null?void 0:s[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const s=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),s[e._key]=this._cache[i],s[e._key]}_generateUniformsSync(t,e){return X2(t,e)}_getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const o in i)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}xl.extension={type:[y.WebGLSystem],name:"uniformGroup"};function AC(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
out vec4 finalColor;
${r}
`,r}const SC={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function EC(r){return SC[r]}function H2(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof L.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const wC=0,CC=1,RC=2,PC=3,DC=4,MC=5,z2=class bc{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[wC]=this.setBlend,this.map[CC]=this.setOffset,this.map[RC]=this.setCullFace,this.map[PC]=this.setDepthTest,this.map[DC]=this.setFrontFace,this.map[MC]=this.setDepthMask,this.checks=[],this.defaultState=Pt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=H2(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e>>=1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(bc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(bc._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;const e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};z2.extension={type:[y.WebGLSystem],name:"state"};let j2=z2;class V2{constructor(t){this.target=Qu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=H.UNSIGNED_BYTE,this.internalFormat=gn.RGBA,this.format=gn.RGBA,this.samplerType=0}}const W2={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},OC={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Y2={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let s=r.pixelWidth,i=r.pixelHeight;const n=!!OC[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,t.format,t.type,a),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},bl={id:"image",upload(r,t,e,s){const i=t.width,n=t.height,o=r.pixelWidth,a=r.pixelHeight,u=r.resourceWidth,l=r.resourceHeight;u<o||l<a?((i!==o||n!==a)&&e.texImage2D(t.target,0,t.internalFormat,o,a,0,t.format,t.type,null),s===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,u,l,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):i===o&&n===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):s===2?e.texImage2D(t.target,0,t.internalFormat,o,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=o,t.height=a}},q2={id:"video",upload(r,t,e,s){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}bl.upload(r,t,e,s)}},yl={linear:9729,nearest:9728},K2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},vn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Z2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function vl(r,t,e,s,i,n,o,a){const u=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=vn[o?"clamp-to-edge":r.addressModeU],c=vn[o?"clamp-to-edge":r.addressModeV],h=vn[o?"clamp-to-edge":r.addressModeW];t[i](u,t.TEXTURE_WRAP_S,l),t[i](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[i](u,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[i](u,t.TEXTURE_MAG_FILTER,yl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const l=K2[r.minFilter][r.mipmapFilter];t[i](u,t.TEXTURE_MIN_FILTER,l)}}else t[i](u,t.TEXTURE_MIN_FILTER,yl[r.minFilter]);if(s&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[i](u,s.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[i](u,t.TEXTURE_COMPARE_FUNC,Z2[r.compare])}function Q2(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var BC=Object.defineProperty,GC=Object.defineProperties,FC=Object.getOwnPropertyDescriptors,J2=Object.getOwnPropertySymbols,IC=Object.prototype.hasOwnProperty,UC=Object.prototype.propertyIsEnumerable,tx=(r,t,e)=>t in r?BC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,He=(r,t)=>{for(var e in t||(t={}))IC.call(t,e)&&tx(r,e,t[e]);if(J2)for(var e of J2(t))UC.call(t,e)&&tx(r,e,t[e]);return r},kC=(r,t)=>GC(r,FC(t));function ex(r,t){let e={},s=r.RGBA;return r instanceof L.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},s=r.RGBA8),He(He(He(He(He(He(kC(He({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:s,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function rx(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function LC(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const s=r[e+3];if(s!==0){const i=255.001/s;r[e]=r[e]*i+.5,r[e+1]=r[e+1]*i+.5,r[e+2]=r[e+2]*i+.5}}}const NC=4;class Tl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:bl,buffer:W2,video:q2,compressed:Y2},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=ex(t,this._renderer.context.extensions),this._mapFormatToType=rx(t),this._mapFormatToFormat=Q2(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(w.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const s=t.source;t?(this.bindSource(s,e),this._useSeparateSamplers&&this._bindSampler(s.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const s=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=w.EMPTY.source);const i=this.getGlSource(t);s.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){const s=this._gl;if(!t){this._boundSamplers[e]=null,s.bindSampler(e,null);return}const i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,s.bindSampler(e,i))}unbind(t){const e=t.source,s=this._boundTextures,i=this._gl;for(let n=0;n<s.length;n++)if(s[n]===e){this._activateLocation(n);const o=this.getGlSource(e);i.bindTexture(o.target,null),s[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,s=new V2(e.createTexture());if(s.type=this._mapFormatToType[t.format],s.internalFormat=this._mapFormatToInternalFormat[t.format],s.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=s,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),s}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const s=this._gl,i=this.getGlSource(t);s.bindTexture(s.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,vl(t.style,s,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,s=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t;const i=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==i&&(this._premultiplyAlpha=i,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,s,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const s=this.getGlSource(t);this._gl.generateMipmap(s.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,s=this._gl.createSampler();return this._glSamplers[t._resourceId]=s,vl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:s,height:i}=this.getPixels(t),n=L.get().createCanvas();n.width=s,n.height=i;const o=n.getContext("2d");if(o){const a=o.createImageData(s,i);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,s=t.frame,i=Math.max(Math.round(s.width*e),1),n=Math.max(Math.round(s.height*e),1),o=new Uint8Array(NC*i*n),a=this._renderer,u=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(u),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(s.x*e),Math.round(s.y*e),i,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(w.EMPTY.source),this._boundSamplers=Object.create(null);const t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}}Tl.extension={type:[y.WebGLSystem],name:"texture"};class Al{contextChange(t){const e=new rt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new D,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),s=t.limits.maxBatchableTextures,i=lr({name:"graphics",bits:[xi,yi(s),ki,hr]});this.shader=new Ot({glProgram:i,resources:{localUniforms:e,batchSamplers:vi(s)}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:u}=o.getContextRenderData(s);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a.geometry,i.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let d=0;d<h.textures.count;d++)n.texture.bind(h.textures.textures[d],d);n.geometry.draw(h.topology,h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Al.extension={type:[y.WebGLPipesAdaptor],name:"graphics"};class Sl{init(){const t=lr({name:"mesh",bits:[ki,e2,hr]});this._shader=new Ot({glProgram:t,resources:{uTexture:w.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new D}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(i){if(!i.glProgram)return}else{i=this._shader;const n=e.texture,o=n.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=s.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Sl.extension={type:[y.WebGLPipesAdaptor],name:"mesh"};class El{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}El.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"};function Tn(r,t){const e=r.instructionSet,s=e.instructions;for(let i=0;i<e.instructionSize;i++){const n=s[i];t[n.renderPipeId].execute(n)}}const $C=new D;class wl{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(ut.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){var s;const i=(s=t._batchableRenderGroup)!=null?s:t._batchableRenderGroup=ut.get(us);i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;const e=$C.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Tn(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Tn(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}wl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"};function An(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}const XC=new mt,sx=sr|Jr|ui;function Cl(r,t=!1){ix(r);const e=r.childrenToUpdate,s=r.updateTick++;for(const i in e){const n=Number(i),o=e[i],a=o.list,u=o.index;for(let l=0;l<u;l++){const c=a[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Rl(c,s,0)}An(a,u),o.index=0}if(t)for(let i=0;i<r.renderGroupChildren.length;i++)Cl(r.renderGroupChildren[i],t)}function ix(r){const t=r.root;let e;if(r.renderGroupParent){const s=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,s.worldTransform),r.worldColor=Qr(t.groupColor,s.worldColor),e=t.groupAlpha*s.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Rl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const s=r.localTransform;r.updateLocalTransform();const i=r.parent;if(i&&!i.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(s,i.relativeGroupTransform),e&sx&&nx(r,i,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(s),e&sx&&nx(r,XC,e)),!r.renderGroup){const n=r.children,o=n.length;for(let l=0;l<o;l++)Rl(n[l],t,e);const a=r.parentRenderGroup,u=r;u.renderPipeId&&!a.structureDidChange&&a.updateRenderable(u)}}function nx(r,t,e){if(e&Jr){r.groupColor=Qr(r.localColor,t.groupColor);let s=r.localAlpha*t.groupAlpha;s=s<0?0:s>1?1:s,r.groupAlpha=s,r.groupColorAlpha=r.groupColor+((s*255|0)<<24)}e&ui&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&sr&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function ox(r,t){const{list:e,index:s}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<s;n++){const o=e[n];if(i=t[o.renderPipeId].validateRenderable(o),i)break}return r.structureDidChange=i,i}const HC=new D;class Pl{constructor(t){this._renderer=t}render({container:t,transform:e}){const s=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer;let o=HC;e&&(o=o.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const a=n.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Tn(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(o),t.parent=s,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){var s;if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){const i=t.root.getLocalBounds();i.ceil();const n=t.texture;t.texture&&et.returnTexture(t.texture);const o=this._renderer,a=t.textureOptions.resolution||o.view.resolution,u=(s=t.textureOptions.antialias)!=null?s:o.view.antialias;t.texture=et.getOptimalTexture(i.width,i.height,a,u),t._textureBounds||(t._textureBounds=new nt),t._textureBounds.copyFrom(i),n!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(et.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){const e=this._renderer,s=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=s,t.structureDidChange?An(t.childrenRenderablesToUpdate.list,0):ox(t,s),Cl(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let i=0;i<t.renderGroupChildren.length;i++)this._updateRenderGroups(t.renderGroupChildren[i])}_updateRenderables(t){const{list:e,index:s}=t.childrenRenderablesToUpdate;for(let i=0;i<s;i++){const n=e[i];n.didViewUpdate&&t.updateRenderable(n)}An(e,s)}_buildInstructions(t,e){const s=t.root,i=t.instructionSet;i.reset();const n=e.renderPipes?e:e.batch.renderer,o=n.renderPipes;o.batch.buildStart(i),o.blendMode.buildStart(),o.colorMask.buildStart(),s.sortableChildren&&s.sortChildren(),s.collectRenderablesWithEffects(i,n,null),o.batch.buildEnd(i),o.blendMode.buildEnd(i)}}Pl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"};class Dl{constructor(t){this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=new us;return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}}Dl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"};var zC=Object.defineProperty,ax=Object.getOwnPropertySymbols,jC=Object.prototype.hasOwnProperty,VC=Object.prototype.propertyIsEnumerable,ux=(r,t,e)=>t in r?zC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lx=(r,t)=>{for(var e in t||(t={}))jC.call(t,e)&&ux(r,e,t[e]);if(ax)for(var e of ax(t))VC.call(t,e)&&ux(r,e,t[e]);return r};const Ml=class My{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new X(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=lx(lx({},My.defaultOptions),t),this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ml.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0},Ml.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let cx=Ml;const Os={};I.handle(y.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Os[r.name]=r.ref},r=>{delete Os[r.name]});class Ol{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,s){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(s),this._isAdvanced=!!Os[e],this._isAdvanced&&(this._beginAdvancedBlendMode(s),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Os[e])return;let s=this._filterHash[e];s||(s=this._filterHash[e]=new Kr,s.filters=[new Os[e]]);const i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:s,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Ol.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"};var WC=Object.defineProperty,hx=Object.getOwnPropertySymbols,YC=Object.prototype.hasOwnProperty,qC=Object.prototype.propertyIsEnumerable,dx=(r,t,e)=>t in r?WC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bl=(r,t)=>{for(var e in t||(t={}))YC.call(t,e)&&dx(r,e,t[e]);if(hx)for(var e of hx(t))qC.call(t,e)&&dx(r,e,t[e]);return r};const Gl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Fl=class Oy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof mt||t instanceof w?Bl({target:t},e):Bl(Bl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Oy.defaultImageOptions);const{format:e,quality:s}=t,i=this.canvas(t);if(i.toBlob!==void 0)return new Promise((n,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=o,u.readAsDataURL(a)},Gl[e],s)});if(i.toDataURL!==void 0)return i.toDataURL(Gl[e],s);if(i.convertToBlob!==void 0){const n=await i.convertToBlob({type:Gl[e],quality:s});return new Promise((o,a)=>{const u=new FileReader;u.onload=()=>o(u.result),u.onerror=a,u.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer;if(e instanceof w)return s.texture.generateCanvas(e);const i=s.textureGenerator.generateTexture(t),n=s.texture.generateCanvas(i);return i.destroy(!0),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer,i=e instanceof w?e:s.textureGenerator.generateTexture(t),n=s.texture.getPixels(i);return e instanceof mt&&i.destroy(!0),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof w?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const s=this.canvas(t),i=document.createElement("a");i.download=(e=t.filename)!=null?e:"image.png",i.href=s.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){var e;const s=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);const o=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Fl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"},Fl.defaultImageOptions={format:"png",quality:1};let px=Fl;class Ln extends w{static create(t){return new Ln({source:new q(t)})}resize(t,e,s){return this.source.resize(t,e,s),this}}var KC=Object.defineProperty,ZC=Object.defineProperties,QC=Object.getOwnPropertyDescriptors,fx=Object.getOwnPropertySymbols,JC=Object.prototype.hasOwnProperty,tR=Object.prototype.propertyIsEnumerable,mx=(r,t,e)=>t in r?KC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,eR=(r,t)=>{for(var e in t||(t={}))JC.call(t,e)&&mx(r,e,t[e]);if(fx)for(var e of fx(t))tR.call(t,e)&&mx(r,e,t[e]);return r},rR=(r,t)=>ZC(r,QC(t));const sR=new z,iR=new nt,nR=[0,0,0,0];class Il{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof mt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const s=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:X.shared.setValue(o).toArray():o=nR;const a=((e=t.frame)==null?void 0:e.copyTo(sR))||oi(n,iR).rectangle;a.width=Math.max(a.width,1/s)|0,a.height=Math.max(a.height,1/s)|0;const u=Ln.create(rR(eR({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:s,antialias:i})),l=D.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:o}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Il.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"};class Ul{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:s,worldColor:i,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new D,worldColor:4294967295,offset:new it},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:s||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const c=l.uniforms;c.uProjectionMatrix=u.projectionMatrix,c.uResolution=u.resolution,c.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),c.uWorldTransformMatrix.tx-=u.offset.x,c.uWorldTransformMatrix.ty-=u.offset.y,fr(u.worldColor,c.uWorldColorAlpha,0),l.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Zt,this._activeBindGroups.push(h),h.setResource(l,0)),u.bindGroup=h,this._currentGlobalUniformData=u}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===vt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new rt({uProjectionMatrix:{value:new D,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new D,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Ul.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"};let oR=1;class kl{constructor(){this._tasks=[],this._offset=0}init(){dt.system.add(this._update,this)}repeat(t,e,s=!0){const i=oR++;let n=0;return s&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const s=this._tasks[e];if(t-s.offset-s.last>=s.duration){const i=t-s.start;s.func(i),s.last=t}}}destroy(){dt.system.remove(this._update,this),this._tasks.length=0}}kl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0};let gx=!1;function _x(r){if(!gx){if(L.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${As} (${r}) http://www.pixijs.com/
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${As} - ${r} - http://www.pixijs.com/`);gx=!0}}class Sn{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===vt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),_x(e)}}}Sn.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"hello",priority:-2},Sn.defaultOptions={hello:!1};function xx(r){let t=!1;for(const s in r)if(r[s]==null){t=!0;break}if(!t)return r;const e=Object.create(null);for(const s in r){const i=r[s];i&&(e[s]=i)}return e}function bx(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var aR=Object.defineProperty,yx=Object.getOwnPropertySymbols,uR=Object.prototype.hasOwnProperty,lR=Object.prototype.propertyIsEnumerable,vx=(r,t,e)=>t in r?aR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Tx=(r,t)=>{for(var e in t||(t={}))uR.call(t,e)&&vx(r,e,t[e]);if(yx)for(var e of yx(t))lR.call(t,e)&&vx(r,e,t[e]);return r};let cR=0;const Ll=class By{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t=Tx(Tx({},By.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(const e of this._managedHashes)e.context[e.hash]=xx(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(const e of this._managedArrays)bx(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=cR++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){var t,e,s,i;const n=this._now,o=this._managedRenderables,a=this._renderer.renderPipes;let u=0;for(let l=0;l<o.length;l++){const c=o[l];if(c===null){u++;continue}const h=(t=c.renderGroup)!=null?t:c.parentRenderGroup,d=(s=(e=h==null?void 0:h.instructionSet)==null?void 0:e.gcTick)!=null?s:-1;if(((i=h==null?void 0:h.gcTick)!=null?i:0)===d&&(c._lastUsed=n),n-c._lastUsed>this.maxUnusedTime){if(!c.destroyed){const p=a;h&&(h.structureDidChange=!0),p[c.renderPipeId].destroyRenderable(c)}c._lastUsed=-1,u++,c.off("destroyed",this._removeRenderable,this)}else o[l-u]=c}o.length-=u}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){const e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(const s of t.renderGroupChildren)this._updateInstructionGCTick(s,e)}};Ll.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"renderableGC",priority:0},Ll.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let Ax=Ll;var hR=Object.defineProperty,Sx=Object.getOwnPropertySymbols,dR=Object.prototype.hasOwnProperty,pR=Object.prototype.propertyIsEnumerable,Ex=(r,t,e)=>t in r?hR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wx=(r,t)=>{for(var e in t||(t={}))dR.call(t,e)&&Ex(r,e,t[e]);if(Sx)for(var e of Sx(t))pR.call(t,e)&&Ex(r,e,t[e]);return r};const Nl=class Gy{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=wx(wx({},Gy.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e:t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const s=t[e];s.autoGarbageCollect&&s.resource&&s._touched>-1&&this.count-s._touched>this.maxIdle&&(s._touched=-1,s.unload())}}destroy(){this._renderer=null}};Nl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGC"},Nl.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};let Cx=Nl;var fR=Object.defineProperty,Rx=Object.getOwnPropertySymbols,mR=Object.prototype.hasOwnProperty,gR=Object.prototype.propertyIsEnumerable,Px=(r,t,e)=>t in r?fR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dx=(r,t)=>{for(var e in t||(t={}))mR.call(t,e)&&Px(r,e,t[e]);if(Rx)for(var e of Rx(t))gR.call(t,e)&&Px(r,e,t[e]);return r};const $l=class Fy{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=Dx(Dx({},Fy.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new z(0,0,t.width,t.height),this.canvas=t.canvas||L.get().createCanvas(),this.antialias=!!t.antialias,this.texture=cl(this.canvas,t),this.renderTarget=new _n({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,s){this.texture.source.resize(t,e,s),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};$l.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"view",priority:0},$l.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let Mx=$l;const Xl=[cx,Ul,Sn,Mx,Pl,Cx,Il,px,cu,Ax,kl],Hl=[Ol,ju,Dl,wl,Vu,Yu,Wu,El],_R=[...Xl,ll,p2,o2,sl,qu,Tl,dl,Ju,xl,_l,rl,j2,il,el],xR=[...Hl],bR=[Xu,Sl,Al],Ox=[],Bx=[],Gx=[];I.handleByNamedList(y.WebGLSystem,Ox),I.handleByNamedList(y.WebGLPipes,Bx),I.handleByNamedList(y.WebGLPipesAdaptor,Gx),I.add(..._R,...xR,...bR);class Fx extends bs{constructor(){const t={name:"webgl",type:vt.WEBGL,systems:Ox,renderPipes:Bx,renderPipeAdaptors:Gx};super(t)}}var yR={__proto__:null,WebGLRenderer:Fx};class zl{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,s){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,s)}_createBindGroup(t,e,s){var i;const n=this._gpu.device,o=e.layout[s],a=[],u=this._renderer;for(const h in o){const d=(i=t.resources[h])!=null?i:t.resources[o[h]];let p;if(d._resourceType==="uniformGroup"){const f=d;u.ubo.updateUniformGroup(f);const g=f.buffer;p={buffer:u.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(d._resourceType==="buffer"){const f=d;p={buffer:u.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(d._resourceType==="bufferResource"){const f=d;p={buffer:u.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(d._resourceType==="textureSampler"){const f=d;p=u.texture.getGpuSampler(f)}else if(d._resourceType==="textureSource"){const f=d;p=u.texture.getGpuSource(f).createView({})}a.push({binding:o[h],resource:p})}const l=u.shader.getProgramData(e).bindGroups[s],c=n.createBindGroup({layout:l,entries:a});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}zl.extension={type:[y.WebGPUSystem],name:"bindGroup"};class jl{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),s=t.data;return t._updateID&&s&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,s.buffer,0,(t._updateSize||s.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(fi(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}jl.extension={type:[y.WebGPUSystem],name:"buffer"};class Ix{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let s=e+t*4;if(s=Math.ceil(s/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,s>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=s,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let s=0;s<t.length;s++)this.data[e/4+s]=t[s];return e}destroy(){this.data=null}}class Vl{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}Vl.extension={type:[y.WebGPUSystem],name:"colorMask"};class En{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await L.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),s=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:s});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}}En.extension={type:[y.WebGPUSystem],name:"device"},En.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var vR=Object.defineProperty,Ux=Object.getOwnPropertySymbols,TR=Object.prototype.hasOwnProperty,AR=Object.prototype.propertyIsEnumerable,kx=(r,t,e)=>t in r?vR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lx=(r,t)=>{for(var e in t||(t={}))TR.call(t,e)&&kx(r,e,t[e]);if(Ux)for(var e of Ux(t))AR.call(t,e)&&kx(r,e,t[e]);return r};class Wl{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,s,i){const n=this._renderer.pipeline.getPipeline(t,e,s,i);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,s){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const i=this._renderer.bindGroup.getBindGroup(e,s,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){const s=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const i in s)this._setVertexBuffer(i,t.attributes[s[i]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const s in t.groups){const i=t.groups[s];e||this._syncBindGroup(i),this.setBindGroup(s,i,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const s=t.resources[e];s.isUniformGroup&&this._renderer.ubo.updateUniformGroup(s)}}draw(t){const{geometry:e,shader:s,state:i,topology:n,size:o,start:a,instanceCount:u,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,s.gpuProgram,i,n),this.setGeometry(e,s.gpuProgram),this._setShaderBindGroups(s,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,u!=null?u:e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),u!=null?u:e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,s=Lx({},this._boundVertexBuffer),i=this._boundIndexBuffer,n=Lx({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in s)this._setVertexBuffer(a,s[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}Wl.extension={type:[y.WebGPUSystem],name:"encoder",priority:1};class Yl{constructor(t){this._renderer=t}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}Yl.extension={type:[y.WebGPUSystem],name:"limits"};class ql{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Q.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const s=this._renderTargetStencilState[this._activeRenderTarget.uid];s.stencilMode=t,s.stencilReference=e;const i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}ql.extension={type:[y.WebGPUSystem],name:"stencil"};const Bs={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Nx(r){const t=r.map(s=>({data:s,offset:0,size:0}));let e=0;for(let s=0;s<t.length;s++){const i=t[s];let n=Bs[i.data.type].size;const o=Bs[i.data.type].align;if(!Bs[i.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${i.data.type}`);i.data.size>1&&(n=Math.max(n,o)*i.data.size),e=Math.ceil(e/o)*o,i.size=n,i.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function $x(r,t){const{size:e,align:s}=Bs[r.data.type],i=(s-e)/4,n=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
v = uv.${r.data.name};
${t!==0?`offset += ${t};`:""}
arrayOffset = offset;
t = 0;
for(var i=0; i < ${r.data.size*(e/4)}; i++)
{
for(var j = 0; j < ${e/4}; j++)
{
${n}[arrayOffset++] = v[t++];
}
${i!==0?`arrayOffset += ${i};`:""}
}
`}function Xx(r){return al(r,"uboWgsl",$x,x2)}class Kl extends nl{constructor(){super({createUboElements:Nx,generateUboSync:Xx})}}Kl.extension={type:[y.WebGPUSystem],name:"ubo"};const Ae=128;class Zl{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new Ix({minUniformOffsetAlignment:Ae});const e=256/Ae;for(let s=0;s<e;s++){let i=$.UNIFORM|$.COPY_DST;s===0&&(i|=$.COPY_SRC),this._buffers.push(new yt({data:this._batchBuffer.data,usage:i}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(const t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);const s=t.buffer.data,i=this._batchBuffer.addEmptyGroup(s.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,i/4),this._bindGroupHash[t.uid]=this._getBindGroup(i/Ae),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);const e=t.buffer.data,s=this._batchBuffer.addGroup(e);return this._getBufferResource(s/Ae)}getArrayBindGroup(t){const e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ae)}getArrayBufferResource(t){const e=this._batchBuffer.addGroup(t)/Ae;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){const e=this._buffers[t%2];this._bufferResources[t]=new xn({buffer:e,offset:(t/2|0)*256,size:Ae})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){const e=new Zt({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){const t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);const s=this._renderer.gpu.device.createCommandEncoder();for(let i=1;i<this._buffers.length;i++){const n=this._buffers[i];s.copyBufferToBuffer(t.getGPUBuffer(e),Ae,t.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([s.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}}Zl.extension={type:[y.WebGPUPipes],name:"uniformBatch"};var SR=Object.defineProperty,ER=Object.defineProperties,wR=Object.getOwnPropertyDescriptors,Hx=Object.getOwnPropertySymbols,CR=Object.prototype.hasOwnProperty,RR=Object.prototype.propertyIsEnumerable,zx=(r,t,e)=>t in r?SR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,PR=(r,t)=>{for(var e in t||(t={}))CR.call(t,e)&&zx(r,e,t[e]);if(Hx)for(var e of Hx(t))RR.call(t,e)&&zx(r,e,t[e]);return r},DR=(r,t)=>ER(r,wR(t));const MR={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function OR(r,t,e,s,i){return r<<24|t<<16|e<<10|s<<5|i}function BR(r,t,e,s){return e<<6|r<<3|s<<1|t}class Ql{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Q.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=de[t],this._updatePipeHash())}setPipeline(t,e,s,i){const n=this.getPipeline(t,e,s);i.setPipeline(n)}getPipeline(t,e,s,i){t._layoutKey||(Zu(t,e.attributeData),this._generateBufferKey(t)),i||(i=t.topology);const n=OR(t._layoutKey,e._layoutKey,s.data,s._blendModeId,MR[i]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,s,i),this._pipeCache[n])}_createPipeline(t,e,s,i){const n=this._gpu.device,o=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(s);a[0].writeMask=this._stencilMode===Q.RENDERING_MASK_ADD?0:this._colorMask;const u=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:o},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:i,cullMode:s.cullMode},layout:u,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil=DR(PR({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:s.depthTest,depthCompare:s.depthTest?"less":"always"})),n.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){const e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){const e=[];let s=0;const i=Object.keys(t.attributes).sort();for(let o=0;o<i.length;o++){const a=t.attributes[i[o]];e[s++]=a.offset,e[s++]=a.format,e[s++]=a.stride,e[s++]=a.instance}const n=e.join("|");return t._layoutKey=or(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){const e=[];let s=0;const i=Object.keys(t.attributeData).sort();for(let o=0;o<i.length;o++){const a=t.attributeData[i[o]];e[s++]=a.location}const n=e.join("|");return t._attributeLocationsKey=or(n,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){const s=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[s])return this._bindingNamesCache[s];const i=this._createVertexBufferLayouts(t,e),n=Object.create(null),o=e.attributeData;for(let a=0;a<i.length;a++){const u=Object.values(i[a].attributes)[0].shaderLocation;for(const l in o)if(o[l].location===u){n[a]=l;break}}return this._bindingNamesCache[s]=n,n}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);const s=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[s])return this._bufferLayoutsCache[s];const i=[];return t.buffers.forEach(n=>{var o;const a={arrayStride:0,stepMode:"vertex",attributes:[]},u=a.attributes;for(const l in e.attributeData){const c=t.attributes[l];((o=c.divisor)!=null?o:1)!==1&&Ut(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(a.arrayStride=c.stride,a.stepMode=c.instance?"instance":"vertex",u.push({shaderLocation:e.attributeData[l].location,offset:c.offset,format:c.format}))}u.length&&i.push(a)}),this._bufferLayoutsCache[s]=i,i}_updatePipeHash(){const t=BR(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}Ql.extension={type:[y.WebGPUSystem],name:"pipeline"};class jx{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class Vx{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,s,i,n){const o=this._renderer,a=this._getGpuColorTexture(t),u=o.texture.getGpuSource(e.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:s},{texture:u,origin:n},i),e}startRenderPass(t,e=!0,s,i){const n=this._renderTargetSystem.getGpuRenderTarget(t),o=this.getDescriptor(t,e,s);n.descriptor=o,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(i)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,s){typeof e=="boolean"&&(e=e?Tt.ALL:Tt.NONE);const i=this._renderTargetSystem,n=i.getGpuRenderTarget(t),o=t.colorTextures.map((u,l)=>{const c=n.contexts[l];let h,d;c?h=c.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(u).createView({mipLevelCount:1}),n.msaaTextures[l]&&(d=h,h=this._renderer.texture.getTextureView(n.msaaTextures[l]));const p=e&Tt.COLOR?"clear":"load";return s!=null||(s=i.defaultClearColor),{view:h,resolveTarget:d,clearValue:s,storeOp:"store",loadOp:p}});let a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){const u=e&Tt.STENCIL?"clear":"load",l=e&Tt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:u,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:o,depthStencilAttachment:a}}clear(t,e=!0,s,i){if(!e)return;const{gpu:n,encoder:o}=this._renderer,a=n.device;if(o.commandEncoder===null){const u=a.createCommandEncoder(),l=this.getDescriptor(t,e,s),c=u.beginRenderPass(l);c.setViewport(i.x,i.y,i.width,i.height,0,1),c.end();const h=u.finish();a.queue.submit([h])}else this.startRenderPass(t,e,s,i)}initGpuRenderTarget(t){t.isRoot=!0;const e=new jx;return t.colorTextures.forEach((s,i)=>{if(s instanceof Kt){const n=s.resource.getContext("webgpu"),o=s.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:o})}catch(a){console.error(a)}e.contexts[i]=n}if(e.msaa=s.source.antialias,s.source.antialias){const n=new q({width:0,height:0,sampleCount:4});e.msaaTextures[i]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((s,i)=>{const n=e.msaaTextures[i];n==null||n.resize(s.source.width,s.source.height,s.source._resolution)})}}class Jl extends hl{constructor(t){super(t),this.adaptor=new Vx,this.adaptor.init(t,this)}}Jl.extension={type:[y.WebGPUSystem],name:"renderTarget"};class tc{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,s=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),i={bindGroupLayouts:s};return this._gpuProgramData[t._layoutKey]={bindGroups:s,pipeline:e.createPipelineLayout(i)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}tc.extension={type:[y.WebGPUSystem],name:"shader"};const ft={};ft.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},ft.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},ft.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},ft.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ft.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ft.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},ft["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},ft["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},ft["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},ft.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},ft.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},ft.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class ec{constructor(){this.defaultState=new Pt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:ft[t.blendMode]||ft.normal}]}destroy(){this.gpu=null}}ec.extension={type:[y.WebGPUSystem],name:"state"};const Wx={type:"image",upload(r,t,e){const s=r.resource,i=(r.pixelWidth|0)*(r.pixelHeight|0),n=s.byteLength/i;e.device.queue.writeTexture({texture:t},s,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*n},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},rc={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},GR={blockBytes:4,blockWidth:1,blockHeight:1},Yx={type:"compressed",upload(r,t,e){let s=r.pixelWidth,i=r.pixelHeight;const n=rc[r.format]||GR;for(let o=0;o<r.resource.length;o++){const a=r.resource[o],u=Math.ceil(s/n.blockWidth)*n.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:o},a,{offset:0,bytesPerRow:u},{width:Math.ceil(s/n.blockWidth)*n.blockWidth,height:Math.ceil(i/n.blockHeight)*n.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},sc={type:"image",upload(r,t,e){const s=r.resource;if(!s)return;if(globalThis.HTMLImageElement&&s instanceof HTMLImageElement){const a=L.get().createCanvas(s.width,s.height);a.getContext("2d").drawImage(s,0,0,s.width,s.height),r.resource=a}const i=Math.min(t.width,r.resourceWidth||r.pixelWidth),n=Math.min(t.height,r.resourceHeight||r.pixelHeight),o=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:s},{texture:t,premultipliedAlpha:o},{width:i,height:n})}},qx={type:"video",upload(r,t,e){sc.upload(r,t,e)}};class Kx{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
struct VertexOutput {
@builtin(position) position : vec4<f32>,
@location(0) texCoord : vec2<f32>,
};
@vertex
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
var output : VertexOutput;
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
return output;
}
@group(0) @binding(0) var imgSampler : sampler;
@group(0) @binding(1) var img : texture_2d<f32>;
@fragment
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
return textureSample(img, imgSampler, texCoord);
}
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){const e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let s=t;const i=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){const u={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};s=this.device.createTexture(u)}const o=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let u=0;u<i;++u){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),c=n?1:0;for(let h=1;h<t.mipLevelCount;++h){const d=s.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),p=o.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),f=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});p.setPipeline(e),p.setBindGroup(0,f),p.draw(3,1,0,0),p.end(),l=d}}if(!n){const u={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i};for(let l=1;l<t.mipLevelCount;++l)o.copyTextureToTexture({texture:s,mipLevel:l-1},{texture:t,mipLevel:l},u),u.width=Math.ceil(u.width/2),u.height=Math.ceil(u.height/2)}return this.device.queue.submit([o.finish()]),n||s.destroy(),t}}class ic{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:sc,buffer:Wx,video:qx,compressed:Yx},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){const u=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(u))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);const s=rc[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(t.pixelWidth/s.blockWidth)*s.blockWidth,n=Math.ceil(t.pixelHeight/s.blockHeight)*s.blockHeight,o={label:t.label,size:{width:i,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(o);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){const e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){const e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Kx(this._gpu.device));const e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){const e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){var e;return(e=this._bindGroupHash[t.uid])!=null?e:this._createTextureBindGroup(t)}_createTextureBindGroup(t){const e=t.source;return this._bindGroupHash[t.uid]=new Zt({0:e,1:e.style,2:new rt({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e;const s=t.source;return(e=this._textureViewHash[s.uid])!=null?e:this._createTextureView(s)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){const e=this._renderer,s=e.gpu.device.createCommandEncoder(),i=L.get().createCanvas();i.width=t.source.pixelWidth,i.height=t.source.pixelHeight;const n=i.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:L.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),s.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:i.width,height:i.height}),e.gpu.device.queue.submit([s.finish()]),i}getPixels(t){const e=this.generateCanvas(t),s=le.getOptimalCanvasAndContext(e.width,e.height),i=s.context;i.drawImage(e,0,0);const{width:n,height:o}=e,a=i.getImageData(0,0,n,o),u=new Uint8ClampedArray(a.data.buffer);return le.returnCanvasAndContext(s),{pixels:u,width:n,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),s=this._bindGroupHash[e];s==null||s.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}ic.extension={type:[y.WebGPUSystem],name:"texture"};class nc{constructor(){this._maxTextures=0}contextChange(t){const e=new rt({uTransformMatrix:{value:new D,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=t.limits.maxBatchableTextures;const s=ur({name:"graphics",bits:[_i,bi(this._maxTextures),ag,cr]});this.shader=new Ot({gpuProgram:s,resources:{localUniforms:e}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:u}=o.getContextRenderData(s),l=n.encoder;l.setGeometry(a.geometry,i.gpuProgram);const c=n.globalUniforms.bindGroup;l.setBindGroup(0,c,i.gpuProgram);const h=n.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);l.setBindGroup(2,h,i.gpuProgram);const d=u.instructions;let p=null;for(let f=0;f<u.instructionSize;f++){const g=d[f];if(g.topology!==p&&(p=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,i.gpuProgram,t.state,g.topology)),i.groups[1]=g.bindGroup,!g.gpuBindGroup){const m=g.textures;g.bindGroup=pi(m.textures,m.count,this._maxTextures),g.gpuBindGroup=n.bindGroup.getBindGroup(g.bindGroup,i.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,i.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}nc.extension={type:[y.WebGPUPipesAdaptor],name:"graphics"};class oc{init(){const t=ur({name:"mesh",bits:[xr,t2,cr]});this._shader=new Ot({gpuProgram:t,resources:{uTexture:w.EMPTY._source,uSampler:w.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new D}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(!i)i=this._shader,i.groups[2]=s.texture.getTextureBindGroup(e.texture);else if(!i.gpuProgram)return;const n=i.gpuProgram;if(n.autoAssignGlobalUniforms&&(i.groups[0]=s.globalUniforms.bindGroup),n.autoAssignLocalUniforms){const o=t.localUniforms;i.groups[1]=s.renderPipes.uniformBatch.getUniformBindGroup(o,!0)}s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}oc.extension={type:[y.WebGPUPipesAdaptor],name:"mesh"};const FR=[...Xl,Kl,Wl,En,Yl,jl,ic,Jl,tc,ec,Ql,Vl,ql,zl],IR=[...Hl,Zl],UR=[Hu,oc,nc],Zx=[],Qx=[],Jx=[];I.handleByNamedList(y.WebGPUSystem,Zx),I.handleByNamedList(y.WebGPUPipes,Qx),I.handleByNamedList(y.WebGPUPipesAdaptor,Jx),I.add(...FR,...IR,...UR);class tb extends bs{constructor(){const t={name:"webgpu",type:vt.WEBGPU,systems:Zx,renderPipes:Qx,renderPipeAdaptors:Jx};super(t)}}var kR={__proto__:null,WebGPURenderer:tb};const LR={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},NR=new Proxy(LR,{get(r,t){return r[t]}});var ac=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))(ac||{});const $R=new Proxy(ac,{get(r,t){return r[t]}});var uc=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))(uc||{});const XR=new Proxy(uc,{get(r,t){return r[t]}});class HR{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,n=e.height;if(s){const o=t.width/2/i,a=t.height/2/n,u=t.x/i+o,l=t.y/n+a;s=N.add(s,N.NW),this.x0=u+o*N.uX(s),this.y0=l+a*N.uY(s),s=N.add(s,2),this.x1=u+o*N.uX(s),this.y1=l+a*N.uY(s),s=N.add(s,2),this.x2=u+o*N.uX(s),this.y2=l+a*N.uY(s),s=N.add(s,2),this.x3=u+o*N.uX(s),this.y3=l+a*N.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}function zR(r){const t=r.toString(),e=t.indexOf("{"),s=t.lastIndexOf("}");if(e===-1||s===-1)throw new Error("getFunctionBody: No body found in function definition");return t.slice(e+1,s).trim()}function jR(r,t){return r.getFastGlobalBounds(!0,t)}var VR=Object.defineProperty,wn=Object.getOwnPropertySymbols,eb=Object.prototype.hasOwnProperty,rb=Object.prototype.propertyIsEnumerable,sb=(r,t,e)=>t in r?VR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,WR=(r,t)=>{for(var e in t||(t={}))eb.call(t,e)&&sb(r,e,t[e]);if(wn)for(var e of wn(t))rb.call(t,e)&&sb(r,e,t[e]);return r},YR=(r,t)=>{var e={};for(var s in r)eb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&wn)for(var s of wn(r))t.indexOf(s)<0&&rb.call(r,s)&&(e[s]=r[s]);return e};class qR extends ae{constructor(t){var e,s;typeof t=="function"&&(t={render:t});const i=t,{render:n}=i,o=YR(i,["render"]);super(WR({label:"RenderContainer"},o)),this.renderPipeId="customRender",this.batched=!1,n&&(this.render=n),this.containsPoint=(e=t.containsPoint)!=null?e:()=>!1,this.addBounds=(s=t.addBounds)!=null?s:()=>!1}updateBounds(){this._bounds.clear(),this.addBounds(this._bounds)}render(t){}}function KR(r,t,e){const s=e.renderPipes?e:e.batch.renderer;return r.collectRenderables(t,s,null)}function ZR(r,t){const e=t._scale,s=t._pivot,i=t._position,n=e._x,o=e._y,a=s._x,u=s._y;r.a=t._cx*n,r.b=t._sx*n,r.c=t._cy*o,r.d=t._sy*o,r.tx=i._x-(a*r.a+u*r.c),r.ty=i._y-(a*r.b+u*r.d)}function QR(r,t,e){const s=r.a,i=r.b,n=r.c,o=r.d,a=r.tx,u=r.ty,l=t.a,c=t.b,h=t.c,d=t.d;e.a=s*l+i*h,e.b=s*c+i*d,e.c=n*l+o*h,e.d=n*c+o*d,e.tx=a*l+u*h+t.tx,e.ty=a*c+u*d+t.ty}var JR=Object.defineProperty,ib=Object.getOwnPropertySymbols,tP=Object.prototype.hasOwnProperty,eP=Object.prototype.propertyIsEnumerable,nb=(r,t,e)=>t in r?JR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ob=(r,t)=>{for(var e in t||(t={}))tP.call(t,e)&&nb(r,e,t[e]);if(ib)for(var e of ib(t))eP.call(t,e)&&nb(r,e,t[e]);return r};const ab=class Iy extends mt{constructor(t={}){t=ob(ob({},Iy.defaultOptions),t),super(),this.renderLayerChildren=[],this.sortableChildren=t.sortableChildren,this.sortFunction=t.sortFunction}attach(...t){for(let e=0;e<t.length;e++){const s=t[e];if(s.parentRenderLayer){if(s.parentRenderLayer===this)continue;s.parentRenderLayer.detach(s)}this.renderLayerChildren.push(s),s.parentRenderLayer=this;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)}return t[0]}detach(...t){for(let e=0;e<t.length;e++){const s=t[e],i=this.renderLayerChildren.indexOf(s);i!==-1&&this.renderLayerChildren.splice(i,1),s.parentRenderLayer=null;const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0)}return t[0]}detachAll(){const t=this.renderLayerChildren;for(let e=0;e<t.length;e++)t[e].parentRenderLayer=null;this.renderLayerChildren.length=0}collectRenderables(t,e,s){const i=this.renderLayerChildren,n=i.length;this.sortableChildren&&this.sortRenderLayerChildren();for(let o=0;o<n;o++)i[o].parent||Ut("Container must be added to both layer and scene graph. Layers only handle render order - the scene graph is required for transforms (addChild)",i[o]),i[o].collectRenderables(t,e,this)}sortRenderLayerChildren(){this.renderLayerChildren.sort(this.sortFunction)}_getGlobalBoundsRecursive(t,e,s){if(!t)return;const i=this.renderLayerChildren;for(let n=0;n<i.length;n++)i[n]._getGlobalBoundsRecursive(!0,e,this)}};ab.defaultOptions={sortableChildren:!1,sortFunction:(r,t)=>r.zIndex-t.zIndex};let rP=ab;const sP=rP;function ub(r,t,e,s){const i=e.buffers[0],n=i.data,{verticesX:o,verticesY:a}=e,u=r/(o-1),l=t/(a-1);let c=0;const h=s[0],d=s[1],p=s[2],f=s[3],g=s[4],m=s[5],_=s[6],b=s[7],x=s[8];for(let v=0;v<n.length;v+=2){const A=c%o*u,T=(c/o|0)*l,S=h*A+d*T+p,B=f*A+g*T+m,P=_*A+b*T+x;n[v]=S/P,n[v+1]=B/P,c++}i.update()}function lb(r,t){const e=t[0],s=t[1],i=t[2],n=t[3],o=t[4],a=t[5],u=t[6],l=t[7],c=t[8];return r[0]=o*c-a*l,r[1]=i*l-s*c,r[2]=s*a-i*o,r[3]=a*u-n*c,r[4]=e*c-i*u,r[5]=i*n-e*a,r[6]=n*l-o*u,r[7]=s*u-e*l,r[8]=e*o-s*n,r}function cb(r,t,e){const s=t[0],i=t[1],n=t[2],o=t[3],a=t[4],u=t[5],l=t[6],c=t[7],h=t[8],d=e[0],p=e[1],f=e[2],g=e[3],m=e[4],_=e[5],b=e[6],x=e[7],v=e[8];return r[0]=d*s+p*o+f*l,r[1]=d*i+p*a+f*c,r[2]=d*n+p*u+f*h,r[3]=g*s+m*o+_*l,r[4]=g*i+m*a+_*c,r[5]=g*n+m*u+_*h,r[6]=b*s+x*o+v*l,r[7]=b*i+x*a+v*c,r[8]=b*n+x*u+v*h,r}function iP(r,t,e){const s=e[0],i=e[1],n=e[2];return r[0]=t[0]*s+t[1]*i+t[2]*n,r[1]=t[3]*s+t[4]*i+t[5]*n,r[2]=t[6]*s+t[7]*i+t[8]*n,r}const nP=[0,0,0,0,0,0,0,0,0],oP=[0,0,0],Cn=[0,0,0];function hb(r,t,e,s,i,n,o,a,u){const l=nP;l[0]=t,l[1]=s,l[2]=n,l[3]=e,l[4]=i,l[5]=o,l[6]=1,l[7]=1,l[8]=1;const c=lb(r,l);Cn[0]=a,Cn[1]=u,Cn[2]=1;const h=iP(oP,c,Cn),d=r;return r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=h[1],r[5]=0,r[6]=0,r[7]=0,r[8]=h[2],cb(r,d,l)}const aP=[0,0,0,0,0,0,0,0,0],uP=[0,0,0,0,0,0,0,0,0];function db(r,t,e,s,i,n,o,a,u,l,c,h,d,p,f,g,m){const _=hb(aP,t,e,n,o,l,c,p,f),b=hb(uP,s,i,a,u,h,d,g,m);return cb(r,lb(_,_),b)}class pb extends Ni{constructor(t){super(t),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:e,height:s}=t;this.corners=[0,0,e,0,e,s,0,s]}setCorners(t,e,s,i,n,o,a,u){const l=this.corners;l[0]=t,l[1]=e,l[2]=s,l[3]=i,l[4]=n,l[5]=o,l[6]=a,l[7]=u,this.updateProjection()}updateProjection(){const{width:t,height:e}=this,s=this.corners,i=db(this._projectionMatrix,0,0,s[0],s[1],t,0,s[2],s[3],t,e,s[4],s[5],0,e,s[6],s[7]);ub(t,e,this,i)}}var lP=Object.defineProperty,cP=Object.defineProperties,hP=Object.getOwnPropertyDescriptors,Rn=Object.getOwnPropertySymbols,fb=Object.prototype.hasOwnProperty,mb=Object.prototype.propertyIsEnumerable,gb=(r,t,e)=>t in r?lP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lc=(r,t)=>{for(var e in t||(t={}))fb.call(t,e)&&gb(r,e,t[e]);if(Rn)for(var e of Rn(t))mb.call(t,e)&&gb(r,e,t[e]);return r},dP=(r,t)=>cP(r,hP(t)),pP=(r,t)=>{var e={};for(var s in r)fb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Rn)for(var s of Rn(r))t.indexOf(s)<0&&mb.call(r,s)&&(e[s]=r[s]);return e};const _b=class Uy extends Ar{constructor(t){t=lc(lc({},Uy.defaultOptions),t);const e=t,{texture:s,verticesX:i,verticesY:n}=e,o=pP(e,["texture","verticesX","verticesY"]),a=new pb(Xt({width:s.width,height:s.height,verticesX:i,verticesY:n}));super(Xt(dP(lc({},o),{geometry:a}))),this._texture=s,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:s}=this.texture;(t.width!==e||t.height!==s)&&(t.width=e,t.height=s,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,s,i,n,o,a,u){this.geometry.setCorners(t,e,s,i,n,o,a,u)}};_b.defaultOptions={texture:w.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let fP=_b;var mP=Object.defineProperty,gP=Object.defineProperties,_P=Object.getOwnPropertyDescriptors,Pn=Object.getOwnPropertySymbols,xb=Object.prototype.hasOwnProperty,bb=Object.prototype.propertyIsEnumerable,yb=(r,t,e)=>t in r?mP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xP=(r,t)=>{for(var e in t||(t={}))xb.call(t,e)&&yb(r,e,t[e]);if(Pn)for(var e of Pn(t))bb.call(t,e)&&yb(r,e,t[e]);return r},bP=(r,t)=>gP(r,_P(t)),yP=(r,t)=>{var e={};for(var s in r)xb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Pn)for(var s of Pn(r))t.indexOf(s)<0&&bb.call(r,s)&&(e[s]=r[s]);return e};class vP extends Ar{constructor(t){const e=t,{texture:s,verticesX:i,verticesY:n}=e,o=yP(e,["texture","verticesX","verticesY"]),a=new Ni(Xt({width:s.width,height:s.height,verticesX:i,verticesY:n}));super(Xt(bP(xP({},o),{geometry:a,texture:s}))),this.texture=s,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:s}=this.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=e,t.height=s,t.build({}))}set texture(t){var e;(e=this._texture)==null||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var TP=Object.defineProperty,vb=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,SP=Object.prototype.propertyIsEnumerable,Tb=(r,t,e)=>t in r?TP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ab=(r,t)=>{for(var e in t||(t={}))AP.call(t,e)&&Tb(r,e,t[e]);if(vb)for(var e of vb(t))SP.call(t,e)&&Tb(r,e,t[e]);return r};const Sb=class ky extends $e{constructor(t){const{width:e,points:s,textureScale:i}=Ab(Ab({},ky.defaultOptions),t);super({positions:new Float32Array(s.length*4),uvs:new Float32Array(s.length*4),indices:new Uint32Array((s.length-1)*6)}),this.points=s,this._width=e,this.textureScale=i,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),s=this.getBuffer("aUV"),i=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),s.data=new Float32Array(t.length*4),i.data=new Uint16Array((t.length-1)*6));const n=s.data,o=i.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,u=t[0];const l=this._width*this.textureScale,c=t.length;for(let d=0;d<c;d++){const p=d*4;if(this.textureScale>0){const f=u.x-t[d].x,g=u.y-t[d].y,m=Math.sqrt(f*f+g*g);u=t[d],a+=m/l}else a=d/(c-1);n[p]=a,n[p+1]=0,n[p+2]=a,n[p+3]=1}let h=0;for(let d=0;d<c-1;d++){const p=d*2;o[h++]=p,o[h++]=p+1,o[h++]=p+2,o[h++]=p+2,o[h++]=p+1,o[h++]=p+3}s.update(),i.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],s,i=0,n=0;const o=this.buffers[0].data,a=t.length,u=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<a;l++){const c=t[l],h=l*4;l<t.length-1?s=t[l+1]:s=c,n=-(s.x-e.x),i=s.y-e.y;let d=(1-l/(a-1))*10;d>1&&(d=1);const p=Math.sqrt(i*i+n*n);p<1e-6?(i=0,n=0):(i/=p,n/=p,i*=u,n*=u),o[h]=c.x+i,o[h+1]=c.y+n,o[h+2]=c.x-i,o[h+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};Sb.defaultOptions={width:200,points:[],textureScale:0};let Eb=Sb;var EP=Object.defineProperty,wP=Object.defineProperties,CP=Object.getOwnPropertyDescriptors,Dn=Object.getOwnPropertySymbols,wb=Object.prototype.hasOwnProperty,Cb=Object.prototype.propertyIsEnumerable,Rb=(r,t,e)=>t in r?EP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,cc=(r,t)=>{for(var e in t||(t={}))wb.call(t,e)&&Rb(r,e,t[e]);if(Dn)for(var e of Dn(t))Cb.call(t,e)&&Rb(r,e,t[e]);return r},RP=(r,t)=>wP(r,CP(t)),PP=(r,t)=>{var e={};for(var s in r)wb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Dn)for(var s of Dn(r))t.indexOf(s)<0&&Cb.call(r,s)&&(e[s]=r[s]);return e};const Pb=class Ly extends Ar{constructor(t){const e=cc(cc({},Ly.defaultOptions),t),{texture:s,points:i,textureScale:n}=e,o=PP(e,["texture","points","textureScale"]),a=new Eb(Xt({width:s.height,points:i,textureScale:n}));n>0&&(s.source.style.addressMode="repeat"),super(Xt(RP(cc({},o),{texture:s,geometry:a}))),this.autoUpdate=!0,this.onRender=this._render}_render(){const t=this.geometry;(this.autoUpdate||t._width!==this.texture.height)&&(t._width=this.texture.height,t.update())}};Pb.defaultOptions={textureScale:0};let DP=Pb;var MP=Object.defineProperty,OP=Object.defineProperties,BP=Object.getOwnPropertyDescriptors,Mn=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Mb=Object.prototype.propertyIsEnumerable,Ob=(r,t,e)=>t in r?MP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,GP=(r,t)=>{for(var e in t||(t={}))Db.call(t,e)&&Ob(r,e,t[e]);if(Mn)for(var e of Mn(t))Mb.call(t,e)&&Ob(r,e,t[e]);return r},FP=(r,t)=>OP(r,BP(t)),IP=(r,t)=>{var e={};for(var s in r)Db.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Mn)for(var s of Mn(r))t.indexOf(s)<0&&Mb.call(r,s)&&(e[s]=r[s]);return e};class UP extends Ar{constructor(t){const e=t,{texture:s,vertices:i,uvs:n,indices:o,topology:a}=e,u=IP(e,["texture","vertices","uvs","indices","topology"]),l=new $e(Xt({positions:i,uvs:n,indices:o,topology:a}));super(Xt(FP(GP({},u),{texture:s,geometry:l}))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}}function kP(r,t){const{width:e,height:s}=r.frame;return t.scale(1/e,1/s),t}var LP=Object.defineProperty,Bb=Object.getOwnPropertySymbols,NP=Object.prototype.hasOwnProperty,$P=Object.prototype.propertyIsEnumerable,Gb=(r,t,e)=>t in r?LP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fb=(r,t)=>{for(var e in t||(t={}))NP.call(t,e)&&Gb(r,e,t[e]);if(Bb)for(var e of Bb(t))$P.call(t,e)&&Gb(r,e,t[e]);return r};const Ib=class yc{constructor(t){if(t instanceof w)this.texture=t,ai(this,yc.defaultOptions,{});else{const e=Fb(Fb({},yc.defaultOptions),t);ai(this,e,{})}}get alpha(){return this._alpha}set alpha(t){this._alpha=Math.min(Math.max(t,0),1),this._updateColor()}get tint(){return rr(this._tint)}set tint(t){typeof t=="number"?this._tint=t:this._tint=X.shared.setValue(t!=null?t:16777215).toBgrNumber(),this._updateColor()}_updateColor(){this.color=this._tint+((this._alpha*255|0)<<24)}};Ib.defaultOptions={anchorX:0,anchorY:0,x:0,y:0,scaleX:1,scaleY:1,rotation:0,tint:16777215,alpha:1};let XP=Ib;const hc={vertex:{attributeName:"aVertex",format:"float32x2",code:`
const texture = p.texture;
const sx = p.scaleX;
const sy = p.scaleY;
const ax = p.anchorX;
const ay = p.anchorY;
const trim = texture.trim;
const orig = texture.orig;
if (trim)
{
w1 = trim.x - (ax * orig.width);
w0 = w1 + trim.width;
h1 = trim.y - (ay * orig.height);
h0 = h1 + trim.height;
}
else
{
w1 = -ax * (orig.width);
w0 = w1 + orig.width;
h1 = -ay * (orig.height);
h0 = h1 + orig.height;
}
f32v[offset] = w1 * sx;
f32v[offset + 1] = h1 * sy;
f32v[offset + stride] = w0 * sx;
f32v[offset + stride + 1] = h1 * sy;
f32v[offset + (stride * 2)] = w0 * sx;
f32v[offset + (stride * 2) + 1] = h0 * sy;
f32v[offset + (stride * 3)] = w1 * sx;
f32v[offset + (stride * 3) + 1] = h0 * sy;
`,dynamic:!1},position:{attributeName:"aPosition",format:"float32x2",code:`
var x = p.x;
var y = p.y;
f32v[offset] = x;
f32v[offset + 1] = y;
f32v[offset + stride] = x;
f32v[offset + stride + 1] = y;
f32v[offset + (stride * 2)] = x;
f32v[offset + (stride * 2) + 1] = y;
f32v[offset + (stride * 3)] = x;
f32v[offset + (stride * 3) + 1] = y;
`,dynamic:!0},rotation:{attributeName:"aRotation",format:"float32",code:`
var rotation = p.rotation;
f32v[offset] = rotation;
f32v[offset + stride] = rotation;
f32v[offset + (stride * 2)] = rotation;
f32v[offset + (stride * 3)] = rotation;
`,dynamic:!1},uvs:{attributeName:"aUV",format:"float32x2",code:`
var uvs = p.texture.uvs;
f32v[offset] = uvs.x0;
f32v[offset + 1] = uvs.y0;
f32v[offset + stride] = uvs.x1;
f32v[offset + stride + 1] = uvs.y1;
f32v[offset + (stride * 2)] = uvs.x2;
f32v[offset + (stride * 2) + 1] = uvs.y2;
f32v[offset + (stride * 3)] = uvs.x3;
f32v[offset + (stride * 3) + 1] = uvs.y3;
`,dynamic:!1},color:{attributeName:"aColor",format:"unorm8x4",code:`
const c = p.color;
u32v[offset] = c;
u32v[offset + stride] = c;
u32v[offset + (stride * 2)] = c;
u32v[offset + (stride * 3)] = c;
`,dynamic:!1}};var HP=Object.defineProperty,zP=Object.defineProperties,jP=Object.getOwnPropertyDescriptors,On=Object.getOwnPropertySymbols,Ub=Object.prototype.hasOwnProperty,kb=Object.prototype.propertyIsEnumerable,Lb=(r,t,e)=>t in r?HP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wr=(r,t)=>{for(var e in t||(t={}))Ub.call(t,e)&&Lb(r,e,t[e]);if(On)for(var e of On(t))kb.call(t,e)&&Lb(r,e,t[e]);return r},Nb=(r,t)=>zP(r,jP(t)),VP=(r,t)=>{var e={};for(var s in r)Ub.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&On)for(var s of On(r))t.indexOf(s)<0&&kb.call(r,s)&&(e[s]=r[s]);return e};const WP=new nt(0,0,0,0),$b=class vc extends ae{constructor(t={}){t=Nb(wr(wr({},vc.defaultOptions),t),{dynamicProperties:wr(wr({},vc.defaultOptions.dynamicProperties),t==null?void 0:t.dynamicProperties)});const e=t,{dynamicProperties:s,shader:i,roundPixels:n,texture:o,particles:a}=e,u=VP(e,["dynamicProperties","shader","roundPixels","texture","particles"]);super(wr({label:"ParticleContainer"},u)),this.renderPipeId="particle",this.batched=!1,this._childrenDirty=!1,this.texture=o||null,this.shader=i,this._properties={};for(const l in hc){const c=hc[l],h=s[l];this._properties[l]=Nb(wr({},c),{dynamic:h})}this.allowChildren=!0,this.roundPixels=n!=null?n:!1,this.particleChildren=a!=null?a:[]}addParticle(...t){for(let e=0;e<t.length;e++)this.particleChildren.push(t[e]);return this.onViewUpdate(),t[0]}removeParticle(...t){let e=!1;for(let s=0;s<t.length;s++){const i=this.particleChildren.indexOf(t[s]);i>-1&&(this.particleChildren.splice(i,1),e=!0)}return e&&this.onViewUpdate(),t[0]}update(){this._childrenDirty=!0}onViewUpdate(){this._childrenDirty=!0,super.onViewUpdate()}get bounds(){return WP}updateBounds(){}destroy(t=!1){var e,s,i;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const n=typeof t=="boolean"?t:t==null?void 0:t.textureSource,o=(s=this.texture)!=null?s:(e=this.particleChildren[0])==null?void 0:e.texture;o&&o.destroy(n)}this.texture=null,(i=this.shader)==null||i.destroy()}removeParticles(t,e){t!=null||(t=0),e!=null||(e=this.particleChildren.length);const s=this.particleChildren.splice(t,e-t);return this.onViewUpdate(),s}removeParticleAt(t){const e=this.particleChildren.splice(t,1);return this.onViewUpdate(),e[0]}addParticleAt(t,e){return this.particleChildren.splice(e,0,t),this.onViewUpdate(),t}addChild(...t){throw new Error("ParticleContainer.addChild() is not available. Please use ParticleContainer.addParticle()")}removeChild(...t){throw new Error("ParticleContainer.removeChild() is not available. Please use ParticleContainer.removeParticle()")}removeChildren(t,e){throw new Error("ParticleContainer.removeChildren() is not available. Please use ParticleContainer.removeParticles()")}removeChildAt(t){throw new Error("ParticleContainer.removeChildAt() is not available. Please use ParticleContainer.removeParticleAt()")}getChildAt(t){throw new Error("ParticleContainer.getChildAt() is not available. Please use ParticleContainer.getParticleAt()")}setChildIndex(t,e){throw new Error("ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()")}getChildIndex(t){throw new Error("ParticleContainer.getChildIndex() is not available. Please use ParticleContainer.getParticleIndex()")}addChildAt(t,e){throw new Error("ParticleContainer.addChildAt() is not available. Please use ParticleContainer.addParticleAt()")}swapChildren(t,e){throw new Error("ParticleContainer.swapChildren() is not available. Please use ParticleContainer.swapParticles()")}reparentChild(...t){throw new Error("ParticleContainer.reparentChild() is not available with the particle container")}reparentChildAt(t,e){throw new Error("ParticleContainer.reparentChildAt() is not available with the particle container")}};$b.defaultOptions={dynamicProperties:{vertex:!1,position:!0,rotation:!1,uvs:!1,color:!1},roundPixels:!1};let YP=$b;var qP=Object.defineProperty,Bn=Object.getOwnPropertySymbols,Xb=Object.prototype.hasOwnProperty,Hb=Object.prototype.propertyIsEnumerable,zb=(r,t,e)=>t in r?qP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,KP=(r,t)=>{for(var e in t||(t={}))Xb.call(t,e)&&zb(r,e,t[e]);if(Bn)for(var e of Bn(t))Hb.call(t,e)&&zb(r,e,t[e]);return r},ZP=(r,t)=>{var e={};for(var s in r)Xb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Bn)for(var s of Bn(r))t.indexOf(s)<0&&Hb.call(r,s)&&(e[s]=r[s]);return e};const jb=class Ny extends ae{constructor(t){var e,s,i,n,o,a,u,l,c,h;t instanceof w&&(t={texture:t});const d=t,{width:p,height:f,anchor:g,leftWidth:m,rightWidth:_,topHeight:b,bottomHeight:x,texture:v,roundPixels:A}=d,T=ZP(d,["width","height","anchor","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(KP({label:"NineSliceSprite"},T)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=(s=m!=null?m:(e=v==null?void 0:v.defaultBorders)==null?void 0:e.left)!=null?s:ye.defaultOptions.leftWidth,this._topHeight=(n=b!=null?b:(i=v==null?void 0:v.defaultBorders)==null?void 0:i.top)!=null?n:ye.defaultOptions.topHeight,this._rightWidth=(a=_!=null?_:(o=v==null?void 0:v.defaultBorders)==null?void 0:o.right)!=null?a:ye.defaultOptions.rightWidth,this._bottomHeight=(l=x!=null?x:(u=v==null?void 0:v.defaultBorders)==null?void 0:u.bottom)!=null?l:ye.defaultOptions.bottomHeight,this._width=(c=p!=null?p:v.width)!=null?c:ye.defaultOptions.width,this._height=(h=f!=null?f:v.height)!=null?h:ye.defaultOptions.height,this.allowChildren=!1,this.texture=v!=null?v:Ny.defaultOptions.texture,this.roundPixels=A!=null?A:!1,this._anchor=new st({_onUpdate:()=>{this.onViewUpdate()}}),g?this.anchor=g:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return this._width}set width(t){this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this._height=t,this.onViewUpdate()}setSize(t,e){var s;typeof t=="object"&&(e=(s=t.height)!=null?s:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=w.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}updateBounds(){const t=this._bounds,e=this._anchor,s=this._width,i=this._height;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*i,t.maxY=t.minY+i}};jb.defaultOptions={texture:w.EMPTY};let Vb=jb;class QP extends Vb{constructor(...t){let e=t[0];e instanceof w&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}}var dc=/iPhone/i,Wb=/iPod/i,Yb=/iPad/i,qb=/\biOS-universal(?:.+)Mac\b/i,pc=/\bAndroid(?:.+)Mobile\b/i,Kb=/Android/i,Cr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Gn=/Silk/i,pe=/Windows Phone/i,Zb=/\bWindows(?:.+)ARM\b/i,Qb=/BlackBerry/i,Jb=/BB10/i,ty=/Opera Mini/i,ey=/\b(CriOS|Chrome)(?:.+)Mobile/i,ry=/Mobile(?:.+)Firefox\b/i,sy=function(r){return typeof r!="undefined"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream=="undefined"};function JP(r){return function(t){return t.test(r)}}function iy(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var i=JP(e),n={apple:{phone:i(dc)&&!i(pe),ipod:i(Wb),tablet:!i(dc)&&(i(Yb)||sy(t))&&!i(pe),universal:i(qb),device:(i(dc)||i(Wb)||i(Yb)||i(qb)||sy(t))&&!i(pe)},amazon:{phone:i(Cr),tablet:!i(Cr)&&i(Gn),device:i(Cr)||i(Gn)},android:{phone:!i(pe)&&i(Cr)||!i(pe)&&i(pc),tablet:!i(pe)&&!i(Cr)&&!i(pc)&&(i(Gn)||i(Kb)),device:!i(pe)&&(i(Cr)||i(Gn)||i(pc)||i(Kb))||i(/\bokhttp\b/i)},windows:{phone:i(pe),tablet:i(Zb),device:i(pe)||i(Zb)},other:{blackberry:i(Qb),blackberry10:i(Jb),opera:i(ty),firefox:i(ry),chrome:i(ey),device:i(Qb)||i(Jb)||i(ty)||i(ry)||i(ey)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var ny;const tD=(ny=iy.default)!=null?ny:iy,eD=tD(globalThis.navigator);async function rD(r,t,e=200){const s=await t.extract.base64(r);await t.encoder.commandFinished;const i=e;console.log(`logging texture ${r.source.width}px ${r.source.height}px`);const n=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}var sD=Object.defineProperty,iD=Object.defineProperties,nD=Object.getOwnPropertyDescriptors,oy=Object.getOwnPropertySymbols,oD=Object.prototype.hasOwnProperty,aD=Object.prototype.propertyIsEnumerable,ay=(r,t,e)=>t in r?sD(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uy=(r,t)=>{for(var e in t||(t={}))oD.call(t,e)&&ay(r,e,t[e]);if(oy)for(var e of oy(t))aD.call(t,e)&&ay(r,e,t[e]);return r},uD=(r,t)=>iD(r,nD(t));const lD=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let cD=0;function ly(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=lD[cD++]);let s="";for(let o=0;o<t;o++)s+=" ";let i=r.label;!i&&r instanceof jt&&(i=`sprite:${r.texture.label}`);let n=`%c ${s}|- ${i} (worldX:${r.worldTransform.tx}, relativeRenderX:${r.relativeGroupTransform.tx}, renderX:${r.groupTransform.tx}, localX:${r.x})`;r.renderGroup&&(n+=" (RenderGroup)"),r.filters&&(n+="(*filters)"),console.log(n,`color:${e.color}; font-weight:bold;`),t++;for(let o=0;o<r.children.length;o++){const a=r.children[o];ly(a,t,uy({},e))}}function cy(r,t=0,e={index:0,color:"#000000"}){let s="";for(let n=0;n<t;n++)s+=" ";const i=`%c ${s}- ${e.index}: ${r.root.label} worldX:${r.worldTransform.tx}`;console.log(i,`color:${e.color}; font-weight:bold;`),t++;for(let n=0;n<r.renderGroupChildren.length;n++){const o=r.renderGroupChildren[n];cy(o,t,uD(uy({},e),{index:n}))}}L.set(_h);export{$a as AbstractBitmapFont,bs as AbstractRenderer,dn as AbstractText,zE as AlphaFilter,wo as AlphaMask,Vu as AlphaMaskPipe,Us as AnimatedSprite,Ig as Application,lu as ApplicationInitHook,Ss as Assets,v_ as AssetsClass,Xd as BLEND_TO_NPM,Ms as BUFFER_TYPE,Lg as BackgroundLoader,cx as BackgroundSystem,Yd as Batch,ep as BatchGeometry,zd as BatchTextureArray,Si as BatchableGraphics,Gm as BatchableHTMLText,Di as BatchableMesh,us as BatchableSprite,Of as BatchableText,Jd as Batcher,ju as BatcherPipe,ut as BigPool,Zt as BindGroup,zl as BindGroupSystem,hu as BitmapFont,gs as BitmapFontManager,K0 as BitmapText,Om as BitmapTextGraphics,ja as BitmapTextPipe,IE as BlendModeFilter,Ol as BlendModePipe,d0 as BlurFilter,rn as BlurFilterPass,nt as Bounds,yt as Buffer,ti as BufferImageSource,xn as BufferResource,$ as BufferUsage,Tt as CLEAR,V as Cache,le as CanvasPool,hm as CanvasPoolClass,Kt as CanvasSource,_r as CanvasTextGenerator,kt as CanvasTextMetrics,va as CanvasTextPipe,ka as CanvasTextSystem,In as Circle,X as Color,Co as ColorMask,Wu as ColorMaskPipe,uw as ColorMatrixFilter,Es as CompressedSource,mt as Container,U_ as Culler,k_ as CullerPlugin,El as CustomRenderPipe,wu as D3D10_RESOURCE_DIMENSION,At as D3DFMT,LS as DATA_URI,F as DDS,Ph as DEG_TO_RAD,uc as DEPRECATED_SCALE_MODES,ac as DEPRECATED_WRAP_MODES,L as DOMAdapter,NR as DRAW_MODES,Eu as DXGI_FORMAT,St as DXGI_TO_TEXTURE_FORMAT,Ai as DefaultBatcher,Hp as DefaultShader,mw as DisplacementFilter,Xa as DynamicBitmapFont,Un as Ellipse,Ct as EventEmitter,y as ExtensionType,px as ExtractSystem,Cu as FOURCC_TO_TEXTURE_FORMAT,Qt as FillGradient,ls as FillPattern,he as Filter,Kr as FilterEffect,eu as FilterPipe,ru as FilterSystem,_s as FontStylePromiseCache,Bu as GAUSSIAN_VALUES,gn as GL_FORMATS,P_ as GL_INTERNAL_FORMAT,Qu as GL_TARGETS,H as GL_TYPES,a2 as GL_WRAP_MODES,Il as GenerateTextureSystem,Fe as Geometry,p2 as GlBackBufferSystem,Xu as GlBatchAdaptor,r2 as GlBuffer,qu as GlBufferSystem,el as GlColorMaskSystem,o2 as GlContextSystem,rl as GlEncoderSystem,Ju as GlGeometrySystem,Al as GlGraphicsAdaptor,sl as GlLimitsSystem,Sl as GlMeshAdaptor,Sf as GlParticleContainerAdaptor,ba as GlParticleContainerPipe,Rt as GlProgram,M2 as GlProgramData,f2 as GlRenderTarget,v2 as GlRenderTargetAdaptor,dl as GlRenderTargetSystem,_l as GlShaderSystem,j2 as GlStateSystem,il as GlStencilSystem,V2 as GlTexture,Tl as GlTextureSystem,ll as GlUboSystem,xl as GlUniformGroupSystem,Ul as GlobalUniformSystem,Hu as GpuBatchAdaptor,ft as GpuBlendModesToPixi,jl as GpuBufferSystem,Vl as GpuColorMaskSystem,En as GpuDeviceSystem,Wl as GpuEncoderSystem,nc as GpuGraphicsAdaptor,vf as GpuGraphicsContext,Yl as GpuLimitsSystem,oc as GpuMeshAdapter,Kx as GpuMipmapGenerator,Mf as GpuParticleContainerAdaptor,ya as GpuParticleContainerPipe,Et as GpuProgram,jx as GpuRenderTarget,Vx as GpuRenderTargetAdaptor,Jl as GpuRenderTargetSystem,tc as GpuShaderSystem,ec as GpuStateSystem,de as GpuStencilModesToPixi,ql as GpuStencilSystem,ic as GpuTextureSystem,Kl as GpuUboSystem,Zl as GpuUniformBatchPipe,Dr as Graphics,pt as GraphicsContext,Tf as GraphicsContextRenderData,Pi as GraphicsContextSystem,Af as GraphicsGpuData,ze as GraphicsPath,pa as GraphicsPipe,Z0 as HTMLText,Va as HTMLTextPipe,Wa as HTMLTextRenderData,Is as HTMLTextStyle,Ka as HTMLTextSystem,Sn as HelloSystem,vC as IGLUniformData,xe as ImageSource,To as InstructionSet,J as KTX,Kg as Loader,wt as LoaderParserPriority,ii as MaskEffectManager,dd as MaskEffectManagerClass,M0 as MaskFilter,D as Matrix,Ar as Mesh,$e as MeshGeometry,fa as MeshGpuData,ma as MeshPipe,vP as MeshPlane,DP as MeshRope,UP as MeshSimple,co as NOOP,ye as NineSliceGeometry,QP as NineSlicePlane,Vb as NineSliceSprite,Sg as NineSliceSpriteGpuData,tu as NineSliceSpritePipe,vw as NoiseFilter,st as ObservablePoint,Ch as PI_2,XP as Particle,Cf as ParticleBuffer,YP as ParticleContainer,xa as ParticleContainerPipe,Df as ParticleShader,fP as PerspectiveMesh,pb as PerspectivePlaneGeometry,Ql as PipelineSystem,Ni as PlaneGeometry,it as Point,Pr as Polygon,si as Pool,ad as PoolGroupClass,B0 as PrepareBase,q0 as PrepareQueue,J0 as PrepareSystem,Q0 as PrepareUpload,hg as QuadGeometry,Rh as RAD_TO_DEG,z as Rectangle,qR as RenderContainer,Dd as RenderGroup,wl as RenderGroupPipe,Pl as RenderGroupSystem,sP as RenderLayer,_n as RenderTarget,hl as RenderTargetSystem,Ln as RenderTexture,Ax as RenderableGCSystem,cu as RendererInitHook,vt as RendererType,no as ResizePlugin,_e as Resolver,Eb as RopeGeometry,kn as RoundedRectangle,XR as SCALE_MODES,Q as STENCIL_MODES,Yf as SVGParser,kl as SchedulerSystem,Yw as ScissorMask,Sm as SdfShader,Ot as Shader,ar as ShaderStage,Xf as ShapePath,Hl as SharedRenderPipes,Xl as SharedSystems,jt as Sprite,Dl as SpritePipe,fo as Spritesheet,Pt as State,Ro as StencilMask,Yu as StencilMaskPipe,ou as SystemRunner,C_ as TEXTURE_FORMAT_BLOCK_SIZE,$u as Text,zt as TextStyle,w as Texture,Cx as TextureGCSystem,po as TextureMatrix,et as TexturePool,Pd as TexturePoolClass,q as TextureSource,Ft as TextureStyle,HR as TextureUvs,dt as Ticker,Ks as TickerListener,oo as TickerPlugin,j0 as TilingSprite,mg as TilingSpriteGpuData,Ja as TilingSpritePipe,cg as TilingSpriteShader,N0 as Transform,Tc as Triangle,$2 as UNIFORM_TO_ARRAY_SETTERS,N2 as UNIFORM_TO_SINGLE_SETTERS,Bp as UNIFORM_TYPES_MAP,qo as UNIFORM_TYPES_VALUES,ui as UPDATE_BLEND,Jr as UPDATE_COLOR,ge as UPDATE_PRIORITY,w1 as UPDATE_TRANSFORM,sr as UPDATE_VISIBLE,Ix as UboBatch,nl as UboSystem,rt as UniformGroup,As as VERSION,ts as VideoSource,ae as ViewContainer,Mx as ViewSystem,Ge as ViewableBuffer,Bs as WGSL_ALIGN_SIZE_DATA,ol as WGSL_TO_STD40_SIZE,$R as WRAP_MODES,Fx as WebGLRenderer,tb as WebGPURenderer,_h as WebWorkerAdapter,_u as WorkerManager,Xo as addBits,ci as addMaskBounds,hi as addMaskLocalBounds,ip as addProgramDefines,K_ as alphaFrag,Mu as alphaWgsl,pg as applyMatrix,ub as applyProjectiveTransformationToPlane,vl as applyStyleParams,ai as assignWithIgnore,MS as autoDetectEnvironment,Og as autoDetectRenderer,k1 as autoDetectSource,qi as basisTranscoderUrls,rr as bgr2rgb,Ug as bitmapFontCachePlugin,Xi as bitmapFontTextParser,du as bitmapFontXMLParser,pu as bitmapFontXMLStringParser,H_ as blendTemplateFrag,z_ as blendTemplateVert,j_ as blendTemplateWgsl,rc as blockDataMap,i0 as blurTemplateWgsl,qt as boundsPool,Sa as buildAdaptiveBezier,If as buildAdaptiveQuadratic,Ca as buildArc,Uf as buildArcTo,Lf as buildArcToSvg,dr as buildCircle,bf as buildContextBatches,qp as buildEllipse,Jp as buildLine,tf as buildPixelLine,lf as buildPolygon,cf as buildRectangle,Kp as buildRoundedRectangle,Vp as buildSimpleUvs,hf as buildTriangle,jp as buildUvs,ud as cacheAsTextureMixin,Ng as cacheTextureArray,T2 as calculateProjection,vo as checkChildrenDidChange,Xe as checkDataUrl,Lt as checkExtension,Fo as checkMaxIfStatementsInShader,cd as childrenHelperMixin,bx as cleanArray,xx as cleanHash,An as clearList,Qo as closePointEps,KR as collectAllRenderables,hd as collectRenderablesMixin,fr as color32BitToUniform,_i as colorBit,xi as colorBitGl,p0 as colorMatrixFilterFrag,Fu as colorMatrixFilterWgsl,tA as colorToUniform,Z2 as compareModeToGlCompare,vp as compileHighShader,Tp as compileHighShaderGl,lr as compileHighShaderGlProgram,ur as compileHighShaderGpuProgram,Ho as compileHooks,zo as compileInputs,yp as compileOutputs,pl as compileShader,db as compute2DProjection,bE as convertFormatIfRequired,Gt as convertToList,Zs as copySearchParams,or as createIdFromString,ga as createIndicesForQuads,H3 as createLevelBuffers,yE as createLevelBuffersFromKTX,Ah as createStringVariations,ve as createTexture,m2 as createUboElementsSTD40,Nx as createUboElementsWGSL,al as createUboSyncFunction,y2 as createUboSyncFunctionSTD40,Xx as createUboSyncFunctionWGSL,g_ as crossOrigin,od as cullingMixin,Jo as curveEps,tn as defaultFilterVert,ml as defaultValue,Xt as definedProps,$d as deprecation,$g as detectAvif,k3 as detectBasis,CE as detectCompressed,Hg as detectDefaults,zg as detectMp4,jg as detectOgv,Do as detectVideoAlphaMode,Vg as detectWebm,Wg as detectWebp,x_ as determineCrossOrigin,g0 as displacementFrag,_0 as displacementVert,Iu as displacementWgsl,uf as earcut,gd as effectsMixin,Zu as ensureAttributes,Uo as ensureIsBuffer,np as ensurePrecision,pn as ensureTextOptions,Tn as executeInstructions,I as extensions,G2 as extractAttributesFromGlProgram,fp as extractAttributesFromGpuProgram,Vm as extractFontFamilies,gi as extractStructAndGroups,Ma as extractSvgUrlId,fi as fastCopy,_d as findMixin,fs as fontStringFromTextStyle,jw as formatShader,wp as fragmentGPUTemplate,Rp as fragmentGlTemplate,b2 as generateArraySyncSTD40,$x as generateArraySyncWGSL,e0 as generateBlurFragSource,s0 as generateBlurGlProgram,n0 as generateBlurProgram,r0 as generateBlurVertSource,Hw as generateGPULayout,mp as generateGpuLayoutGroups,zw as generateLayout,gp as generateLayoutHash,Ef as generateParticleUpdateFunction,L2 as generateProgram,D2 as generateShaderSyncCode,am as generateTextStyleKey,bi as generateTextureBatchBit,yi as generateTextureBatchBitGl,xf as generateTextureMatrix,X2 as generateUniformsSync,ir as getAdjustedBlendModeBlend,ue as getAttributeInfoFromFormat,vi as getBatchSamplersUniformGroup,Ha as getBitmapTextLayout,fm as getCanvasBoundingBox,ms as getCanvasFillStyle,cl as getCanvasTexture,Gp as getDefaultUniformValue,jR as getFastGlobalBounds,xd as getFastGlobalBoundsMixin,Ym as getFontCss,e_ as getFontFamilyName,tp as getGeometryBounds,l2 as getGlTypeFromFormat,Zr as getGlobalBounds,vd as getGlobalMixin,Eg as getGlobalRenderableBounds,oi as getLocalBounds,sp as getMaxFragmentPrecision,Hd as getMaxTexturesPerBatch,Zp as getOrientationOfPoints,Ia as getPo2TextureFromSource,zi as getResolutionOfUrl,qm as getSVGUrl,Su as getSupportedCompressedTextureFormats,Tu as getSupportedGPUCompressedTextureFormats,vu as getSupportedGlCompressedTextureFormats,ws as getSupportedTextureFormats,Km as getTemporaryCanvasFromImage,Go as getTestContext,pi as getTextureBatchBindGroup,kP as getTextureDefaultMatrix,AE as getTextureFormatFromKTXTexture,F2 as getUboData,I2 as getUniformData,wh as getUrlExtension,F_ as glFormatToGPUFormat,W2 as glUploadBufferImageResource,Y2 as glUploadCompressedTextureResource,bl as glUploadImageResource,q2 as glUploadVideoResource,Pp as globalUniformsBit,Dp as globalUniformsBitGl,aT as globalUniformsUBOBitGl,j3 as gpuFormatToBasisTranscoderFormat,EE as gpuFormatToKTXBasisTranscoderFormat,Wx as gpuUploadBufferImageResource,Yx as gpuUploadCompressedTextureResource,sc as gpuUploadImageResource,qx as gpuUploadVideoResource,N as groupD8,_C as hasCachedCanvasTexture,Rw as hslWgsl,UE as hslgl,kE as hslgpu,jo as injectBits,op as insertVersion,eD as isMobile,ho as isPow2,E2 as isRenderingToScreen,Fm as isSafari,Wr as isSingleItem,ys as isWebGLSupported,vs as isWebGPUSupported,Ki as ktxTranscoderUrls,X3 as loadBasis,w_ as loadBasisOnWorker,kg as loadBitmapFont,Q3 as loadDDS,iu as loadEnvironmentExtensions,Wm as loadFontAsBase64,Ya as loadFontCSS,h_ as loadImageBitmap,Zg as loadJson,fE as loadKTX,xE as loadKTX2,B_ as loadKTX2onWorker,Zm as loadSVGImage,o_ as loadSvg,xu as loadTextures,Qg as loadTxt,b_ as loadVideoTextures,r_ as loadWebFont,xr as localUniformBit,ki as localUniformBitGl,ag as localUniformBitGroup2,ym as localUniformMSDFBit,vm as localUniformMSDFBitGl,kv as log2,rD as logDebugTexture,k2 as logProgramError,cy as logRenderGroupScene,ly as logScene,Tm as mSDFBit,Am as mSDFBitGl,Q2 as mapFormatToGlFormat,ex as mapFormatToGlInternalFormat,rx as mapFormatToGlType,B2 as mapGlToVertexFormat,EC as mapSize,gl as mapType,H2 as mapWebGLBlendModesToPixi,w0 as maskFrag,C0 as maskVert,Lu as maskWgsl,ht as matrixPool,qa as measureHtmlText,Ad as measureMixin,AC as migrateFragmentFromV7toV8,K2 as mipmapScaleModeToGlFilter,Qr as multiplyColors,yo as multiplyHexColors,Be as nextPow2,v0 as noiseFrag,Uu as noiseWgsl,A_ as nonCompressedFormats,jr as normalizeExtensionPriority,Sd as onRenderMixin,R_ as parseDDS,zR as parseFunctionBody,D_ as parseKTX,zf as parseSVGDefinitions,Z as parseSVGFloatAttribute,Gf as parseSVGPath,Ba as parseSVGStyle,hc as particleData,Rf as particlesFrag,Pf as particlesVert,_a as particlesWgsl,bt as path,Nu as pointInTriangle,__ as preloadVideo,ld as removeItems,_p as removeStructAndGroupDuplicates,Uv as resetUids,Pm as resolveCharacters,wE as resolveCompressedTextureUrl,y_ as resolveJsonUrl,yu as resolveTextureUrl,Ud as resourceToTexture,cr as roundPixelsBit,hr as roundPixelsBitGl,Nf as roundedShapeArc,$f as roundedShapeQuadraticCurve,_x as sayHello,yl as scaleModeToGlFilter,N3 as setBasisTranscoderPath,gE as setKTXTranscoderPath,dg as setPositions,ap as setProgramName,fg as setUvs,as as shapeBuilders,Ed as sortMixin,jh as spritesheetAsset,cs as squaredDistanceToLineSegment,up as stripVersion,Oa as styleAttributes,fu as testImageFormat,Hi as testVideoFormat,km as textStyleToCSS,t2 as textureBit,e2 as textureBitGl,kd as textureFrom,ug as tilingBit,lg as tilingBitGl,be as toFillStyle,wd as toLocalGlobalMixin,ps as toStrokeStyle,Zo as transformVertices,sa as triangulateWithHoles,ul as uboSyncFunctionsSTD40,x2 as uboSyncFunctionsWGSL,Y as uid,Te as uniformParsers,LC as unpremultiplyAlpha,nu as unsafeEvalSupported,ZR as updateLocalTransform,mo as updateQuadBounds,ix as updateRenderGroupTransform,Cl as updateRenderGroupTransforms,Mi as updateTextBounds,Rl as updateTransformAndChildren,ni as updateTransformBackwards,QR as updateWorldTransform,N1 as v8_0_0,$1 as v8_3_4,Zi as validFormats,ox as validateRenderables,Ep as vertexGPUTemplate,Cp as vertexGlTemplate,I_ as vkFormatToGPUFormat,Ut as warn,DE as webworkerExt,vn as wrapModeToGlAddress};
//# sourceMappingURL=webworker.min.mjs.map