@omnimedia/omnitool
Version:
open source video processing tools
22 lines (20 loc) • 63.6 kB
JavaScript
var He=Object.create;var dt=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var qe=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),bs=(s,t)=>{for(var e in t)dt(s,e,{get:t[e],enumerable:!0})},Ke=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Be(t))!je.call(s,r)&&r!==e&&dt(s,r,{get:()=>t[r],enumerable:!(i=Ue(t,r))||i.enumerable});return s};var Je=(s,t,e)=>(e=s!=null?He(Ve(s)):{},Ke(t||!s||!s.__esModule?dt(e,"default",{value:s,enumerable:!0}):e,s));var Lt=qe((Ts,yt)=>{"use strict";var es=Object.prototype.hasOwnProperty,M="~";function H(){}Object.create&&(H.prototype=Object.create(null),new H().__proto__||(M=!1));function ss(s,t,e){this.fn=s,this.context=t,this.once=e||!1}function Gt(s,t,e,i,r){if(typeof e!="function")throw new TypeError("The listener must be a function");var n=new ss(e,i||s,r),o=M?M+t:t;return s._events[o]?s._events[o].fn?s._events[o]=[s._events[o],n]:s._events[o].push(n):(s._events[o]=n,s._eventsCount++),s}function et(s,t){--s._eventsCount===0?s._events=new H:delete s._events[t]}function w(){this._events=new H,this._eventsCount=0}w.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)es.call(e,i)&&t.push(M?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};w.prototype.listeners=function(t){var e=M?M+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,o=new Array(n);r<n;r++)o[r]=i[r].fn;return o};w.prototype.listenerCount=function(t){var e=M?M+t:t,i=this._events[e];return i?i.fn?1:i.length:0};w.prototype.emit=function(t,e,i,r,n,o){var h=M?M+t:t;if(!this._events[h])return!1;var a=this._events[h],u=arguments.length,f,c;if(a.fn){switch(a.once&&this.removeListener(t,a.fn,void 0,!0),u){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,e),!0;case 3:return a.fn.call(a.context,e,i),!0;case 4:return a.fn.call(a.context,e,i,r),!0;case 5:return a.fn.call(a.context,e,i,r,n),!0;case 6:return a.fn.call(a.context,e,i,r,n,o),!0}for(c=1,f=new Array(u-1);c<u;c++)f[c-1]=arguments[c];a.fn.apply(a.context,f)}else{var d=a.length,l;for(c=0;c<d;c++)switch(a[c].once&&this.removeListener(t,a[c].fn,void 0,!0),u){case 1:a[c].fn.call(a[c].context);break;case 2:a[c].fn.call(a[c].context,e);break;case 3:a[c].fn.call(a[c].context,e,i);break;case 4:a[c].fn.call(a[c].context,e,i,r);break;default:if(!f)for(l=1,f=new Array(u-1);l<u;l++)f[l-1]=arguments[l];a[c].fn.apply(a[c].context,f)}}return!0};w.prototype.on=function(t,e,i){return Gt(this,t,e,i,!1)};w.prototype.once=function(t,e,i){return Gt(this,t,e,i,!0)};w.prototype.removeListener=function(t,e,i,r){var n=M?M+t:t;if(!this._events[n])return this;if(!e)return et(this,n),this;var o=this._events[n];if(o.fn)o.fn===e&&(!r||o.once)&&(!i||o.context===i)&&et(this,n);else{for(var h=0,a=[],u=o.length;h<u;h++)(o[h].fn!==e||r&&!o[h].once||i&&o[h].context!==i)&&a.push(o[h]);a.length?this._events[n]=a.length===1?a[0]:a:et(this,n)}return this};w.prototype.removeAllListeners=function(t){var e;return t?(e=M?M+t:t,this._events[e]&&et(this,e)):(this._events=new H,this._eventsCount=0),this};w.prototype.off=w.prototype.removeListener;w.prototype.addListener=w.prototype.on;w.prefixed=M;w.EventEmitter=w;typeof yt<"u"&&(yt.exports=w)});var mt=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(mt||{}),lt=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Z=(s,t)=>lt(s).priority??t,ws={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(lt).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...s){return s.map(lt).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,r=this._queue;i[e]?i[e]?.(t):(r[e]=r[e]||[],r[e]?.push(t))})}),this},handle(s,t,e){let i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;let n=this._queue;return n[s]&&(n[s]?.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,o)=>Z(o.value,e)-Z(n.value,e)))},i=>{let r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>Z(n,e)-Z(r,e)))},i=>{let r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(s,...t){for(let e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}};var C=class s{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new s(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}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return pt.x=0,pt.y=0,pt}},pt=new C;var Q=[new C,new C,new C,new C],G=class s{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}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 s(0,0,0,0)}clone(){return new s(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,i,r=.5){let{width:n,height:o}=this;if(n<=0||o<=0)return!1;let h=this.x,a=this.y,u=i*(1-r),f=i-u,c=h-u,d=h+n+u,l=a-u,p=a+o+u,y=h+f,m=h+n-f,g=a+f,v=a+o-f;return t>=c&&t<=d&&e>=l&&e<=p&&!(t>y&&t<m&&e>g&&e<v)}intersects(t,e){if(!e){let We=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=We)return!1;let ze=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>ze}let i=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=i||o<=n)return!1;let h=Q[0].set(t.left,t.top),a=Q[1].set(t.left,t.bottom),u=Q[2].set(t.right,t.top),f=Q[3].set(t.right,t.bottom);if(u.x<=h.x||a.y<=h.y)return!1;let c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(h,h),e.apply(a,a),e.apply(u,u),e.apply(f,f),Math.max(h.x,a.x,u.x,f.x)<=i||Math.min(h.x,a.x,u.x,f.x)>=r||Math.max(h.y,a.y,u.y,f.y)<=n||Math.min(h.y,a.y,u.y,f.y)>=o))return!1;let d=c*(a.y-h.y),l=c*(h.x-a.x),p=d*i+l*n,y=d*r+l*n,m=d*i+l*o,g=d*r+l*o;if(Math.max(p,y,m,g)<=d*h.x+l*h.y||Math.min(p,y,m,g)>=d*f.x+l*f.y)return!1;let v=c*(h.y-u.y),Y=c*(u.x-h.x),Ft=v*i+Y*n,Tt=v*r+Y*n,Ot=v*i+Y*o,Nt=v*r+Y*o;return!(Math.max(Ft,Tt,Ot,Nt)<=v*h.x+Y*h.y||Math.min(Ft,Tt,Ot,Nt)>=v*f.x+Y*f.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t||(t=new s),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,r=t.x+t.width,n=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&r>=this.x&&r<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(t,e,i,r){return this.x=t,this.y=e,this.width=i,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};var Dt=Math.PI*2,Ps=180/Math.PI,Ys=Math.PI/180;var I=class s{constructor(t=1,e=0,i=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new C;let i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new C;let i=this.a,r=this.b,n=this.c,o=this.d,h=this.tx,a=this.ty,u=1/(i*o+n*-r),f=t.x,c=t.y;return e.x=o*u*f+-n*u*c+(a*n-h*o)*u,e.y=i*u*c+-r*u*f+(-a*i+h*r)*u,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){let e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){let i=t.a,r=t.b,n=t.c,o=t.d,h=t.tx,a=t.ty,u=e.a,f=e.b,c=e.c,d=e.d;return this.a=i*u+r*c,this.b=i*f+r*d,this.c=n*u+o*c,this.d=n*f+o*d,this.tx=h*u+a*c+e.tx,this.ty=h*f+a*d+e.ty,this}setTransform(t,e,i,r,n,o,h,a,u){return this.a=Math.cos(h+u)*n,this.b=Math.sin(h+u)*n,this.c=-Math.sin(h-a)*o,this.d=Math.cos(h-a)*o,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,r=this.c,n=this.d,o=t.pivot,h=-Math.atan2(-r,n),a=Math.atan2(i,e),u=Math.abs(h+a);return u<1e-5||Math.abs(Dt-u)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=a),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){let t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,o=t*r-e*i;return this.a=r/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-r*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(){let t=new s;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}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Qe.identity()}static get shared(){return Ze.identity()}},Ze=new I,Qe=new I;var T=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],O=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],N=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],D=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],gt=[],kt=[],tt=Math.sign;function ts(){for(let s=0;s<16;s++){let t=[];gt.push(t);for(let e=0;e<16;e++){let i=tt(T[s]*T[e]+N[s]*O[e]),r=tt(O[s]*T[e]+D[s]*O[e]),n=tt(T[s]*N[e]+N[s]*D[e]),o=tt(O[s]*N[e]+D[s]*D[e]);for(let h=0;h<16;h++)if(T[h]===i&&O[h]===r&&N[h]===n&&D[h]===o){t.push(h);break}}}for(let s=0;s<16;s++){let t=new I;t.set(T[s],O[s],N[s],D[s],0,0),kt.push(t)}}ts();var x={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:s=>T[s],uY:s=>O[s],vX:s=>N[s],vY:s=>D[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>gt[s][t],sub:(s,t)=>gt[s][x.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?x.S:x.N:Math.abs(t)*2<=Math.abs(s)?s>0?x.E:x.W:t>0?s>0?x.SE:x.SW:s>0?x.NE:x.NW,matrixAppendRotationInv:(s,t,e=0,i=0,r=0,n=0)=>{let o=kt[x.inv(t)],h=o.a,a=o.b,u=o.c,f=o.d,c=e-Math.min(0,h*r,u*n,h*r+u*n),d=i-Math.min(0,a*r,f*n,a*r+f*n),l=s.a,p=s.b,y=s.c,m=s.d;s.a=h*l+a*y,s.b=h*p+a*m,s.c=u*l+f*y,s.d=u*p+f*m,s.tx=c*l+d*y+s.tx,s.ty=c*p+d*m+s.ty},transformRectCoords:(s,t,e,i)=>{let{x:r,y:n,width:o,height:h}=s,{x:a,y:u,width:f,height:c}=t;return e===x.E?(i.set(r+a,n+u,o,h),i):e===x.S?i.set(f-n-h+a,r+u,h,o):e===x.W?i.set(f-r-o+a,c-n-h+u,o,h):e===x.N?i.set(n+a,c-r-o+u,h,o):i.set(r+a,n+u,o,h)}};var $t=Je(Lt(),1);var A=$t.default;var xt={default:-1};function b(s="default"){return xt[s]===void 0&&(xt[s]=-1),++xt[s]}var Wt=new Set,st="8.0.0",Ds="8.3.4",L={quiet:!1,noColor:!1},U=((s,t,e=3)=>{if(L.quiet||Wt.has(t))return;let i=new Error().stack,r=`${t}
Deprecated since v${s}`,n=typeof console.groupCollapsed=="function"&&!L.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",r):(i=i.split(`
`).splice(e).join(`
`),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(i))),Wt.add(t)});Object.defineProperties(U,{quiet:{get:()=>L.quiet,set:s=>{L.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>L.noColor,set:s=>{L.noColor=s},enumerable:!0,configurable:!1}});var bt=()=>{};function Ls(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function _t(s){return!(s&s-1)&&!!s}function zt(s){let t={};for(let e in s)s[e]!==void 0&&(t[e]=s[e]);return t}var Ht=Object.create(null);function is(s){let t=Ht[s];return t===void 0&&(Ht[s]=b("resource")),t}var Ut=class Bt extends A{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Bt.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){U(st,"TextureStyle.wrapMode is now TextureStyle.addressMode"),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._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=is(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Ut.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};var Vt=Ut;var jt=class qt extends A{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=b("textureSource"),this._resourceType="textureSource",this._resourceId=b("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.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...qt.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Vt(zt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}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){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=b("resource"),this.emit("change",this),this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{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,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=b("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=_t(this.pixelWidth)&&_t(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};jt.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};var B=jt;var V=class extends B{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),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}};V.extension=mt.TextureSource;var Kt=new I,it=class{constructor(t,e){this.mapCoord=new I,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture?.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);let i=this.mapCoord;for(let r=0;r<t.length;r+=2){let n=t[r],o=t[r+1];e[r]=n*i.a+o*i.c+i.tx,e[r+1]=n*i.b+o*i.d+i.ty}return e}update(){let t=this._texture;this._updateID++;let 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);let i=t.orig,r=t.trim;r&&(Kt.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Kt));let n=t.source,o=this.uClampFrame,h=this.clampMargin/n._resolution,a=this.clampOffset/n._resolution;return o[0]=(t.frame.x+h+a)/n.width,o[1]=(t.frame.y+h+a)/n.height,o[2]=(t.frame.x+t.frame.width-h+a)/n.width,o[3]=(t.frame.y+t.frame.height-h+a)/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}};var R=class extends A{constructor({source:t,label:e,frame:i,orig:r,trim:n,defaultAnchor:o,defaultBorders:h,rotate:a,dynamic:u}={}){if(super(),this.uid=b("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new G,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new B,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:f,height:c}=this._source;this.frame.width=f,this.frame.height=c}this.orig=r||this.frame,this.trim=n,this.rotate=a??0,this.defaultAnchor=o,this.defaultBorders=h,this.destroyed=!1,this.dynamic=u||!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 it(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:r}=this._source,n=e.x/i,o=e.y/r,h=e.width/i,a=e.height/r,u=this.rotate;if(u){let f=h/2,c=a/2,d=n+f,l=o+c;u=x.add(u,x.NW),t.x0=d+f*x.uX(u),t.y0=l+c*x.uY(u),u=x.add(u,2),t.x1=d+f*x.uX(u),t.y1=l+c*x.uY(u),u=x.add(u,2),t.x2=d+f*x.uX(u),t.y2=l+c*x.uY(u),u=x.add(u,2),t.x3=d+f*x.uX(u),t.y3=l+c*x.uY(u)}else t.x0=n,t.y0=o,t.x1=n+h,t.y1=o,t.x2=n+h,t.y2=o+a,t.x3=n,t.y3=o+a}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),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 U(st,"Texture.baseTexture is now Texture.source"),this._source}};R.EMPTY=new R({label:"EMPTY",source:new B({label:"EMPTY"})});R.EMPTY.destroy=bt;R.WHITE=new R({source:new V({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});R.WHITE.destroy=bt;var rt=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(rt||{});var rs={grad:.9,turn:360,rad:360/(2*Math.PI)},X=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},_=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},E=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},re=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Jt=function(s){return{r:E(s.r,0,255),g:E(s.g,0,255),b:E(s.b,0,255),a:E(s.a)}},wt=function(s){return{r:_(s.r),g:_(s.g),b:_(s.b),a:_(s.a,3)}},ns=/^#([0-9a-f]{3,8})$/i,nt=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},ne=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),h=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(h<0?h+6:h),s:n?o/n*100:0,v:n/255*100,a:r}},oe=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),h=i*(1-(t-n)*e),a=i*(1-(1-t+n)*e),u=n%6;return{r:255*[i,h,o,o,a,i][u],g:255*[a,i,i,h,o,o][u],b:255*[o,o,a,i,i,h][u],a:r}},Zt=function(s){return{h:re(s.h),s:E(s.s,0,100),l:E(s.l,0,100),a:E(s.a)}},Qt=function(s){return{h:_(s.h),s:_(s.s),l:_(s.l),a:_(s.a,3)}},te=function(s){return oe((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},j=function(s){return{h:(t=ne(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},os=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hs=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,as=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,us=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,At={string:[[function(s){var t=ns.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?_(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?_(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=as.exec(s)||us.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Jt({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(s){var t=os.exec(s)||hs.exec(s);if(!t)return null;var e,i,r=Zt({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(rs[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return te(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return X(t)&&X(e)&&X(i)?Jt({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!X(t)||!X(e)||!X(i))return null;var o=Zt({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return te(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!X(t)||!X(e)||!X(i))return null;var o=(function(h){return{h:re(h.h),s:E(h.s,0,100),v:E(h.v,0,100),a:E(h.a)}})({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return oe(o)},"hsv"]]},ee=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},cs=function(s){return typeof s=="string"?ee(s.trim(),At.string):typeof s=="object"&&s!==null?ee(s,At.object):[null,void 0]};var Mt=function(s,t){var e=j(s);return{h:e.h,s:E(e.s+100*t,0,100),l:e.l,a:e.a}},vt=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},se=function(s,t){var e=j(s);return{h:e.h,s:e.s,l:E(e.l+100*t,0,100),a:e.a}},Et=(function(){function s(t){this.parsed=cs(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return _(vt(this.rgba),2)},s.prototype.isDark=function(){return vt(this.rgba)<.5},s.prototype.isLight=function(){return vt(this.rgba)>=.5},s.prototype.toHex=function(){return t=wt(this.rgba),e=t.r,i=t.g,r=t.b,o=(n=t.a)<1?nt(_(255*n)):"","#"+nt(e)+nt(i)+nt(r)+o;var t,e,i,r,n,o},s.prototype.toRgb=function(){return wt(this.rgba)},s.prototype.toRgbString=function(){return t=wt(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return Qt(j(this.rgba))},s.prototype.toHslString=function(){return t=Qt(j(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=ne(this.rgba),{h:_(t.h),s:_(t.s),v:_(t.v),a:_(t.a,3)};var t},s.prototype.invert=function(){return S({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),S(Mt(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),S(Mt(this.rgba,-t))},s.prototype.grayscale=function(){return S(Mt(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),S(se(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),S(se(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?S({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):_(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=j(this.rgba);return typeof t=="number"?S({h:t,s:e.s,l:e.l,a:e.a}):_(e.h)},s.prototype.isEqual=function(t){return this.toHex()===S(t).toHex()},s})(),S=function(s){return s instanceof Et?s:new Et(s)},ie=[],he=function(s){s.forEach(function(t){ie.indexOf(t)<0&&(t(Et,At),ie.push(t))})};function ae(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var h,a,u=i[this.toHex()];if(u)return u;if(o?.closest){var f=this.toRgb(),c=1/0,d="black";if(!n.length)for(var l in e)n[l]=new s(e[l]).toRgb();for(var p in e){var y=(h=f,a=n[p],Math.pow(h.r-a.r,2)+Math.pow(h.g-a.g,2)+Math.pow(h.b-a.b,2));y<c&&(c=y,d=p)}return d}},t.string.push([function(o){var h=o.toLowerCase(),a=h==="transparent"?"#0000":e[h];return a?new s(a).toRgb():null},"name"])}he([ae]);var $=class q{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 q)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?{...t}:t}_isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((n,o)=>n===e[o]);if(t!==null&&e!==null){let n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(h=>t[h]===e[h])}return t===e}toRgba(){let[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,r,n]=q._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let h=q.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}let o=S(t);o.isValid()&&({r:e,g:i,b:r,a:n}=o.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof q||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}};$.shared=new $;$._temp=new $;$.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var bi=$;var Pt=0,ue=500;function wi(...s){Pt!==ue&&(Pt++,Pt===ue?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}var ce={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)},release(){this._registeredResources.forEach(s=>s.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(s){return this._registeredResources.has(s)},reset(){this._registeredResources.clear()}};var ot=class{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){let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}};var Yt=class{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 ot(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}},fs=new Yt;ce.register(fs);var fe=new I,ht=class s{constructor(t=1/0,e=1/0,i=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=fe,this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new G);let 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=fe,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);let o=n.a,h=n.b,a=n.c,u=n.d,f=n.tx,c=n.ty,d=this.minX,l=this.minY,p=this.maxX,y=this.maxY,m=o*t+a*e+f,g=h*t+u*e+c;m<d&&(d=m),g<l&&(l=g),m>p&&(p=m),g>y&&(y=g),m=o*i+a*e+f,g=h*i+u*e+c,m<d&&(d=m),g<l&&(l=g),m>p&&(p=m),g>y&&(y=g),m=o*t+a*r+f,g=h*t+u*r+c,m<d&&(d=m),g<l&&(l=g),m>p&&(p=m),g>y&&(y=g),m=o*i+a*r+f,g=h*i+u*r+c,m<d&&(d=m),g<l&&(l=g),m>p&&(p=m),g>y&&(y=g),this.minX=d,this.minY=l,this.maxX=p,this.maxY=y}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){let e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,{a:o,b:h,c:a,d:u,tx:f,ty:c}=t,d=o*e+a*i+f,l=h*e+u*i+c;this.minX=d,this.minY=l,this.maxX=d,this.maxY=l,d=o*r+a*i+f,l=h*r+u*i+c,this.minX=d<this.minX?d:this.minX,this.minY=l<this.minY?l:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=l>this.maxY?l:this.maxY,d=o*e+a*n+f,l=h*e+u*n+c,this.minX=d<this.minX?d:this.minX,this.minY=l<this.minY?l:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=l>this.maxY?l:this.maxY,d=o*r+a*n+f,l=h*r+u*n+c,this.minX=d<this.minX?d:this.minX,this.minY=l<this.minY?l:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=l>this.maxY?l: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,i,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>r&&(this.maxY=r),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 s(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){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let 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,i,r){let n=this.minX,o=this.minY,h=this.maxX,a=this.maxY;r||(r=this.matrix);let u=r.a,f=r.b,c=r.c,d=r.d,l=r.tx,p=r.ty;for(let y=e;y<i;y+=2){let m=t[y],g=t[y+1],v=u*m+c*g+l,Y=f*m+d*g+p;n=v<n?v:n,o=Y<o?Y:o,h=v>h?v:h,a=Y>a?Y:a}this.minX=n,this.minY=o,this.maxX=h,this.maxY=a}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}};function Xi(s,t){if(s===16777215||!t)return t;if(t===16777215||!s)return s;let e=s>>16&255,i=s>>8&255,r=s&255,n=t>>16&255,o=t>>8&255,h=t&255,a=e*n/255|0,u=i*o/255|0,f=r*h/255|0;return(a<<16)+(u<<8)+f}var de={createCanvas:(s,t)=>{let e=document.createElement("canvas");return e.width=s,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};var le=de,me={get(){return le},set(s){le=s}};var Ct=Object.create(null),pe=Object.create(null);function W(s,t){let e=pe[s];return e===void 0&&(Ct[t]===void 0&&(Ct[t]=1),pe[s]=e=Ct[t]++),e}var at;function ge(){return(!at||at?.isContextLost())&&(at=me.get().createCanvas().getContext("webgl",{})),at}var ut;function ye(){if(!ut){ut="mediump";let s=ge();s&&s.getShaderPrecisionFormat&&(ut=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return ut}function xe(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),`
#ifdef GL_ES // This checks if it is WebGL1
#define in varying
#define finalColor gl_FragColor
#define texture texture2D
#endif
${s}
`):`
#ifdef GL_ES // This checks if it is WebGL1
#define in attribute
#define out varying
#endif
${s}
`}function be(s,t,e){let i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let r=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float;
${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function _e(s,t){return t?`#version 300 es
${s}`:s}var ds={},ls={};function we(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let i=e?ds:ls;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`}
${s}`}function Me(s,t){return t?s.replace("#version 300 es",""):s}var It={stripVersion:Me,ensurePrecision:be,addProgramDefines:xe,setProgramName:we,insertVersion:_e},K=Object.create(null),ve=class St{constructor(t){t={...St.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:ye()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},r=t.fragment,n=t.vertex;Object.keys(It).forEach(o=>{let h=i[o];r=It[o](r,h,!0),n=It[o](n,h,!1)}),this.fragment=r,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=W(`${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,K[this._cacheKey]=null}static from(t){let e=`${t.vertex}:${t.fragment}`;return K[e]||(K[e]=new St(t),K[e]._cacheKey=e),K[e]}};ve.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};var Ae=ve;var Ee={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 Pe(s){return Ee[s]??Ee.float32}var z=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){