@vaaal/vv-pixi-test 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1619
- package/dist/services.js +86 -284
- package/package.json +1 -1
- package/src/index.js +2 -947
package/dist/index.js
CHANGED
|
@@ -1,1619 +1 @@
|
|
|
1
|
-
(()=>{var BT=Object.create;var wl=Object.defineProperty;var RT=Object.getOwnPropertyDescriptor;var FT=Object.getOwnPropertyNames;var GT=Object.getPrototypeOf,IT=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var ar=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),bd=(i,t)=>{for(var e in t)wl(i,e,{get:t[e],enumerable:!0})},kT=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of FT(t))!IT.call(i,s)&&s!==e&&wl(i,s,{get:()=>t[s],enumerable:!(r=RT(t,s))||r.enumerable});return i};var Pl=(i,t,e)=>(e=i!=null?BT(GT(i)):{},kT(t||!i||!i.__esModule?wl(e,"default",{value:i,enumerable:!0}):e,i));var g,Cl,ln,U,P=p(()=>{"use strict";g=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(g||{}),Cl=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},ln=(i,t)=>Cl(i).priority??t,U={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Cl).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Cl).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>ln(n.value,e)-ln(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>ln(o,e)-ln(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var Td=ar((IC,El)=>{"use strict";var UT=Object.prototype.hasOwnProperty,Wt="~";function as(){}Object.create&&(as.prototype=Object.create(null),new as().__proto__||(Wt=!1));function DT(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function vd(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new DT(e,r||i,s),n=Wt?Wt+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function cn(i,t){--i._eventsCount===0?i._events=new as:delete i._events[t]}function zt(){this._events=new as,this._eventsCount=0}zt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)UT.call(e,r)&&t.push(Wt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};zt.prototype.listeners=function(t){var e=Wt?Wt+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};zt.prototype.listenerCount=function(t){var e=Wt?Wt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};zt.prototype.emit=function(t,e,r,s,o,n){var a=Wt?Wt+t:t;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,s),!0;case 5:return l.fn.call(l.context,e,r,s,o),!0;case 6:return l.fn.call(l.context,e,r,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(t,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,e);break;case 3:l[h].fn.call(l[h].context,e,r);break;case 4:l[h].fn.call(l[h].context,e,r,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};zt.prototype.on=function(t,e,r){return vd(this,t,e,r,!1)};zt.prototype.once=function(t,e,r){return vd(this,t,e,r,!0)};zt.prototype.removeListener=function(t,e,r,s){var o=Wt?Wt+t:t;if(!this._events[o])return this;if(!e)return cn(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&cn(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:cn(this,o)}return this};zt.prototype.removeAllListeners=function(t){var e;return t?(e=Wt?Wt+t:t,this._events[e]&&cn(this,e)):(this._events=new as,this._eventsCount=0),this};zt.prototype.off=zt.prototype.removeListener;zt.prototype.addListener=zt.prototype.on;zt.prefixed=Wt;zt.EventEmitter=zt;typeof El<"u"&&(El.exports=zt)});var Sd,at,Nt=p(()=>{Sd=Pl(Td(),1),at=Sd.default});var OT,Xe,kt,he,Rd,wd,Al,LT,un,Fd,Gd,Pd,Cd,Ed,ls,NT,zT,HT,WT,Rl,Ad,VT,Ml,Bl,Md,Fl,ye,Bd,Id,kd=p(()=>{OT={grad:.9,turn:360,rad:360/(2*Math.PI)},Xe=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},kt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},he=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Rd=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},wd=function(i){return{r:he(i.r,0,255),g:he(i.g,0,255),b:he(i.b,0,255),a:he(i.a)}},Al=function(i){return{r:kt(i.r),g:kt(i.g),b:kt(i.b),a:kt(i.a,3)}},LT=/^#([0-9a-f]{3,8})$/i,un=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Fd=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Gd=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),l=r*(1-(1-t+o)*e),c=o%6;return{r:255*[r,a,n,n,l,r][c],g:255*[l,r,r,a,n,n][c],b:255*[n,n,l,r,r,a][c],a:s}},Pd=function(i){return{h:Rd(i.h),s:he(i.s,0,100),l:he(i.l,0,100),a:he(i.a)}},Cd=function(i){return{h:kt(i.h),s:kt(i.s),l:kt(i.l),a:kt(i.a,3)}},Ed=function(i){return Gd((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},ls=function(i){return{h:(t=Fd(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},NT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,HT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,WT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rl={string:[[function(i){var t=LT.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?kt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?kt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=HT.exec(i)||WT.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:wd({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(i){var t=NT.exec(i)||zT.exec(i);if(!t)return null;var e,r,s=Pd({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(OT[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ed(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Xe(t)&&Xe(e)&&Xe(r)?wd({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Xe(t)||!Xe(e)||!Xe(r))return null;var n=Pd({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Ed(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Xe(t)||!Xe(e)||!Xe(r))return null;var n=function(a){return{h:Rd(a.h),s:he(a.s,0,100),v:he(a.v,0,100),a:he(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Gd(n)},"hsv"]]},Ad=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},VT=function(i){return typeof i=="string"?Ad(i.trim(),Rl.string):typeof i=="object"&&i!==null?Ad(i,Rl.object):[null,void 0]},Ml=function(i,t){var e=ls(i);return{h:e.h,s:he(e.s+100*t,0,100),l:e.l,a:e.a}},Bl=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},Md=function(i,t){var e=ls(i);return{h:e.h,s:e.s,l:he(e.l+100*t,0,100),a:e.a}},Fl=function(){function i(t){this.parsed=VT(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return kt(Bl(this.rgba),2)},i.prototype.isDark=function(){return Bl(this.rgba)<.5},i.prototype.isLight=function(){return Bl(this.rgba)>=.5},i.prototype.toHex=function(){return t=Al(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?un(kt(255*o)):"","#"+un(e)+un(r)+un(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return Al(this.rgba)},i.prototype.toRgbString=function(){return t=Al(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return Cd(ls(this.rgba))},i.prototype.toHslString=function(){return t=Cd(ls(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=Fd(this.rgba),{h:kt(t.h),s:kt(t.s),v:kt(t.v),a:kt(t.a,3)};var t},i.prototype.invert=function(){return ye({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),ye(Ml(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ye(Ml(this.rgba,-t))},i.prototype.grayscale=function(){return ye(Ml(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ye(Md(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ye(Md(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?ye({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):kt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=ls(this.rgba);return typeof t=="number"?ye({h:t,s:e.s,l:e.l,a:e.a}):kt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ye(t).toHex()},i}(),ye=function(i){return i instanceof Fl?i:new Fl(i)},Bd=[],Id=function(i){i.forEach(function(t){Bd.indexOf(t)<0&&(t(Fl,Rl),Bd.push(t))})}});function Ud(i,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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(n?.closest){var u=this.toRgb(),h=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var m in e){var _=(a=u,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_<h&&(h=_,d=m)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new i(l).toRgb():null},"name"])}var Dd=p(()=>{});var ei,$,Ht=p(()=>{kd();Dd();Id([Ud]);ei=class cs{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 cs)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 r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="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((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=cs._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,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 r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}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}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=cs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=ye(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof cs||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}};ei.shared=new ei;ei._temp=new ei;ei.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;$=ei});var Od,Ld=p(()=>{"use strict";Od={cullArea:null,cullable:!1,cullableChildren:!0}});var Nd,zd,Hd,Gl=p(()=>{"use strict";Nd=Math.PI*2,zd=180/Math.PI,Hd=Math.PI/180});var Q,Il,be=p(()=>{"use strict";Q=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(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 Il.x=0,Il.y=0,Il}},Il=new Q});var B,XT,YT,Z=p(()=>{Gl();be();B=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new Q;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new Q;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,c=1/(r*n+o*-s),u=t.x,h=t.y;return e.x=n*c*u+-o*c*h+(l*o-a*n)*c,e.y=r*c*h+-s*c*u+(-l*r+a*s)*c,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),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,c=e.a,u=e.b,h=e.c,d=e.d;return this.a=r*c+s*h,this.b=r*u+s*d,this.c=o*c+n*h,this.d=o*u+n*d,this.tx=a*c+l*h+e.tx,this.ty=a*u+l*d+e.ty,this}setTransform(t,e,r,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(r,e),c=Math.abs(a+l);return c<1e-5||Math.abs(Nd-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,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 i;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 YT.identity()}static get shared(){return XT.identity()}},XT=new B,YT=new B});var Ut,kl=p(()=>{"use strict";Ut=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(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}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}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 Y(i="default"){return Ul[i]===void 0&&(Ul[i]=-1),++Ul[i]}var Ul,Gt=p(()=>{"use strict";Ul={default:-1}});var Wd,V,Dl,ri,O,pt=p(()=>{"use strict";Wd=new Set,V="8.0.0",Dl="8.3.4",ri={quiet:!1,noColor:!1},O=(i,t,e=3)=>{if(ri.quiet||Wd.has(t))return;let r=new Error().stack,s=`${t}
|
|
2
|
-
Deprecated since v${i}`,o=typeof console.groupCollapsed=="function"&&!ri.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",s):(r=r.split(`
|
|
3
|
-
`).splice(e).join(`
|
|
4
|
-
`),o?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),Wd.add(t)};Object.defineProperties(O,{quiet:{get:()=>ri.quiet,set:i=>{ri.quiet=i},enumerable:!0,configurable:!1},noColor:{get:()=>ri.noColor,set:i=>{ri.noColor=i},enumerable:!0,configurable:!1}})});function k(...i){Ol!==Vd&&(Ol++,Ol===Vd?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var Ol,Vd,st=p(()=>{"use strict";Ol=0,Vd=500});var de,Ar=p(()=>{"use strict";de={_registeredResources:new Set,register(i){this._registeredResources.add(i)},unregister(i){this._registeredResources.delete(i)},release(){this._registeredResources.forEach(i=>i.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(i){return this._registeredResources.has(i)},reset(){this._registeredResources.clear()}}});var hn,Xd=p(()=>{"use strict";hn=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,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 Ll,lt,Ae=p(()=>{Ar();Xd();Ll=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 hn(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}},lt=new Ll;de.register(lt)});var Yd,jd=p(()=>{pt();Yd={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){O("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function dn(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var Nl=p(()=>{"use strict"});var $d,qd=p(()=>{Nl();pt();$d={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}dn(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||O(V,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i},replaceChild(i,t){i.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(i)),t.setFromMatrix(i.localTransform),t.updateLocalTransform(),this.removeChild(i)}}});var Kd,Zd=p(()=>{"use strict";Kd={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var Ye,fn=p(()=>{"use strict";Ye=class{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}}});var zl,pn,Qd=p(()=>{P();Ae();zl=class{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++){let r=this._tests[e];if(r.test(t))return lt.get(r.maskClass,t)}return t}returnMaskEffect(t){lt.return(t)}},pn=new zl;U.handleByList(g.MaskEffect,pn._effectClasses)});var Jd,tf=p(()=>{fn();Qd();Jd={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),pn.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=pn.getMaskEffect(i),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Ye);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Ye),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var ef,rf=p(()=>{pt();ef={label:null,get name(){return O(V,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){O(V,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var mn,X,It=p(()=>{be();mn=[new Q,new Q,new Q,new Q],X=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}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 i(0,0,0,0)}clone(){return new i(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,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,c=r*(1-s),u=r-c,h=a-c,d=a+o+c,f=l-c,m=l+n+c,_=a+u,x=a+o-u,y=l+u,b=l+n-u;return t>=h&&t<=d&&e>=f&&e<=m&&!(t>_&&t<x&&e>y&&e<b)}intersects(t,e){if(!e){let G=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=G)return!1;let M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=mn[0].set(t.left,t.top),l=mn[1].set(t.left,t.bottom),c=mn[2].set(t.right,t.top),u=mn[3].set(t.right,t.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(a,a),e.apply(l,l),e.apply(c,c),e.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=r||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),m=d*r+f*o,_=d*s+f*o,x=d*r+f*n,y=d*s+f*n;if(Math.max(m,_,x,y)<=d*a.x+f*a.y||Math.min(m,_,x,y)>=d*u.x+f*u.y)return!1;let b=h*(a.y-c.y),v=h*(c.x-a.x),T=b*r+v*o,E=b*s+v*o,S=b*r+v*n,w=b*s+v*n;return!(Math.max(T,E,S,w)<=b*a.x+v*a.y||Math.min(T,E,S,w)>=b*u.x+v*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-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),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}set(t,e,r,s){return this.x=t,this.y=e,this.width=r,this.height=s,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var sf,ct,Jt=p(()=>{Z();It();sf=new B,ct=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=sf,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new X);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=sf,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,u=o.tx,h=o.ty,d=this.minX,f=this.minY,m=this.maxX,_=this.maxY,x=n*t+l*e+u,y=a*t+c*e+h;x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>_&&(_=y),x=n*r+l*e+u,y=a*r+c*e+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>_&&(_=y),x=n*t+l*s+u,y=a*t+c*s+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>_&&(_=y),x=n*r+l*s+u,y=a*r+c*s+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>_&&(_=y),this.minX=d,this.minY=f,this.maxX=m,this.maxY=_}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,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:u,ty:h}=t,d=n*e+l*r+u,f=a*e+c*r+h;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*r+u,f=a*s+c*r+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+l*o+u,f=a*e+c*o+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+u,f=a*s+c*o+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f: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,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),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 i(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,r,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,u=s.b,h=s.c,d=s.d,f=s.tx,m=s.ty;for(let _=e;_<r;_+=2){let x=t[_],y=t[_+1],b=c*x+h*y+f,v=u*x+d*y+m;o=b<o?b:o,n=v<n?v:n,a=b>a?b:a,l=v>l?v:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}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 Mt,ae,Mr=p(()=>{Z();Ae();Jt();Mt=lt.getPool(B),ae=lt.getPool(ct)});var jT,of,nf=p(()=>{Z();Jt();Mr();jT=new B,of={getFastGlobalBounds(i,t){t||(t=new ct),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=ae.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&r.applyMatrix(n.worldTransform.copyTo(jT).invert()),t.addBounds(r),ae.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),ae.return(r))}}});function ii(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=Mt.get().identity(),r=gn(i,s)):r=B.IDENTITY,af(i,e,r,t),s&&Mt.return(s),e.isValid||e.set(0,0,0,0),e}function af(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=Mt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=ae.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{let a=i.bounds;a&&!a.isEmpty()&&(t.matrix=s,t.addBounds(a));for(let l=0;l<i.children.length;l++)af(i.children[l],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,B.IDENTITY),ae.return(t)}r||Mt.return(s)}function gn(i,t){let e=i.parent;return e&&(gn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var us=p(()=>{Z();Mr()});function xn(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,c=r*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var Hl=p(()=>{"use strict"});function si(i,t){return i===lf?t:t===lf?i:xn(i,t)}var lf,Wl=p(()=>{Hl();lf=16777215});function hs(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var cf,uf=p(()=>{Z();us();Mr();Wl();cf={getGlobalAlpha(i){if(i)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(i=new B,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=gn(this,Mt.get().identity());return i.appendFrom(this.localTransform,e),Mt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?hs(this.renderGroup.worldColor):this.parentRenderGroup?hs(si(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=si(t,e.localColor),e=e.parent;return hs(t)}}});function oi(i,t,e){return t.clear(),e||(e=B.IDENTITY),hf(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function hf(i,t,e,r,s){let o;if(s)o=Mt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let l=i.localTransform;o=Mt.get(),o.appendFrom(l,e)}let n=t,a=!!i.effects.length;if(a&&(t=ae.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let l=i.children;for(let c=0;c<l.length;c++)hf(l[c],t,o,r,!1)}if(a){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(t,r);n.addBounds(t,B.IDENTITY),ae.return(t)}Mt.return(o)}var _n=p(()=>{Z();Mr()});function Vl(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&Vl(s,t)}return t.didChange}var df=p(()=>{"use strict"});var $T,ff,pf=p(()=>{Z();Jt();us();_n();df();$T=new B,ff={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new ct});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),Vl(this,i),i.didChange&&oi(this,i.localBounds,$T),i.localBounds},getBounds(i,t){return ii(this,i,t||new ct)}}});var mf,gf=p(()=>{"use strict";mf={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function qT(i,t){return i._zIndex-t._zIndex}var xf,_f=p(()=>{"use strict";xf={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,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(qT))}}});var yf,bf=p(()=>{be();Mr();yf={getGlobalPosition(i=new Q,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(Mt.get(),e);return t=r.apply(i,t),Mt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(Mt.get(),r);return e=s.applyInverse(i,e),Mt.return(s),e}}});var ni,Xl=p(()=>{Gt();ni=class{constructor(){this.uid=Y("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function je(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Yl(i){return!(i&i-1)&&!!i}var ds=p(()=>{"use strict"});function yn(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var jl=p(()=>{"use strict"});function KT(i){let t=vf[i];return t===void 0&&(vf[i]=Y("resource")),t}var vf,Tf,te,Br=p(()=>{Nt();Gt();pt();vf=Object.create(null);Tf=class Sf extends at{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Sf.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){O(V,"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.emit("change",this),this._sharedResourceId=null}_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=KT(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Tf.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};te=Tf});var wf,et,Vt=p(()=>{Nt();ds();jl();Gt();Br();wf=class Pf extends at{constructor(t={}){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={...Pf.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.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new te(yn(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.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(){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,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,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=Yl(this.pixelWidth)&&Yl(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};wf.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};et=wf});function ZT(){for(let i=0;i<16;i++){let t=[];$l.push(t);for(let e=0;e<16;e++){let r=bn(Rr[i]*Rr[e]+Gr[i]*Fr[e]),s=bn(Fr[i]*Rr[e]+Ir[i]*Fr[e]),o=bn(Rr[i]*Gr[e]+Gr[i]*Ir[e]),n=bn(Fr[i]*Gr[e]+Ir[i]*Ir[e]);for(let a=0;a<16;a++)if(Rr[a]===r&&Fr[a]===s&&Gr[a]===o&&Ir[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(Rr[i],Fr[i],Gr[i],Ir[i],0,0),Cf.push(t)}}var Rr,Fr,Gr,Ir,$l,Cf,bn,nt,ql=p(()=>{Z();Rr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Fr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Gr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ir=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],$l=[],Cf=[],bn=Math.sign;ZT();nt={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:i=>Rr[i],uY:i=>Fr[i],vX:i=>Gr[i],vY:i=>Ir[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>$l[i][t],sub:(i,t)=>$l[i][nt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?nt.S:nt.N:Math.abs(t)*2<=Math.abs(i)?i>0?nt.E:nt.W:t>0?i>0?nt.SE:nt.SW:i>0?nt.NE:nt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Cf[nt.inv(t)];s.tx=e,s.ty=r,i.append(s)},transformRectCoords:(i,t,e,r)=>{let{x:s,y:o,width:n,height:a}=i,{x:l,y:c,width:u,height:h}=t;return e===nt.E?(r.set(s+l,o+c,n,a),r):e===nt.S?r.set(u-o-a+l,s+c,a,n):e===nt.W?r.set(u-s-n+l,h-o-a+c,n,a):e===nt.N?r.set(o+l,h-s-n+c,a,n):r.set(s+l,o+c,n,a)}}});var Kl,Ef=p(()=>{"use strict";Kl=()=>{}});var kr,Zl=p(()=>{P();Vt();kr=class extends et{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}};kr.extension=g.TextureSource});var Af,ai,Ql=p(()=>{Z();Af=new B,ai=class{constructor(t,e){this.mapCoord=new B,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,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 r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.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 r=t.orig,s=t.trim;s&&(Af.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Af));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var A,rt=p(()=>{Nt();ql();It();Gt();pt();Ef();Zl();Vt();Ql();A=class extends at{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic: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 X,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new et,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!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 ai(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,l=e.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=nt.add(c,nt.NW),t.x0=d+u*nt.uX(c),t.y0=f+h*nt.uY(c),c=nt.add(c,2),t.x1=d+u*nt.uX(c),t.y1=f+h*nt.uY(c),c=nt.add(c,2),t.x2=d+u*nt.uX(c),t.y2=f+h*nt.uY(c),c=nt.add(c,2),t.x3=d+u*nt.uX(c),t.y3=f+h*nt.uY(c)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l}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 O(V,"Texture.baseTexture is now Texture.source"),this._source}};A.EMPTY=new A({label:"EMPTY",source:new et({label:"EMPTY"})});A.EMPTY.destroy=Kl;A.WHITE=new A({source:new kr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});A.WHITE.destroy=Kl});var QT,vn,ot,$e=p(()=>{ds();Ar();Vt();rt();Br();QT=0,vn=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new te(this.textureOptions)}createTexture(t,e,r){let s=new et({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new A({source:s,label:`texturePool_${QT++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=je(o),n=je(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=r,l.source.width=o/r,l.source.height=n/r,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=!1){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},ot=new vn;de.register(ot)});var Ur,Jl=p(()=>{Z();Xl();$e();Ur=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,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 ni,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ot.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;let t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let 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){let 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);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}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=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return this._matrixDirty&1?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return this._matrixDirty&2?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),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;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new B),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function Mf(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var Bf=p(()=>{"use strict"});var tc,Tn,ec,Sn,li,fs,Dr,dt,ve=p(()=>{Nt();Ht();Ld();P();Z();Gl();kl();Gt();pt();st();Ae();jd();qd();Zd();tf();rf();nf();uf();pf();gf();_f();bf();Jl();Bf();tc=new Ut(null),Tn=new Ut(null),ec=new Ut(null,1,1),Sn=new Ut(null),li=1,fs=2,Dr=4,dt=class i extends at{constructor(t={}){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.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ut(this,0,0),this._scale=ec,this._pivot=Tn,this._origin=Sn,this._skew=tc,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=[],Mf(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){O("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),U.mixin(i,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(this.allowChildren||O(V,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.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,r&&r.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 s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,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,r),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;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=lt.get(Ur,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),lt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new B),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*zd}set angle(t){this.rotation=t*Hd}get pivot(){return this._pivot===Tn&&(this._pivot=new Ut(this,0,0)),this._pivot}set pivot(t){this._pivot===Tn&&(this._pivot=new Ut(this,0,0),this._origin!==Sn&&k("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===tc&&(this._skew=new Ut(this,0,0)),this._skew}set skew(t){this._skew===tc&&(this._skew=new Ut(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===ec&&(this._scale=new Ut(this,1,1)),this._scale}set scale(t){this._scale===ec&&(this._scale=new Ut(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===Sn&&(this._origin=new Ut(this,0,0)),this._origin}set origin(t){this._origin===Sn&&(this._origin=new Ut(this,0,0),this._pivot!==Tn&&k("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let 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){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let 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.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._origin,n=this._position,a=r._x,l=r._y,c=s._x,u=s._y,h=-o._x,d=-o._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*l,e.d=this._sy*l,e.tx=n._x-(c*e.a+u*e.c)+(h*e.a+d*e.c)-h,e.ty=n._y-(c*e.b+u*e.d)+(h*e.b+d*e.d)-d}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=li,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=$.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=li,this._onUpdate())}get tint(){return hs(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=fs,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Dr,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Dr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Dr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=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._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};U.mixin(dt,$d,of,yf,mf,ff,Jd,ef,xf,Od,Yd,cf,Kd)});var fe,ci=p(()=>{"use strict";fe=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(fe||{})});var ui,Rf=p(()=>{"use strict";ui=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.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);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var Ff,xt,Or=p(()=>{ci();Rf();Ff=class le{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 ui(null,null,1/0),this.deltaMS=1/le.targetFPMS,this.elapsedMS=1/le.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,r=fe.NORMAL){return this._addListener(new ui(t,e,r))}addOnce(t,e,r=fe.NORMAL){return this._addListener(new ui(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*le.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.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){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,le.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!le._shared){let t=le._shared=new le;t.autoStart=!0,t._protected=!0}return le._shared}static get system(){if(!le._system){let t=le._system=new le;t.autoStart=!0,t._protected=!0}return le._system}};Ff.targetFPMS=.06;xt=Ff});var hi,rc=p(()=>{ci();Or();hi=class{constructor(t){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),r=this._canvas.width,s=this._canvas.height,o=e.width/r*this._renderer.resolution,n=e.height/s*this._renderer.resolution,a=e.left,l=e.top,c=`translate(${a}px, ${l}px) scale(${o}, ${n})`;c!==this._lastTransform&&(this._domElement.style.transform=c,this._lastTransform=c)},this._domElement=t.domElement,this._renderer=t.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(t=>{for(let e of t){if(e.target!==this._canvas)continue;let r=this.canvas.width,s=this.canvas.height,o=e.contentRect.width/r*this._renderer.resolution,n=e.contentRect.height/s*this._renderer.resolution;(this._lastScaleX!==o||this._lastScaleY!==n)&&(this.updateTranslation(),this._lastScaleX=o,this._lastScaleY=n)}}),this._observer.observe(this._canvas)):this._tickerAttached||xt.shared.add(this.updateTranslation,this,fe.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&xt.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}});var lr,wn=p(()=>{be();lr=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Q,this.page=new Q,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function JT(i){return function(t){return t.test(i)}}function ps(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=JT(e),o={apple:{phone:s(ic)&&!s(qe),ipod:s(Gf),tablet:!s(ic)&&(s(If)||Wf(t))&&!s(qe),universal:s(kf),device:(s(ic)||s(Gf)||s(If)||s(kf)||Wf(t))&&!s(qe)},amazon:{phone:s(di),tablet:!s(di)&&s(Pn),device:s(di)||s(Pn)},android:{phone:!s(qe)&&s(di)||!s(qe)&&s(sc),tablet:!s(qe)&&!s(di)&&!s(sc)&&(s(Pn)||s(Uf)),device:!s(qe)&&(s(di)||s(Pn)||s(sc)||s(Uf))||s(/\bokhttp\b/i)},windows:{phone:s(qe),tablet:s(Df),device:s(qe)||s(Df)},other:{blackberry:s(Of),blackberry10:s(Lf),opera:s(Nf),firefox:s(Hf),chrome:s(zf),device:s(Of)||s(Lf)||s(Nf)||s(Hf)||s(zf)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var ic,Gf,If,kf,sc,Uf,di,Pn,qe,Df,Of,Lf,Nf,zf,Hf,Wf,oc=p(()=>{ic=/iPhone/i,Gf=/iPod/i,If=/iPad/i,kf=/\biOS-universal(?:.+)Mac\b/i,sc=/\bAndroid(?:.+)Mobile\b/i,Uf=/Android/i,di=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Pn=/Silk/i,qe=/Windows Phone/i,Df=/\bWindows(?:.+)ARM\b/i,Of=/BlackBerry/i,Lf=/BB10/i,Nf=/Opera Mini/i,zf=/\b(CriOS|Chrome)(?:.+)Mobile/i,Hf=/Mobile(?:.+)Firefox\b/i,Wf=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Vf=p(()=>{oc();oc()});var tS,Xf,Yf=p(()=>{Vf();tS=ps.default??ps,Xf=tS(globalThis.navigator)});var eS,jf,rS,iS,$f,qf,sS,oS,nS,nc,Zf,Qf=p(()=>{rc();wn();P();Yf();Nl();eS=9,jf=100,rS=0,iS=0,$f=2,qf=1,sS=-1e3,oS=-1e3,nS=2,nc=class Kf{constructor(t,e=Xf){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){let t=document.createElement("button");t.style.width=`${qf}px`,t.style.height=`${qf}px`,t.style.position="absolute",t.style.top=`${sS}px`,t.style.left=`${oS}px`,t.style.zIndex=nS.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${rS}px`,this._div.style.left=`${iS}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=$f.toString(),this._canvasObserver=new hi({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);let t=this._renderer.view.canvas;if(t.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(e.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;for(let t in this._pools)this._pools[t].forEach(r=>{r.parentNode&&r.parentNode.removeChild(r)}),delete this._pools[t];this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...Kf.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._getPool(s.accessibleType).push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,dn(this._children,r,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform;o.style.left=`${a.tx+n.x*a.a}px`,o.style.top=`${a.ty+n.y*a.d}px`,o.style.width=`${n.width*a.a}px`,o.style.height=`${n.height*a.d}px`}else this._capHitArea(n),o.style.left=`${n.x}px`,o.style.top=`${n.y}px`,o.style.width=`${n.width}px`,o.style.height=`${n.height}px`}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let r=this._getPool(t.accessibleType).pop();r?(r.innerHTML="",r.removeAttribute("title"),r.removeAttribute("aria-label"),r.tabIndex=0):(t.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(t.accessibleType),r.style.cssText=`
|
|
5
|
-
color: transparent;
|
|
6
|
-
pointer-events: none;
|
|
7
|
-
padding: 0;
|
|
8
|
-
margin: 0;
|
|
9
|
-
border: 0;
|
|
10
|
-
outline: 0;
|
|
11
|
-
background: transparent;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
user-select: none;
|
|
14
|
-
-webkit-user-select: none;
|
|
15
|
-
-moz-user-select: none;
|
|
16
|
-
-ms-user-select: none;
|
|
17
|
-
`,t.accessibleText&&(r.innerText=t.accessibleText)),r.style.width=`${jf}px`,r.style.height=`${jf}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=$f.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=t.accessiblePointerEvents,r.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?r.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(r.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&r.setAttribute("aria-label",t.accessibleHint),t.interactive?r.tabIndex=t.tabIndex:r.tabIndex=0,this.debug&&this._updateDebugHTML(r),t._accessibleActive=!0,t._accessibleDiv=r,r.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new lr(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==eS||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}_getPool(t){return this._pools[t]||(this._pools[t]=[]),this._pools[t]}};nc.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"accessibility"};nc.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Zf=nc});var Jf,tp=p(()=>{"use strict";Jf={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1}});var ep=p(()=>{P();ve();Qf();tp();U.add(Zf);U.mixin(dt,Jf)});var ms,rp=p(()=>{P();ms=class{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,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),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}};ms.extension=g.Application});var gs,ip=p(()=>{P();ci();Or();gs=class{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,fe.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?xt.shared:new xt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};gs.extension=g.Application});var ac=p(()=>{P();rp();ip();U.add(ms);U.add(gs)});var lc,Te,cc=p(()=>{ci();Or();lc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(xt.system.add(this._tickerUpdate,this,fe.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(xt.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}},Te=new lc});var Ke,Cn=p(()=>{be();wn();Ke=class extends lr{constructor(){super(...arguments),this.client=new Q,this.movement=new Q,this.offset=new Q,this.global=new Q,this.screen=new Q}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,l,c,u,h,d,f,m,_){throw new Error("Method not implemented.")}}});var Xt,uc=p(()=>{Cn();Xt=class extends Ke{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Me,hc=p(()=>{Cn();Me=class extends Ke{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Me.DOM_DELTA_PIXEL=0;Me.DOM_DELTA_LINE=1;Me.DOM_DELTA_PAGE=2});var aS,lS,xs,En,sp=p(()=>{Nt();be();st();cc();Cn();uc();hc();aS=2048,lS=new Q,xs=new Q,En=class{constructor(t){this.dispatch=new at,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else k(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Te.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,lS.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<aS&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Te.pauseUpdate=!1),t.interactiveChildren&&t.children){let u=t.children;for(let h=u.length-1;h>=0;h--){let d=u[h],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(e),c=t.isInteractive();return c&&c&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,r)&&s(t,r)?c?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Te.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,c=r;for(let u=l.length-1;u>=0;u--){let h=l[u],d=this.hitTestRecursive(h,this._isInteractive(e)?e:h.eventMode,c,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,xs),!t.hitArea.contains(xs.x,xs.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,xs),t.containsPoint(xs)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Xt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Xt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,l,o);if(this.dispatchEvent(c,"pointerout"),r&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(o)){let u=this.createPointerEvent(t,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(c)}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,l);this.dispatchEvent(c,"pointerover"),r&&this.dispatchEvent(c,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Xt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Xt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Xt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let c=a.button===2;this.dispatchEvent(a,c?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Xt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Me)){k("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Xt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Me);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Xt);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Xt&&e instanceof Xt&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Ke&&e instanceof Ke&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var cS,uS,fc,An,pc=p(()=>{P();sp();cc();uc();hc();cS=1,uS={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},fc=class dc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new En(null),Te.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Xt(null),this._rootWheelEvent=new Me(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...dc.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,dc._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){Te.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Te.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Te.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Te.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Te.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=cS),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=uS[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};fc.extension={name:"events",type:[g.WebGLSystem,g.CanvasSystem,g.WebGPUSystem],priority:-1};fc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};An=fc});var op,np=p(()=>{pc();wn();op={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??An.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(i,a,n)}),o?l.once(i,a,n):l.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof lr))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var ap=p(()=>{P();ve();pc();np();U.add(An);U.mixin(dt,op)});var _s,lp=p(()=>{P();rc();_s=class{constructor(t){this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}init(){this._canvasObserver=new hi({domElement:this._domElement,renderer:this._renderer})}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t)}updateRenderable(t){}validateRenderable(t){return!0}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let e=0;e<t.length;e++){let r=t[e],s=r.element;if(!r.parent||r.globalDisplayStatus<7)s?.remove(),t.splice(e,1),e--;else{this._domElement.contains(s)||(s.style.position="absolute",s.style.pointerEvents="auto",this._domElement.appendChild(s));let o=r.worldTransform,n=r._anchor,a=r.width*n.x,l=r.height*n.y;s.style.transformOrigin=`${a}px ${l}px`,s.style.transform=`matrix(${o.a}, ${o.b}, ${o.c}, ${o.d}, ${o.tx-a}, ${o.ty-l})`,s.style.opacity=r.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null}};_s.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"dom"}});var fi,mc=p(()=>{Jt();ve();fi=class extends dt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new ct(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){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null;for(let e in this._gpuData)this._gpuData[e].destroy?.();this._gpuData=null}collectRenderablesSimple(t,e,r){let{renderPipes:s}=e;s.blendMode.pushBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=!1;let n=this.children,a=n.length;for(let l=0;l<a;l++)n[l].collectRenderables(t,e,r);s.blendMode.popBlendMode(t)}}});var cp=p(()=>{P();lp();U.add(_s)});var Yt,cr=p(()=>{"use strict";Yt=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Yt||{})});var up,hp=p(()=>{"use strict";up={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var dp,D,it=p(()=>{hp();dp=up,D={get(){return dp},set(i){dp=i}}});function Se(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ys(i){return i.split("?")[0].split("#")[0]}function hS(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dS(i,t,e){return i.replace(new RegExp(hS(t),"g"),e)}function fS(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var Ct,ur=p(()=>{it();Ct={toPosix(i){return dS(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){Se(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(Se(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=ys(this.toPosix(t??D.get().getBaseUrl())),s=ys(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Ct.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(Se(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=fS(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Se(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(Se(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(Se(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){Se(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){Se(i),t&&Se(t),i=ys(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let l=i.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){Se(i),i=ys(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){Se(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ys(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,l=-1,c=!0,u=i.length-1,h=0;for(;u>=s;--u){if(e=i.charCodeAt(u),e===47){if(!c){a=u+1;break}continue}l===-1&&(c=!1,l=u+1),e===46?n===-1?n=u:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||l===-1||h===0||h===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&r?t.base=t.name=i.slice(1,l):t.base=t.name=i.slice(a,l)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,l)):(t.name=i.slice(a,n),t.base=i.slice(a,l)),t.ext=i.slice(n,l)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var jt,bs=p(()=>{"use strict";jt=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function fp(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?fp(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function pp(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),fp(i,s,0,e,r)}else r.push(i);return r}var mp=p(()=>{"use strict"});var Lr,Mn=p(()=>{"use strict";Lr=i=>!Array.isArray(i)});function pS(i){return i.split(".").pop().split("?").shift().split("#").shift()}var ce,pi=p(()=>{st();ur();bs();mp();Mn();ce=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return jt(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&k("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let c=this._createBundleAssetId(t,a);r.push(c),l=[a,c]}else{let c=a.map(u=>this._createBundleAssetId(t,u));r.push(...c),l=[...a,...c]}this.add({...o,alias:l,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&k(`[Resolver] already has key: ${o} overwriting`)},jt(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:c,parser:u}=o,h=jt(n).map(m=>typeof m=="string"?pp(m):Array.isArray(m)?m:[m]),d=this.getAlias(o);Array.isArray(d)?d.forEach(r):r(d);let f=[];h.forEach(m=>{m.forEach(_=>{let x={};if(typeof _!="object"){x.src=_;for(let y=0;y<this._parsers.length;y++){let b=this._parsers[y];if(b.test(_)){x=b.parse(_);break}}}else a=_.data??a,l=_.format??l,(_.loadParser||_.parser)&&(c=_.loadParser??c,u=_.parser??u),x={...x,..._};if(!d)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:d,data:a,format:l,loadParser:c,parser:u,progressSize:o.progressSize}),f.push(x)})}),d.forEach(m=>{this._assetMap[m]=f})})}resolveBundle(t){let e=Lr(t);t=jt(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let c=n[l];a[this._extractAssetIdFromBundle(s,l)]=c}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Lr(t);t=jt(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let c=o.filter(u=>u[a]?u[a]===l:!1);c.length&&(o=c)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,parser:n,format:a,progressSize:l}=e;return(this._basePath||this._rootPath)&&(t.src=Ct.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.parser=n??t.parser,t.format=a??t.format??pS(t.src),l!==void 0&&(t.progressSize=l),t}};ce.RETINA_PREFIX=/@([0-9\.]+)x/});var vs,gc=p(()=>{"use strict";vs=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var gp,xc,xp=p(()=>{It();Vt();rt();gp=class Ts{constructor(t,e){this.linkedSheets=[];let r=t;t?.source instanceof et&&(r={texture:t,data:e});let{texture:s,data:o,cachePrefix:n=""}=r;this.cachePrefix=n,this._texture=s instanceof A?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=o;let a=parseFloat(o.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.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<=Ts.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=Ts.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new X(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?a=new X(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new X(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new X(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new A({source:this.textureSource,frame:a,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ts.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ts.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};gp.BATCH_SIZE=1e3;xc=gp});function _p(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[`${t.cachePrefix}${s}`]=t.textures[s]}),!e){let s=Ct.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=_p([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var mS,yp,bp=p(()=>{cr();pi();gc();P();rt();ur();xp();mS=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];yp={extension:g.Asset,cache:{test:i=>i instanceof xc,getCacheableAssets:(i,t)=>_p(i,t,!1)},resolver:{extension:{type:g.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&mS.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(ce.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:g.LoadParser,priority:Yt.Normal,name:"spritesheetLoader"},async testParse(i,t){return Ct.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o,cachePrefix:n}=t?.data??{},a=Ct.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof A)l=r;else{let h=vs(a+(s??i.meta.image),t.src);l=(await e.load([{src:h,data:o}]))[h]}let c=new xc({texture:l.source,data:i,cachePrefix:n});await c.parse();let u=i?.meta?.related_multi_packs;if(Array.isArray(u)){let h=[];for(let f of u){if(typeof f!="string")continue;let m=a+f;t.data?.ignoreMultiPack||(m=vs(m,t.src),h.push(e.load({src:m,data:{textureOptions:o,ignoreMultiPack:!0}})))}let d=await Promise.all(h);c.linkedSheets=d,d.forEach(f=>{f.linkedSheets=[c].concat(c.linkedSheets.filter(m=>m!==f))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var Bn=p(()=>{P();bp();U.add(yp)});function Rn(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var _c=p(()=>{"use strict"});var $t,Ss=p(()=>{kl();rt();_c();pt();mc();$t=class i extends fi{constructor(t=A.EMPTY){t instanceof A&&(t={texture:t});let{texture:e=A.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Ut({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof A?new i(t):new i(A.from(t,e))}set texture(t){t||(t=A.EMPTY);let 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 Rn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return O("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}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){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Fn(i,t,e){let r=gS;i.measurable=!0,ii(i,e,r),t.addBoundsMask(r),i.measurable=!1}var gS,yc=p(()=>{Jt();us();gS=new ct});function Gn(i,t,e){let r=ae.get();i.measurable=!0;let s=Mt.get().identity(),o=vp(i,e,s);oi(i,r,o),i.measurable=!1,t.addBoundsMask(r),Mt.return(s),ae.return(r)}function vp(i,t,e){return i?(i!==t&&(vp(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(k("Mask bounds, renderable is not inside the root container"),e)}var bc=p(()=>{_n();Mr();st()});var ws,Tp=p(()=>{P();Ss();yc();bc();ws=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof $t),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||Fn(this.mask,t,e)}addLocalBounds(t,e){Gn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof $t}};ws.extension=g.MaskEffect});var Ps,Sp=p(()=>{P();Ps=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};Ps.extension=g.MaskEffect});var Cs,wp=p(()=>{P();ve();yc();bc();Cs=class{constructor(t){this.priority=0,this.pipe="stencilMask",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){Fn(this.mask,t,e)}addLocalBounds(t,e){Gn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof dt}};Cs.extension=g.MaskEffect});var Dt,Nr=p(()=>{it();P();Vt();Dt=class extends et{constructor(t){t.resource||(t.resource=D.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,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}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"))}};Dt.extension=g.TextureSource});var ee,mi=p(()=>{P();Vt();ee=class extends et{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};ee.extension=g.TextureSource});async function In(){return vc??(vc=(async()=>{let t=D.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(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";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),vc}var vc,Tc=p(()=>{it()});var kn,zr,Sc=p(()=>{P();Or();Tc();Vt();kn=class Pp extends et{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Pp.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"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){let t=xt.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;let 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 In(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,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(){let 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(){let 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();let 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&&(xt.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||(xt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(xt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};kn.extension=g.TextureSource;kn.defaultOptions={...et.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};kn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};zr=kn});var wc,J,hr=p(()=>{st();bs();wc=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||k(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=jt(t),s;for(let l=0;l<this.parsers.length;l++){let c=this.parsers[l];if(c.test(e)){s=c.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(l=>{o.set(l,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let c=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==c&&k("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(t){if(!this._cacheMap.has(t)){k(`[Assets] Asset id ${t} was not found in the Cache`);return}let 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}},J=new wc});function Cp(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Pc.length;s++){let o=Pc[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Ep(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&J.has(r))return J.get(r);let o=new A({source:Cp(s)});return o.on("destroy",()=>{J.has(r)&&J.remove(r)}),t||J.set(r,o),o}function Ap(i,t=!1){return typeof i=="string"?J.get(i):i instanceof et?new A({source:i}):Ep(i,t)}var Pc,Cc=p(()=>{hr();P();Vt();rt();Pc=[];U.handleByList(g.TextureSource,Pc);A.from=Ap;et.from=Cp});var Un=p(()=>{P();Tp();Sp();wp();Zl();Nr();mi();Sc();Cc();U.add(ws,Ps,Cs,zr,ee,Dt,kr)});var Ot,dr=p(()=>{"use strict";Ot=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e]?.off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function gi(i,t,e){let r=2166136261;for(let s=0;s<t;s++)r^=i[s].uid,r=Math.imul(r,16777619),r>>>=0;return Mp[r]||xS(i,t,r,e)}function xS(i,t,e,r){let s={},o=0;for(let a=0;a<r;a++){let l=a<t?i[a]:A.EMPTY.source;s[o++]=l.source,s[o++]=l.style}let n=new Ot(s);return Mp[e]=n,n}var Mp,Dn=p(()=>{dr();rt();Mp={}});var Be,Ec=p(()=>{"use strict";Be=class{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`)}}}});function Es(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var Ac=p(()=>{"use strict"});var Bp,ft,Hr=p(()=>{"use strict";Bp={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},ft=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(ft||{})});function Ze(i,t){return t.alphaMode==="no-premultiply-alpha"&&Bp[i]||i}var As=p(()=>{Hr()});function Ln(){return(!On||On?.isContextLost())&&(On=D.get().createCanvas().getContext("webgl",{})),On}var On,Mc=p(()=>{it()});function yS(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
18
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Nn(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=_S.replace(/%forloop%/gi,yS(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e)}return i}var _S,Bc=p(()=>{"use strict";_S=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
19
|
-
`)});function Rp(){if(xi)return xi;let i=Ln();return xi=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),xi=Nn(xi,i),i.getExtension("WEBGL_lose_context")?.loseContext(),xi}var xi,Fp=p(()=>{Mc();Bc();xi=null});var zn,Gp=p(()=>{"use strict";zn=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function Ip(){return Hn>0?Bs[--Hn]:new Rc}function kp(i){Bs[Hn++]=i}var Rc,Bs,Hn,Ms,Up,Op,Lp=p(()=>{Gt();Ec();pt();Ar();Ac();As();Fp();Gp();Rc=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new zn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Bs=[],Hn=0;de.register({clear:()=>{if(Bs.length>0)for(let i of Bs)i&&i.destroy();Bs.length=0,Hn=0}});Ms=0,Up=class Dp{constructor(t){this.uid=Y("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...Dp.defaultOptions,...t},t.maxTextures||(O("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Rp());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Be(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)kp(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){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let 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){let e=this._elements;if(!e[this.elementStart])return;let r=Ip(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ze(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,c=this.attributeBuffer.uint32View,u=this.indexBuffer,h=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){let x=e[_];e[_]=null;let b=x.texture._source,v=Ze(x.blendMode,b),T=n!==v||a!==x.topology;if(b._batchTick===Ms&&!T){x._textureId=b._textureBindLocation,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r;continue}b._batchTick=Ms,(s.count>=m||T)&&(this._finishBatch(r,d,h-d,s,n,a,t,f),f="renderBatch",d=h,n=v,a=x.topology,r=Ip(),s=r.textures,s.clear(),++Ms),x._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,x._batch=r,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,h-d,s,n,a,t,f),d=h,++Ms),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=h}_finishBatch(t,e,r,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Ms,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){let e=Math.max(t,this.attributeBuffer.size*2),r=new Be(e);Es(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Es(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let c=0;c<n;c++)e[r++]=s+o[c+a]-l}destroy(){if(this.batches!==null){for(let t=0;t<this.batches.length;t++)kp(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]&&(this._elements[t]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};Up.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Op=Up});var j,Qe=p(()=>{"use strict";j=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(j||{})});var bt,fr=p(()=>{Nt();Gt();Qe();bt=class extends at{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=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,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!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&j.STATIC)}set static(t){t?this.descriptor.usage|=j.STATIC:this.descriptor.usage&=~j.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Y("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=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 Fc(i,t){if(!(i instanceof bt)){let e=t?j.INDEX:j.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=j.INDEX|j.COPY_DST):(i=new Float32Array(i),e=j.VERTEX|j.COPY_DST)),i=new bt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var Np=p(()=>{fr();Qe()});function zp(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,c=s.BYTES_PER_ELEMENT,u=(r.offset||0)/c,h=(r.stride||2*4)/c;for(let d=u;d<s.length;d+=h){let f=s[d],m=s[d+1];f>a&&(a=f),m>l&&(l=m),f<o&&(o=f),m<n&&(n=m)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var Hp=p(()=>{"use strict"});function bS(i){return(i instanceof bt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Fc(i.buffer,!1),i}var pe,_i=p(()=>{Nt();Jt();Gt();fr();Np();Hp();pe=class extends at{constructor(t={}){super(),this.uid=Y("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new ct,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"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(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=bS(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=Fc(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,zp(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}}});var vS,TS,Wn,Wp=p(()=>{fr();Qe();_i();vS=new Float32Array(1),TS=new Uint32Array(1),Wn=class extends pe{constructor(){let e=new bt({data:vS,label:"attribute-batch-buffer",usage:j.VERTEX|j.COPY_DST,shrinkToFit:!1}),r=new bt({data:TS,label:"index-batch-buffer",usage:j.INDEX|j.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Je(i,t){let e=Vp[i];return e===void 0&&(Gc[t]===void 0&&(Gc[t]=1),Vp[i]=e=Gc[t]++),e}var Gc,Vp,Rs=p(()=>{"use strict";Gc=Object.create(null),Vp=Object.create(null)});function Xp(){if(!Vn){Vn="mediump";let i=Ln();i&&i.getShaderPrecisionFormat&&(Vn=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Vn}var Vn,Yp=p(()=>{Mc()});function jp(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
20
|
-
|
|
21
|
-
#ifdef GL_ES // This checks if it is WebGL1
|
|
22
|
-
#define in varying
|
|
23
|
-
#define finalColor gl_FragColor
|
|
24
|
-
#define texture texture2D
|
|
25
|
-
#endif
|
|
26
|
-
${i}
|
|
27
|
-
`):`
|
|
28
|
-
|
|
29
|
-
#ifdef GL_ES // This checks if it is WebGL1
|
|
30
|
-
#define in attribute
|
|
31
|
-
#define out varying
|
|
32
|
-
#endif
|
|
33
|
-
${i}
|
|
34
|
-
`}var $p=p(()=>{"use strict"});function qp(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
35
|
-
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Kp=p(()=>{"use strict"});function Zp(i,t){return t?`#version 300 es
|
|
36
|
-
${i}`:i}var Qp=p(()=>{"use strict"});function Jp(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?SS:wS;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
|
|
37
|
-
${i}`}var SS,wS,tm=p(()=>{"use strict";SS={},wS={}});function em(i,t){return t?i.replace("#version 300 es",""):i}var rm=p(()=>{"use strict"});var Ic,Fs,im,vt,tr=p(()=>{Rs();Yp();$p();Kp();Qp();tm();rm();Ic={stripVersion:em,ensurePrecision:qp,addProgramDefines:jp,setProgramName:Jp,insertVersion:Zp},Fs=Object.create(null),im=class kc{constructor(t){t={...kc.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Xp()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Ic).forEach(n=>{let a=r[n];s=Ic[n](s,a,!0),o=Ic[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Je(`${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,Fs[this._cacheKey]=null}static from(t){let e=`${t.vertex}:${t.fragment}`;return Fs[e]||(Fs[e]=new kc(t),Fs[e]._cacheKey=e),Fs[e]}};im.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};vt=im});function re(i){return sm[i]??sm.float32}var sm,Wr=p(()=>{"use strict";sm={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 om({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let l=PS[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:re(l).stride,offset:0,instance:!1,start:0}}}}return e}var PS,nm=p(()=>{Wr();PS={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 Xn(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,c=i.match(t)?.map(h=>({group:parseInt(h.match(e)[1],10),binding:parseInt(h.match(r)[1],10),name:h.match(s)[2],isUniform:h.match(s)[1]==="<uniform>",type:h.match(o)[1]}));if(!c)return{groups:[],structs:[]};let u=i.match(n)?.map(h=>{let d=h.match(l)[1],f=h.match(a).reduce((m,_)=>{let[x,y]=_.split(":");return m[x.trim()]=y.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:h})=>c.some(d=>d.type===h))??[];return{groups:c,structs:u}}var am=p(()=>{"use strict"});var yi,lm=p(()=>{"use strict";yi=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(yi||{})});function cm({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:yi.VERTEX|yi.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:yi.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:yi.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var um=p(()=>{lm()});function hm({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}var dm=p(()=>{"use strict"});function fm(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var pm=p(()=>{"use strict"});var Gs,Tt,pr=p(()=>{Rs();nm();am();um();dm();pm();Gs=Object.create(null),Tt=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Xn(e.source);this.structsAndGroups=a}else{let a=Xn(r.source),l=Xn(e.source);this.structsAndGroups=fm(a,l)}this.layout=s??hm(this.structsAndGroups),this.gpuLayout=o??cm(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Je(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=om(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Gs[this._cacheKey]=null}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Gs[e]||(Gs[e]=new i(t),Gs[e]._cacheKey=e),Gs[e]}}});function Uc(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else k(`${r} placement hook does not exist in shader`)}}var mm=p(()=>{st()});function Dc(i){let t={};return(i.match(CS)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var CS,gm=p(()=>{"use strict";CS=/\{\{(.*?)\}\}/g});function xm(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function Oc(i,t,e=!1){let r=[];xm(t,r),i.forEach(a=>{a.header&&xm(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
38
|
-
`),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
|
|
39
|
-
${o}
|
|
40
|
-
`),n}var _m=p(()=>{"use strict"});function ym(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function ES(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function AS(i){let t=/@.*?\s+/g;return i.replace(t,"")}function bm(i,t){let e=[];ym(t,e),i.forEach(l=>{l.header&&ym(l.header,e)});let r=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
41
|
-
`),o=e.sort().map(l=>` var ${AS(l)};`).join(`
|
|
42
|
-
`),n=`return VSOutput(
|
|
43
|
-
${e.sort().map(l=>` ${ES(l)}`).join(`,
|
|
44
|
-
`)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
45
|
-
${s}
|
|
46
|
-
`),a=a.replace("{{start}}",`
|
|
47
|
-
${o}
|
|
48
|
-
`),a=a.replace("{{return}}",`
|
|
49
|
-
${n}
|
|
50
|
-
`),a}var vm=p(()=>{"use strict"});function Lc(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
|
|
51
|
-
`).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
52
|
-
${s.join(`
|
|
53
|
-
`)}
|
|
54
|
-
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var Tm=p(()=>{"use strict"});function Sm({template:i,bits:t}){let e=Pm(i,t);if(mr[e])return mr[e];let{vertex:r,fragment:s}=BS(i,t);return mr[e]=Cm(r,s,t),mr[e]}function wm({template:i,bits:t}){let e=Pm(i,t);return mr[e]||(mr[e]=Cm(i.vertex,i.fragment,t)),mr[e]}function BS(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=Oc(e,i.vertex,!0);s=bm(e,s);let o=Oc(r,i.fragment,!0);return{vertex:s,fragment:o}}function Pm(i,t){return t.map(e=>(Nc.has(e)||Nc.set(e,MS++),Nc.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function Cm(i,t,e){let r=Dc(i),s=Dc(t);return e.forEach(o=>{Uc(o.vertex,r,o.name),Uc(o.fragment,s,o.name)}),{vertex:Lc(i,r),fragment:Lc(t,s)}}var mr,Nc,MS,Em=p(()=>{mm();gm();_m();vm();Tm();mr=Object.create(null),Nc=new Map,MS=0});var Am,Mm,Bm,Rm,Fm=p(()=>{"use strict";Am=`
|
|
55
|
-
@in aPosition: vec2<f32>;
|
|
56
|
-
@in aUV: vec2<f32>;
|
|
57
|
-
|
|
58
|
-
@out @builtin(position) vPosition: vec4<f32>;
|
|
59
|
-
@out vUV : vec2<f32>;
|
|
60
|
-
@out vColor : vec4<f32>;
|
|
61
|
-
|
|
62
|
-
{{header}}
|
|
63
|
-
|
|
64
|
-
struct VSOutput {
|
|
65
|
-
{{struct}}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
@vertex
|
|
69
|
-
fn main( {{in}} ) -> VSOutput {
|
|
70
|
-
|
|
71
|
-
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
72
|
-
var modelMatrix = mat3x3<f32>(
|
|
73
|
-
1.0, 0.0, 0.0,
|
|
74
|
-
0.0, 1.0, 0.0,
|
|
75
|
-
0.0, 0.0, 1.0
|
|
76
|
-
);
|
|
77
|
-
var position = aPosition;
|
|
78
|
-
var uv = aUV;
|
|
79
|
-
|
|
80
|
-
{{start}}
|
|
81
|
-
|
|
82
|
-
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
83
|
-
|
|
84
|
-
{{main}}
|
|
85
|
-
|
|
86
|
-
vUV = uv;
|
|
87
|
-
|
|
88
|
-
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
89
|
-
|
|
90
|
-
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
91
|
-
|
|
92
|
-
vColor *= globalUniforms.uWorldColorAlpha;
|
|
93
|
-
|
|
94
|
-
{{end}}
|
|
95
|
-
|
|
96
|
-
{{return}}
|
|
97
|
-
};
|
|
98
|
-
`,Mm=`
|
|
99
|
-
@in vUV : vec2<f32>;
|
|
100
|
-
@in vColor : vec4<f32>;
|
|
101
|
-
|
|
102
|
-
{{header}}
|
|
103
|
-
|
|
104
|
-
@fragment
|
|
105
|
-
fn main(
|
|
106
|
-
{{in}}
|
|
107
|
-
) -> @location(0) vec4<f32> {
|
|
108
|
-
|
|
109
|
-
{{start}}
|
|
110
|
-
|
|
111
|
-
var outColor:vec4<f32>;
|
|
112
|
-
|
|
113
|
-
{{main}}
|
|
114
|
-
|
|
115
|
-
var finalColor:vec4<f32> = outColor * vColor;
|
|
116
|
-
|
|
117
|
-
{{end}}
|
|
118
|
-
|
|
119
|
-
return finalColor;
|
|
120
|
-
};
|
|
121
|
-
`,Bm=`
|
|
122
|
-
in vec2 aPosition;
|
|
123
|
-
in vec2 aUV;
|
|
124
|
-
|
|
125
|
-
out vec4 vColor;
|
|
126
|
-
out vec2 vUV;
|
|
127
|
-
|
|
128
|
-
{{header}}
|
|
129
|
-
|
|
130
|
-
void main(void){
|
|
131
|
-
|
|
132
|
-
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
133
|
-
mat3 modelMatrix = mat3(
|
|
134
|
-
1.0, 0.0, 0.0,
|
|
135
|
-
0.0, 1.0, 0.0,
|
|
136
|
-
0.0, 0.0, 1.0
|
|
137
|
-
);
|
|
138
|
-
vec2 position = aPosition;
|
|
139
|
-
vec2 uv = aUV;
|
|
140
|
-
|
|
141
|
-
{{start}}
|
|
142
|
-
|
|
143
|
-
vColor = vec4(1.);
|
|
144
|
-
|
|
145
|
-
{{main}}
|
|
146
|
-
|
|
147
|
-
vUV = uv;
|
|
148
|
-
|
|
149
|
-
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
150
|
-
|
|
151
|
-
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
152
|
-
|
|
153
|
-
vColor *= uWorldColorAlpha;
|
|
154
|
-
|
|
155
|
-
{{end}}
|
|
156
|
-
}
|
|
157
|
-
`,Rm=`
|
|
158
|
-
|
|
159
|
-
in vec4 vColor;
|
|
160
|
-
in vec2 vUV;
|
|
161
|
-
|
|
162
|
-
out vec4 finalColor;
|
|
163
|
-
|
|
164
|
-
{{header}}
|
|
165
|
-
|
|
166
|
-
void main(void) {
|
|
167
|
-
|
|
168
|
-
{{start}}
|
|
169
|
-
|
|
170
|
-
vec4 outColor;
|
|
171
|
-
|
|
172
|
-
{{main}}
|
|
173
|
-
|
|
174
|
-
finalColor = outColor * vColor;
|
|
175
|
-
|
|
176
|
-
{{end}}
|
|
177
|
-
}
|
|
178
|
-
`});var Gm,Im,km=p(()=>{"use strict";Gm={name:"global-uniforms-bit",vertex:{header:`
|
|
179
|
-
struct GlobalUniforms {
|
|
180
|
-
uProjectionMatrix:mat3x3<f32>,
|
|
181
|
-
uWorldTransformMatrix:mat3x3<f32>,
|
|
182
|
-
uWorldColorAlpha: vec4<f32>,
|
|
183
|
-
uResolution: vec2<f32>,
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
187
|
-
`}},Im={name:"global-uniforms-bit",vertex:{header:`
|
|
188
|
-
uniform mat3 uProjectionMatrix;
|
|
189
|
-
uniform mat3 uWorldTransformMatrix;
|
|
190
|
-
uniform vec4 uWorldColorAlpha;
|
|
191
|
-
uniform vec2 uResolution;
|
|
192
|
-
`}}});function Re({bits:i,name:t}){let e=Sm({template:{fragment:Mm,vertex:Am},bits:[Gm,...i]});return Tt.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Fe({bits:i,name:t}){return new vt({name:t,...wm({template:{vertex:Bm,fragment:Rm},bits:[Im,...i]})})}var gr=p(()=>{tr();pr();Em();Fm();km()});var bi,vi,Is=p(()=>{"use strict";bi={name:"color-bit",vertex:{header:`
|
|
193
|
-
@in aColor: vec4<f32>;
|
|
194
|
-
`,main:`
|
|
195
|
-
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
196
|
-
`}},vi={name:"color-bit",vertex:{header:`
|
|
197
|
-
in vec4 aColor;
|
|
198
|
-
`,main:`
|
|
199
|
-
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
200
|
-
`}}});function RS(i){let t=[];if(i===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 r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
|
|
201
|
-
`)}function FS(i){let t=[];if(i===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<i;e++)e===i-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(`
|
|
202
|
-
`)}function Ti(i){return zc[i]||(zc[i]={name:"texture-batch-bit",vertex:{header:`
|
|
203
|
-
@in aTextureIdAndRound: vec2<u32>;
|
|
204
|
-
@out @interpolate(flat) vTextureId : u32;
|
|
205
|
-
`,main:`
|
|
206
|
-
vTextureId = aTextureIdAndRound.y;
|
|
207
|
-
`,end:`
|
|
208
|
-
if(aTextureIdAndRound.x == 1)
|
|
209
|
-
{
|
|
210
|
-
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
211
|
-
}
|
|
212
|
-
`},fragment:{header:`
|
|
213
|
-
@in @interpolate(flat) vTextureId: u32;
|
|
214
|
-
|
|
215
|
-
${RS(i)}
|
|
216
|
-
`,main:`
|
|
217
|
-
var uvDx = dpdx(vUV);
|
|
218
|
-
var uvDy = dpdy(vUV);
|
|
219
|
-
|
|
220
|
-
${FS(i)}
|
|
221
|
-
`}}),zc[i]}function GS(i){let t=[];for(let e=0;e<i;e++)e>0&&t.push("else"),e<i-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
222
|
-
`)}function Si(i){return Hc[i]||(Hc[i]={name:"texture-batch-bit",vertex:{header:`
|
|
223
|
-
in vec2 aTextureIdAndRound;
|
|
224
|
-
out float vTextureId;
|
|
225
|
-
|
|
226
|
-
`,main:`
|
|
227
|
-
vTextureId = aTextureIdAndRound.y;
|
|
228
|
-
`,end:`
|
|
229
|
-
if(aTextureIdAndRound.x == 1.)
|
|
230
|
-
{
|
|
231
|
-
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
232
|
-
}
|
|
233
|
-
`},fragment:{header:`
|
|
234
|
-
in float vTextureId;
|
|
235
|
-
|
|
236
|
-
uniform sampler2D uTextures[${i}];
|
|
237
|
-
|
|
238
|
-
`,main:`
|
|
239
|
-
|
|
240
|
-
${GS(i)}
|
|
241
|
-
`}}),Hc[i]}var zc,Hc,ks=p(()=>{"use strict";zc={};Hc={}});var Ge,Ie,xr=p(()=>{"use strict";Ge={name:"round-pixels-bit",vertex:{header:`
|
|
242
|
-
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
243
|
-
{
|
|
244
|
-
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
245
|
-
}
|
|
246
|
-
`}},Ie={name:"round-pixels-bit",vertex:{header:`
|
|
247
|
-
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
248
|
-
{
|
|
249
|
-
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
250
|
-
}
|
|
251
|
-
`}}});var Wc,Um,Dm=p(()=>{"use strict";Wc=["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>"],Um=Wc.reduce((i,t)=>(i[t]=!0,i),{})});function Om(i,t){switch(i){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 Lm=p(()=>{"use strict"});var Nm,ut,qt=p(()=>{Gt();Rs();Dm();Lm();Nm=class zm{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,e={...zm.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Um[o.type]){let n=o.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(n){let[,a,l]=n;throw new Error(`Uniform type ${o.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Wc.join(", ")}`)}o.value??(o.value=Om(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Je(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Nm.defaultOptions={ubo:!1,isStatic:!1};ut=Nm});function wi(i){let t=Hm[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Hm[i]=new ut({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var Hm,Yn=p(()=>{qt();Hm={}});var Bt,ke=p(()=>{"use strict";Bt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Bt||{})});var St,we=p(()=>{Nt();Gt();tr();dr();pr();ke();qt();St=class i extends at{constructor(t){super(),this.uid=Y("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Bt.WEBGPU),r&&(n|=Bt.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let c in a)for(let u in a[c]){let h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(e&&s&&!a){let c=e.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(let u in o)l[u]||(s[99]||(s[99]=new Ot,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(let u in o){let h=u,d=o[u];!d.source&&!d._resourceType&&(d=new ut(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new Ot,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new Ot,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=Tt.from(e)),r&&(n=vt.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var jn,Wm=p(()=>{gr();Is();ks();xr();Yn();we();jn=class extends St{constructor(t){let e=Fe({name:"batch",bits:[vi,Si(t),Ie]}),r=Re({name:"batch",bits:[bi,Ti(t),Ge]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:wi(t)}})}}});var Vc,Vm,Us,Xc=p(()=>{P();Lp();Wp();Wm();Vc=null,Vm=class Xm extends Op{constructor(t){super(t),this.geometry=new Wn,this.name=Xm.extension.name,this.vertexSize=6,Vc??(Vc=new jn(t.maxTextures)),this.shader=Vc}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,{positions:m,uvs:_}=t,x=t.color,y=t.attributeOffset,b=y+t.attributeSize;for(let v=y;v<b;v++){let T=v*2,E=m[T],S=m[T+1];e[s++]=l*E+u*S+d,e[s++]=h*S+c*E+f,e[s++]=_[T],e[s++]=_[T+1],r[s++]=x,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,m=t.bounds,_=m.maxX,x=m.minX,y=m.maxY,b=m.minY,v=n.uvs,T=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=l*x+u*b+d,e[s+1]=h*b+c*x+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=E,e[s+6]=l*_+u*b+d,e[s+7]=h*b+c*_+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=E,e[s+12]=l*_+u*y+d,e[s+13]=h*y+c*_+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=E,e[s+18]=l*x+u*y+d,e[s+19]=h*y+c*x+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=E}};Vm.extension={type:[g.Batcher],name:"default"};Us=Vm});function Ym(i,t,e,r,s,o,n,a=null){let l=0;e*=t,s*=o;let c=a.a,u=a.b,h=a.c,d=a.d,f=a.tx,m=a.ty;for(;l<n;){let _=i[e],x=i[e+1];r[s]=c*_+h*x+f,r[s+1]=u*_+d*x+m,s+=o,e+=t,l++}}function jm(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var $m=p(()=>{"use strict"});function Yc(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,l=t.d,c=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let h=e*r;for(let d=0;d<s;d++){let f=i[h],m=i[h+1];i[h]=o*f+a*m+c,i[h+1]=n*f+l*m+u,h+=r}}var qm=p(()=>{"use strict"});var IS,Vr,jc=p(()=>{Z();Hl();IS=new B,Vr=class{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(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?xn(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||IS}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"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}});var Pi,Km,Zm,Qm=p(()=>{P();Pi={extension:{type:g.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;if(n=a=T.radius,n<=0)return!1;e=T.x,r=T.y,s=o=0}else if(i.type==="ellipse"){let T=i;if(n=T.halfWidth,a=T.halfHeight,n<=0||a<=0)return!1;e=T.x,r=T.y,s=o=0}else{let T=i,E=T.width/2,S=T.height/2;e=T.x+E,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(E,S))),s=E-n,o=S-a}if(s<0||o<0)return!1;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return!1;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,!0;let u=0,h=l*4+(s?2:0)+2,d=h,f=c,m=s+n,_=o,x=e+m,y=e-m,b=r+_;if(t[u++]=x,t[u++]=b,t[--h]=b,t[--h]=y,o){let T=r-_;t[d++]=y,t[d++]=T,t[--f]=T,t[--f]=x}for(let T=1;T<l;T++){let E=Math.PI/2*(T/l),S=s+Math.cos(E)*n,w=o+Math.sin(E)*a,G=e+S,C=e-S,M=r+w,F=r-w;t[u++]=G,t[u++]=M,t[--h]=M,t[--h]=C,t[d++]=C,t[d++]=F,t[--f]=F,t[--f]=G}m=s,_=o+a,x=e+m,y=e-m,b=r+_;let v=r-_;return t[u++]=x,t[u++]=b,t[--f]=v,t[--f]=x,s&&(t[u++]=y,t[u++]=b,t[--f]=v,t[--f]=y),!0},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let l=r;t[l*e]=n,t[l*e+1]=a;let c=l++;for(let u=0;u<i.length;u+=2)t[l*e]=i[u],t[l*e+1]=i[u+1],u>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},Km={...Pi,extension:{...Pi.extension,name:"ellipse"}},Zm={...Pi,extension:{...Pi.extension,name:"roundedRectangle"}}});function Jm(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var tg=p(()=>{"use strict"});function eg(i,t,e,r,s,o,n,a){let l=i-e*s,c=t-r*s,u=i+e*o,h=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let m=l+d,_=c+f,x=u+d,y=h+f;return a.push(m,_),a.push(x,y),2}function Xr(i,t,e,r,s,o,n,a){let l=e-i,c=r-t,u=Math.atan2(l,c),h=Math.atan2(s-i,o-t);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let d=u,f=h-u,m=Math.abs(f),_=Math.sqrt(l*l+c*c),x=(15*m*Math.sqrt(_)/Math.PI>>0)+1,y=f/x;if(d+=y,a){n.push(i,t),n.push(e,r);for(let b=1,v=d;b<x;b++,v+=y)n.push(i,t),n.push(i+Math.sin(v)*_,t+Math.cos(v)*_);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let b=1,v=d;b<x;b++,v+=y)n.push(i+Math.sin(v)*_,t+Math.cos(v)*_),n.push(i,t);n.push(s,o),n.push(i,t)}return x*2}function rg(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let H=Jm(i);e&&(H*=-1),l=(l-.5)*H+.5}let c=new Q(i[0],i[1]),u=new Q(i[i.length-2],i[i.length-1]),h=r,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){i=i.slice(),d&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let H=(c.x+u.x)*.5,yt=(u.y+c.y)*.5;i.unshift(H,yt),i.push(H,yt)}let f=s,m=i.length/2,_=i.length,x=f.length/2,y=a.width/2,b=y*y,v=a.miterLimit*a.miterLimit,T=i[0],E=i[1],S=i[2],w=i[3],G=0,C=0,M=-(E-w),F=T-S,R=0,W=0,q=Math.sqrt(M*M+F*F);M/=q,F/=q,M*=y,F*=y;let Ft=l,I=(1-Ft)*2,L=Ft*2;h||(a.cap==="round"?_+=Xr(T-M*(I-L)*.5,E-F*(I-L)*.5,T-M*I,E-F*I,T+M*L,E+F*L,f,!0)+2:a.cap==="square"&&(_+=eg(T,E,M,F,I,L,!0,f))),f.push(T-M*I,E-F*I),f.push(T+M*L,E+F*L);for(let H=1;H<m-1;++H){T=i[(H-1)*2],E=i[(H-1)*2+1],S=i[H*2],w=i[H*2+1],G=i[(H+1)*2],C=i[(H+1)*2+1],M=-(E-w),F=T-S,q=Math.sqrt(M*M+F*F),M/=q,F/=q,M*=y,F*=y,R=-(w-C),W=S-G,q=Math.sqrt(R*R+W*W),R/=q,W/=q,R*=y,W*=y;let yt=S-T,N=E-w,At=S-G,mt=C-w,Pt=yt*At+N*mt,ht=N*At-mt*yt,Qt=ht<0;if(Math.abs(ht)<.001*Math.abs(Pt)){f.push(S-M*I,w-F*I),f.push(S+M*L,w+F*L),Pt>=0&&(a.join==="round"?_+=Xr(S,w,S-M*I,w-F*I,S-R*I,w-W*I,f,!1)+4:_+=2,f.push(S-R*L,w-W*L),f.push(S+R*I,w+W*I));continue}let Ee=(-M+T)*(-F+w)-(-M+S)*(-F+E),ne=(-R+G)*(-W+w)-(-R+S)*(-W+C),nr=(yt*ne-At*Ee)/ht,ti=(mt*Ee-N*ne)/ht,ss=(nr-S)*(nr-S)+(ti-w)*(ti-w),Ne=S+(nr-S)*I,ze=w+(ti-w)*I,He=S-(nr-S)*L,We=w-(ti-w)*L,Sl=Math.min(yt*yt+N*N,At*At+mt*mt),an=Qt?I:L,Er=Sl+an*an*b;ss<=Er?a.join==="bevel"||ss/b>v?(Qt?(f.push(Ne,ze),f.push(S+M*L,w+F*L),f.push(Ne,ze),f.push(S+R*L,w+W*L)):(f.push(S-M*I,w-F*I),f.push(He,We),f.push(S-R*I,w-W*I),f.push(He,We)),_+=2):a.join==="round"?Qt?(f.push(Ne,ze),f.push(S+M*L,w+F*L),_+=Xr(S,w,S+M*L,w+F*L,S+R*L,w+W*L,f,!0)+4,f.push(Ne,ze),f.push(S+R*L,w+W*L)):(f.push(S-M*I,w-F*I),f.push(He,We),_+=Xr(S,w,S-M*I,w-F*I,S-R*I,w-W*I,f,!1)+4,f.push(S-R*I,w-W*I),f.push(He,We)):(f.push(Ne,ze),f.push(He,We)):(f.push(S-M*I,w-F*I),f.push(S+M*L,w+F*L),a.join==="round"?Qt?_+=Xr(S,w,S+M*L,w+F*L,S+R*L,w+W*L,f,!0)+2:_+=Xr(S,w,S-M*I,w-F*I,S-R*I,w-W*I,f,!1)+2:a.join==="miter"&&ss/b<=v&&(Qt?(f.push(He,We),f.push(He,We)):(f.push(Ne,ze),f.push(Ne,ze)),_+=2),f.push(S-R*I,w-W*I),f.push(S+R*L,w+W*L),_+=2)}T=i[(m-2)*2],E=i[(m-2)*2+1],S=i[(m-1)*2],w=i[(m-1)*2+1],M=-(E-w),F=T-S,q=Math.sqrt(M*M+F*F),M/=q,F/=q,M*=y,F*=y,f.push(S-M*I,w-F*I),f.push(S+M*L,w+F*L),h||(a.cap==="round"?_+=Xr(S-M*(I-L)*.5,w-F*(I-L)*.5,S-M*I,w-F*I,S+M*L,w+F*L,f,!1)+2:a.cap==="square"&&(_+=eg(S,w,M,F,I,L,!1,f)));let wt=1e-4*1e-4;for(let H=x;H<_+x-2;++H)T=f[H*2],E=f[H*2+1],S=f[(H+1)*2],w=f[(H+1)*2+1],G=f[(H+2)*2],C=f[(H+2)*2+1],!(Math.abs(T*(w-C)+S*(C-E)+G*(E-w))<wt)&&o.push(H,H+1,H+2)}var ig=p(()=>{be();tg()});function sg(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],l=i[i.length-1],c=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=e,h=i.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(i[f*2]),u.push(i[f*2+1]);for(let f=0;f<h-1;f++)r.push(d+f,d+f+1);c&&r.push(d+h-1,d)}var og=p(()=>{});function Kn(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length,o=ag(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;let a,l,c;if(r&&(o=zS(i,t,o,e)),i.length>80*e){a=i[0],l=i[1];let u=a,h=l;for(let d=e;d<s;d+=e){let f=i[d],m=i[d+1];f<a&&(a=f),m<l&&(l=m),f>u&&(u=f),m>h&&(h=m)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return Os(o,n,e,a,l,c,0),n}function ag(i,t,e,r,s){let o;if(s===QS(i,t,e,r)>0)for(let n=t;n<e;n+=r)o=ng(n/r|0,i[n],i[n+1],o);else for(let n=e-r;n>=t;n-=r)o=ng(n/r|0,i[n],i[n+1],o);return o&&Ci(o,o.next)&&(Ns(o),o=o.next),o}function Yr(i,t){if(!i)return i;t||(t=i);let e=i,r;do if(r=!1,!e.steiner&&(Ci(e,e.next)||_t(e.prev,e,e.next)===0)){if(Ns(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Os(i,t,e,r,s,o,n){if(!i)return;!n&&o&&YS(i,r,s,o);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(o?OS(i,r,s,o):DS(i)){t.push(l.i,i.i,c.i),Ns(i),i=c.next,a=c.next;continue}if(i=c,i===a){n?n===1?(i=LS(Yr(i),t),Os(i,t,e,r,s,o,2)):n===2&&NS(i,t,e,r,s,o):Os(Yr(i),t,e,r,s,o,1);break}}}function DS(i){let t=i.prev,e=i,r=i.next;if(_t(t,e,r)>=0)return!1;let s=t.x,o=e.x,n=r.x,a=t.y,l=e.y,c=r.y,u=Math.min(s,o,n),h=Math.min(a,l,c),d=Math.max(s,o,n),f=Math.max(a,l,c),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=f&&Ds(s,a,o,l,n,c,m.x,m.y)&&_t(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function OS(i,t,e,r){let s=i.prev,o=i,n=i.next;if(_t(s,o,n)>=0)return!1;let a=s.x,l=o.x,c=n.x,u=s.y,h=o.y,d=n.y,f=Math.min(a,l,c),m=Math.min(u,h,d),_=Math.max(a,l,c),x=Math.max(u,h,d),y=$c(f,m,t,e,r),b=$c(_,x,t,e,r),v=i.prevZ,T=i.nextZ;for(;v&&v.z>=y&&T&&T.z<=b;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=x&&v!==s&&v!==n&&Ds(a,u,l,h,c,d,v.x,v.y)&&_t(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=f&&T.x<=_&&T.y>=m&&T.y<=x&&T!==s&&T!==n&&Ds(a,u,l,h,c,d,T.x,T.y)&&_t(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=x&&v!==s&&v!==n&&Ds(a,u,l,h,c,d,v.x,v.y)&&_t(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=b;){if(T.x>=f&&T.x<=_&&T.y>=m&&T.y<=x&&T!==s&&T!==n&&Ds(a,u,l,h,c,d,T.x,T.y)&&_t(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function LS(i,t){let e=i;do{let r=e.prev,s=e.next.next;!Ci(r,s)&&cg(r,e,e.next,s)&&Ls(r,s)&&Ls(s,r)&&(t.push(r.i,e.i,s.i),Ns(e),Ns(e.next),e=i=s),e=e.next}while(e!==i);return Yr(e)}function NS(i,t,e,r,s,o){let n=i;do{let a=n.next.next;for(;a!==n.prev;){if(n.i!==a.i&&qS(n,a)){let l=ug(n,a);n=Yr(n,n.next),l=Yr(l,l.next),Os(n,t,e,r,s,o,0),Os(l,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function zS(i,t,e,r){let s=[];for(let o=0,n=t.length;o<n;o++){let a=t[o]*r,l=o<n-1?t[o+1]*r:i.length,c=ag(i,a,l,r,!1);c===c.next&&(c.steiner=!0),s.push($S(c))}s.sort(HS);for(let o=0;o<s.length;o++)e=WS(s[o],e);return e}function HS(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let r=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=r-s}return e}function WS(i,t){let e=VS(i,t);if(!e)return t;let r=ug(e,i);return Yr(r,r.next),Yr(e,e.next)}function VS(i,t){let e=t,r=i.x,s=i.y,o=-1/0,n;if(Ci(i,e))return e;do{if(Ci(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,n=e.x<e.next.x?e:e.next,h===r))return n}e=e.next}while(e!==t);if(!n)return null;let a=n,l=n.x,c=n.y,u=1/0;e=n;do{if(r>=e.x&&e.x>=l&&r!==e.x&&lg(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)){let h=Math.abs(s-e.y)/(r-e.x);Ls(e,i)&&(h<u||h===u&&(e.x>n.x||e.x===n.x&&XS(n,e)))&&(n=e,u=h)}e=e.next}while(e!==a);return n}function XS(i,t){return _t(i.prev,i,t.prev)<0&&_t(t.next,i,i.next)<0}function YS(i,t,e,r){let s=i;do s.z===0&&(s.z=$c(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,jS(s)}function jS(i){let t,e=1;do{let r=i,s;i=null;let o=null;for(t=0;r;){t++;let n=r,a=0;for(let c=0;c<e&&(a++,n=n.nextZ,!!n);c++);let l=e;for(;a>0||l>0&&n;)a!==0&&(l===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;r=n}o.nextZ=null,e*=2}while(t>1);return i}function $c(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function $S(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function lg(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function Ds(i,t,e,r,s,o,n,a){return!(i===n&&t===a)&&lg(i,t,e,r,s,o,n,a)}function qS(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!KS(i,t)&&(Ls(i,t)&&Ls(t,i)&&ZS(i,t)&&(_t(i.prev,i,t.prev)||_t(i,t.prev,t))||Ci(i,t)&&_t(i.prev,i,i.next)>0&&_t(t.prev,t,t.next)>0)}function _t(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Ci(i,t){return i.x===t.x&&i.y===t.y}function cg(i,t,e,r){let s=qn(_t(i,t,e)),o=qn(_t(i,t,r)),n=qn(_t(e,r,i)),a=qn(_t(e,r,t));return!!(s!==o&&n!==a||s===0&&$n(i,e,t)||o===0&&$n(i,r,t)||n===0&&$n(e,i,r)||a===0&&$n(e,t,r))}function $n(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function qn(i){return i>0?1:i<0?-1:0}function KS(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&cg(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Ls(i,t){return _t(i.prev,i,i.next)<0?_t(i,t,i.next)>=0&&_t(i,i.prev,t)>=0:_t(i,t,i.prev)<0||_t(i,i.next,t)<0}function ZS(i,t){let e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function ug(i,t){let e=qc(i.i,i.x,i.y),r=qc(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function ng(i,t,e,r){let s=qc(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Ns(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function qc(i,t,e){return{i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function QS(i,t,e,r){let s=0;for(let o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}var hg=p(()=>{});var dg,fg=p(()=>{hg();Nt();dg=Kn.default||Kn});function Zn(i,t,e,r,s,o,n){let a=dg(i,t,2);if(!a)return;for(let c=0;c<a.length;c+=3)o[n++]=a[c]+s,o[n++]=a[c+1]+s,o[n++]=a[c+2]+s;let l=s*r;for(let c=0;c<i.length;c+=2)e[l]=i[c],e[l+1]=i[c+1],l+=r}var Kc=p(()=>{fg()});var JS,pg,mg=p(()=>{P();Kc();JS=[],pg={extension:{type:g.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return!0},triangulate(i,t,e,r,s,o){Zn(i,JS,t,e,r,s,o)}}});var gg,xg=p(()=>{P();gg={extension:{type:g.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>0&&n>0?(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n,!0):!1},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var _g,yg=p(()=>{P();_g={extension:{type:g.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,!0},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function vg(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Tg(i,t){let e=D.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function tw(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(O("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??ie.defaultLinearOptions.textureSize}),t}var bg,Qc,ie,Ei=p(()=>{Ht();it();Z();mi();rt();Gt();pt();jl();bg=[{offset:0,color:"white"},{offset:1,color:"black"}],Qc=class Zc{constructor(...t){this.uid=Y("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=tw(t);e={...e.type==="radial"?Zc.defaultRadialOptions:Zc.defaultLinearOptions,...yn(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:$.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=t;t=r,r=x,o*=-1}if(n<0){let x=e;e=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:bg,c=this._textureSize,{canvas:u,context:h}=Tg(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);vg(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new A({source:new ee({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),_=new B;_.scale(f/c,1),_.rotate(m),_.translate(t,e),this.textureSpace==="local"&&_.scale(c,c),this.transform=_}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:bg,e=this._textureSize,{canvas:r,context:s}=Tg(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,d=l-u,f=e/(u*2),m=(o-h)*f,_=(n-d)*f,x=s.createRadialGradient(m,_,c*f,(a-h)*f,(l-d)*f,u*f);vg(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(m,_),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-_),s.fillRect(0,0,e,e),this.texture=new A({source:new ee({resource:r,addressMode:this._wrapMode})});let y=new B;y.scale(1/f,1/f),y.translate(h,d),this.textureSpace==="local"&&y.scale(e,e),this.transform=y}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};Qc.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Qc.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ie=Qc});function Sg(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(rw);t.width&&n.pad(t.width);let{x:a,y:l}=n,c=1/n.width,u=1/n.height,h=-a*c,d=-l*u,f=s.a,m=s.b,_=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*_+s.tx,s.ty=h*m+d*x+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof ie)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(ew.copyFrom(r).invert()),s}var ew,rw,wg=p(()=>{Z();It();Ei();ew=new B,rw=new X});function Cg(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")ow(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,c=o.data.hole;n&&c&&Pg(c.shapePath,l,!0,r,e),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),Pg(a,l,n,r,e)}}}function ow(i,t,e){let r=[],s=Qn.rectangle,o=iw;o.x=i.dx,o.y=i.dy,o.width=i.dw,o.height=i.dh;let n=i.transform;if(!s.build(o,r))return;let{vertices:a,uvs:l,indices:c}=e,u=c.length,h=a.length/2;n&&Yc(r,n),s.triangulate(r,a,2,h,c,u);let d=i.image,f=d.uvs;l.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=lt.get(Vr);m.indexOffset=u,m.indexSize=c.length-u,m.attributeOffset=h,m.attributeSize=a.length/2-h,m.baseColor=i.style,m.alpha=i.alpha,m.texture=d,m.geometryData=e,t.push(m)}function Pg(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=[],d=Qn[l.type];if(!d.build(l,h))return;let f=a.length,m=o.length/2,_="triangle-list";if(c&&Yc(h,c),e){let v=l.closePath??!0,T=t;T.pixelLine?(sg(h,v,o,a),_="line-list"):rg(h,T,!1,v,o,a)}else if(u){let v=[],T=h.slice();nw(u).forEach(S=>{v.push(T.length/2),T.push(...S)}),Zn(T,v,o,2,m,a,f)}else d.triangulate(h,o,2,m,a,f);let x=n.length/2,y=t.texture;if(y!==A.WHITE){let v=Sg(sw,t,l,c);Ym(o,2,m,n,x,2,o.length/2-m,v)}else jm(n,x,2,o.length/2-m);let b=lt.get(Vr);b.indexOffset=f,b.indexSize=a.length-f,b.attributeOffset=m,b.attributeSize=o.length/2-m,b.baseColor=t.color,b.alpha=t.alpha,b.texture=y,b.geometryData=s,b.topology=_,r.push(b)})}function nw(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Qn[r.type].build(r,s)&&t.push(s)}return t}var Qn,iw,sw,Eg=p(()=>{P();Z();It();$m();qm();rt();Ae();jc();Qm();ig();og();mg();xg();yg();wg();Kc();Qn={};U.handleByMap(g.ShapeBuilder,Qn);U.add(gg,pg,_g,Pi,Km,Zm);iw=new X,sw=new B});var Jc,tu,ru,Ai,Jn=p(()=>{P();Dn();Xc();Xl();pt();Ae();Eg();Jc=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},tu=class{constructor(){this.instructions=new ni}init(t){this.batcher=new Us({maxTextures:t}),this.instructions.reset()}get geometry(){return O(Dl,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}},ru=class eu{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){eu.defaultOptions.bezierSmoothness=t?.bezierSmoothness??eu.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),Cg(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="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){let e=lt.get(tu,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let h=r[u];a.add(h)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let c=a.batches;for(let u=0;u<c.length;u++){let h=c[u];h.bindGroup=gi(h.textures.textures,h.textures.count,this._renderer.limits.maxBatchableTextures)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Jc;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){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(lt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{lt.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};ru.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"graphicsContext"};ru.defaultOptions={bezierSmoothness:.5};Ai=ru});var aw,iu,su,ou,nu,au,lu,cu,Et,Pe=p(()=>{"use strict";aw={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},iu=0,su=1,ou=2,nu=3,au=4,lu=5,cu=class Ag{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<iu)}set blend(t){!!(this.data&1<<iu)!==t&&(this.data^=1<<iu)}get offsets(){return!!(this.data&1<<su)}set offsets(t){!!(this.data&1<<su)!==t&&(this.data^=1<<su)}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<<ou)}set culling(t){!!(this.data&1<<ou)!==t&&(this.data^=1<<ou)}get depthTest(){return!!(this.data&1<<nu)}set depthTest(t){!!(this.data&1<<nu)!==t&&(this.data^=1<<nu)}get depthMask(){return!!(this.data&1<<lu)}set depthMask(t){!!(this.data&1<<lu)!==t&&(this.data^=1<<lu)}get clockwiseFrontFace(){return!!(this.data&1<<au)}set clockwiseFrontFace(t){!!(this.data&1<<au)!==t&&(this.data^=1<<au)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=aw[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new Ag;return t.depthTest=!1,t.blend=!0,t}};cu.default2d=cu.for2d();Et=cu});function Ue(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var Mi=p(()=>{"use strict"});var uu,zs,Mg=p(()=>{P();Pe();Ae();Mi();jc();uu=class{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{lt.return(t)}),this.batches.length=0}},zs=class{constructor(t,e){this.state=Et.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this)}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){let e=t.context,r=!!t._gpuData,s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let o=r[s];o._batcher.updateElement(o)}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Ue(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new uu;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=s.batches.map(n=>{let a=lt.get(Vr);return n.copyTo(a),a.renderable=t,a.roundPixels=o,a})}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}};zs.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"graphics"}});var hu=p(()=>{P();Jn();Mg();U.add(zs);U.add(Ai)});var _r,ta=p(()=>{"use strict";_r=class{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(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,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}}});var ea,Hs,Bg=p(()=>{P();Z();dr();qt();As();Mi();ta();ea=class{destroy(){}},Hs=class{constructor(t,e){this.localUniforms=new ut({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Ot({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,s=this._getMeshData(t);if(t.didViewUpdate&&(s.indexSize=t._geometry.indices?.length,s.vertexSize=t._geometry.positions?.length),s.batched){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let 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=Ze(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ue(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){var e,r;return(e=t._gpuData)[r=this.renderer.uid]||(e[r]=new ea),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:0,vertexSize:0},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return(e=t._gpuData)[r=this.renderer.uid]||(e[r]=new ea),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new _r;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}};Hs.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"mesh"}});var du=p(()=>{P();Bg();U.add(Hs)});var ra,Rg=p(()=>{"use strict";ra=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let c=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,c,0)}}});function fu(i,t=null){let e=i*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 r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var Fg=p(()=>{"use strict"});function Ig(i){return{dynamicUpdate:Gg(i,!0),staticUpdate:Gg(i,!1)}}function Gg(i,t){let e=[];e.push(`
|
|
252
|
-
|
|
253
|
-
var index = 0;
|
|
254
|
-
|
|
255
|
-
for (let i = 0; i < ps.length; ++i)
|
|
256
|
-
{
|
|
257
|
-
const p = ps[i];
|
|
258
|
-
|
|
259
|
-
`);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=re(n.format);r+=a.stride/4}e.push(`
|
|
260
|
-
index += stride * 4;
|
|
261
|
-
}
|
|
262
|
-
`),e.unshift(`
|
|
263
|
-
var stride = ${r};
|
|
264
|
-
`);let s=e.join(`
|
|
265
|
-
`);return new Function("ps","f32v","u32v",s)}var kg=p(()=>{Wr()});function lw(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var ia,Ug=p(()=>{fr();Qe();_i();Wr();Ec();Fg();kg();ia=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let u in r){let h=r[u],d=re(h.format);h.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Be(e*4*s),this.dynamicAttributeBuffer=new Be(e*4*o),this.indexBuffer=fu(e);let n=new pe,a=0,l=0;this._staticBuffer=new bt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:j.VERTEX|j.COPY_DST}),this._dynamicBuffer=new bt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:j.VERTEX|j.COPY_DST});for(let u in r){let h=r[u],d=re(h.format);h.dynamic?(n.addAttribute(h.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:h.format}),a+=d.size):(n.addAttribute(h.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:h.format}),l+=d.size)}n.addIndex(this.indexBuffer);let c=this.getParticleUpdate(r);this._dynamicUpload=c.dynamicUpdate,this._staticUpload=c.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=lw(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Ig(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Be(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Be(this._size*this._dynamicStride*4*4),this.indexBuffer=fu(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var Dg,Og=p(()=>{Dg=`varying vec2 vUV;
|
|
266
|
-
varying vec4 vColor;
|
|
267
|
-
|
|
268
|
-
uniform sampler2D uTexture;
|
|
269
|
-
|
|
270
|
-
void main(void){
|
|
271
|
-
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
272
|
-
gl_FragColor = color;
|
|
273
|
-
}`});var Lg,Ng=p(()=>{Lg=`attribute vec2 aVertex;
|
|
274
|
-
attribute vec2 aUV;
|
|
275
|
-
attribute vec4 aColor;
|
|
276
|
-
|
|
277
|
-
attribute vec2 aPosition;
|
|
278
|
-
attribute float aRotation;
|
|
279
|
-
|
|
280
|
-
uniform mat3 uTranslationMatrix;
|
|
281
|
-
uniform float uRound;
|
|
282
|
-
uniform vec2 uResolution;
|
|
283
|
-
uniform vec4 uColor;
|
|
284
|
-
|
|
285
|
-
varying vec2 vUV;
|
|
286
|
-
varying vec4 vColor;
|
|
287
|
-
|
|
288
|
-
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
289
|
-
{
|
|
290
|
-
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
void main(void){
|
|
294
|
-
float cosRotation = cos(aRotation);
|
|
295
|
-
float sinRotation = sin(aRotation);
|
|
296
|
-
float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
|
|
297
|
-
float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
|
|
298
|
-
|
|
299
|
-
vec2 v = vec2(x, y);
|
|
300
|
-
v = v + aPosition;
|
|
301
|
-
|
|
302
|
-
gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
303
|
-
|
|
304
|
-
if(uRound == 1.0)
|
|
305
|
-
{
|
|
306
|
-
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
vUV = aUV;
|
|
310
|
-
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
|
|
311
|
-
}
|
|
312
|
-
`});var pu,zg=p(()=>{pu=`
|
|
313
|
-
struct ParticleUniforms {
|
|
314
|
-
uTranslationMatrix:mat3x3<f32>,
|
|
315
|
-
uColor:vec4<f32>,
|
|
316
|
-
uRound:f32,
|
|
317
|
-
uResolution:vec2<f32>,
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
321
|
-
{
|
|
322
|
-
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
|
|
326
|
-
|
|
327
|
-
@group(1) @binding(0) var uTexture: texture_2d<f32>;
|
|
328
|
-
@group(1) @binding(1) var uSampler : sampler;
|
|
329
|
-
|
|
330
|
-
struct VSOutput {
|
|
331
|
-
@builtin(position) position: vec4<f32>,
|
|
332
|
-
@location(0) uv : vec2<f32>,
|
|
333
|
-
@location(1) color : vec4<f32>,
|
|
334
|
-
};
|
|
335
|
-
@vertex
|
|
336
|
-
fn mainVertex(
|
|
337
|
-
@location(0) aVertex: vec2<f32>,
|
|
338
|
-
@location(1) aPosition: vec2<f32>,
|
|
339
|
-
@location(2) aUV: vec2<f32>,
|
|
340
|
-
@location(3) aColor: vec4<f32>,
|
|
341
|
-
@location(4) aRotation: f32,
|
|
342
|
-
) -> VSOutput {
|
|
343
|
-
|
|
344
|
-
let v = vec2(
|
|
345
|
-
aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
|
|
346
|
-
aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
|
|
347
|
-
) + aPosition;
|
|
348
|
-
|
|
349
|
-
var position = vec4((uniforms.uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
350
|
-
|
|
351
|
-
if(uniforms.uRound == 1.0) {
|
|
352
|
-
position = vec4(roundPixels(position.xy, uniforms.uResolution), position.zw);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;
|
|
356
|
-
|
|
357
|
-
return VSOutput(
|
|
358
|
-
position,
|
|
359
|
-
aUV,
|
|
360
|
-
vColor,
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
@fragment
|
|
365
|
-
fn mainFragment(
|
|
366
|
-
@location(0) uv: vec2<f32>,
|
|
367
|
-
@location(1) color: vec4<f32>,
|
|
368
|
-
@builtin(position) position: vec4<f32>,
|
|
369
|
-
) -> @location(0) vec4<f32> {
|
|
370
|
-
|
|
371
|
-
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
372
|
-
|
|
373
|
-
return sample;
|
|
374
|
-
}`});var sa,Hg=p(()=>{Ht();Z();tr();pr();we();rt();Br();Og();Ng();zg();sa=class extends St{constructor(){let t=vt.from({vertex:Lg,fragment:Dg}),e=Tt.from({fragment:{source:pu,entryPoint:"mainFragment"},vertex:{source:pu,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:A.WHITE.source,uSampler:new te({}),uniforms:{uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new $(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Bi,mu=p(()=>{Z();qt();As();Pe();Mi();Ug();Hg();Bi=class{constructor(t,e){this.state=Et.for2d(),this.localUniforms=new ut({uTranslationMatrix:{value:new B,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 sa,this.state=Et.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 ia({size:t.particleChildren.length,properties:t._properties}),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=Ze(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Ue(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.renderer=null,this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Ws,Wg=p(()=>{P();Rg();mu();Ws=class extends Bi{constructor(t){super(t,new ra)}};Ws.extension={type:[g.WebGLPipes],name:"particle"}});var oa,Vg=p(()=>{"use strict";oa=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Vs,Xg=p(()=>{P();Vg();mu();Vs=class extends Bi{constructor(t){super(t,new oa)}};Vs.extension={type:[g.WebGPUPipes],name:"particle"}});var gu=p(()=>{P();Wg();Xg();U.add(Ws);U.add(Vs)});function Xs(i,t){let{texture:e,bounds:r}=i,s=t._style._getFinalPadding();Rn(r,t._anchor,e);let o=t._anchor._x*s*2,n=t._anchor._y*s*2;r.minX-=s-o,r.minY-=s-n,r.maxX-=s-o,r.maxY-=s-n}var xu=p(()=>{_c()});var De,Ys=p(()=>{"use strict";De=class{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(){}}});var na,Yg=p(()=>{Ys();na=class extends De{constructor(t){super(),this._renderer=t,t.runners.resolutionChange.add(this)}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate()}destroy(){let{canvasText:t}=this._renderer;t.getReferenceCount(this.currentKey)>0?t.decreaseReferenceCount(this.currentKey):this.texture&&t.returnTexture(this.texture),this._renderer.runners.resolutionChange.remove(this),this._renderer=null}}});var js,jg=p(()=>{P();xu();Yg();js=class{constructor(t){this._renderer=t}validateRenderable(t){let e=this._getGpuText(t),r=t.styleKey;return e.currentKey!==r?!0:t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);if(t._didTextUpdate){let s=t._autoResolution?this._renderer.resolution:t.resolution;(r.currentKey!==t.styleKey||t.resolution!==s)&&this._updateGpuText(t),t._didTextUpdate=!1,Xs(r,t)}this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new na(this._renderer);return e.currentKey="--",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}};js.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"text"}});var $g,er,aa=p(()=>{Z();Gt();$g={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"}},er=class{constructor(t,e){this.uid=Y("fillPattern"),this._tick=0,this.transform=new B,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=$g[e].addressModeU,t.source.style.addressModeV=$g[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}});var Kg=ar((vk,qg)=>{qg.exports=uw;var _u={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},cw=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function uw(i){var t=[];return i.replace(cw,function(e,r,s){var o=r.toLowerCase();for(s=dw(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==_u[o])return s.unshift(r),t.push(s);if(s.length<_u[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,_u[o])))}}),t}var hw=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function dw(i){var t=i.match(hw);return t?t.map(Number):[]}});function Qg(i,t){let e=(0,Zg.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],c=l[0],u=l;switch(c){case"M":o=u[1],n=u[2],t.moveTo(o,n);break;case"m":o+=u[1],n+=u[2],t.moveTo(o,n);break;case"H":o=u[1],t.lineTo(o,n);break;case"h":o+=u[1],t.lineTo(o,n);break;case"V":n=u[1],t.lineTo(o,n);break;case"v":n+=u[1],t.lineTo(o,n);break;case"L":o=u[1],n=u[2],t.lineTo(o,n);break;case"l":o+=u[1],n+=u[2],t.lineTo(o,n);break;case"C":o=u[5],n=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case"c":t.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case"S":o=u[3],n=u[4],t.bezierCurveToShort(u[1],u[2],o,n);break;case"s":t.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"Q":o=u[3],n=u[4],t.quadraticCurveTo(u[1],u[2],o,n);break;case"q":t.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"T":o=u[1],n=u[2],t.quadraticCurveToShort(o,n);break;case"t":o+=u[1],n+=u[2],t.quadraticCurveToShort(o,n);break;case"A":o=u[6],n=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"a":o+=u[6],n+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:k(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var Zg,Jg=p(()=>{Zg=Pl(Kg(),1);st()});var la,tx=p(()=>{It();la=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*r,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(r-l)}getBounds(t){return t||(t=new X),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}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var ca,ex=p(()=>{It();ca=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),l=r-a,c=o-l,u=n-l,h=o+a,d=n+a,f=t-this.x,m=e-this.y,_=f*f/(c*c)+m*m/(u*u),x=f*f/(h*h)+m*m/(d*d);return _>1&&x<=1}getBounds(t){return t||(t=new X),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}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function rx(i,t,e,r,s,o){let n=i-e,a=t-r,l=s-e,c=o-r,u=n*l+a*c,h=l*l+c*c,d=-1;h!==0&&(d=u/h);let f,m;d<0?(f=e,m=r):d>1?(f=s,m=o):(f=e+d*l,m=r+d*c);let _=i-f,x=t-m;return _*_+x*x}var ix=p(()=>{"use strict"});var fw,pw,Ri,sx=p(()=>{pt();ix();It();Ri=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],l=e[(s+3)%r];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(fw),r=t.getBounds(pw);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],u=this.points[n*2+1];l>e!=u>e&&t<(c-a)*((e-l)/(u-l))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;u<c;u+=2){let h=l[u],d=l[u+1],f=l[(u+2)%l.length],m=l[(u+3)%l.length],_=rx(t,e,h,d,f,m),x=Math.sign((f-h)*(e-d)-(m-d)*(t-h));if(_<=(x<0?a:n))return!0}return!1}getBounds(t){t||(t=new X);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let c=e[a],u=e[a+1];r=c<r?c:r,s=c>s?c:s,o=u<o?u:o,n=u>n?u:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return O("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return O("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}});var ua,ha,ox=p(()=>{It();ua=(i,t,e,r,s,o,n)=>{let a=i-e,l=t-r,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},ha=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new X),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(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){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,u=r*(1-s),h=r-u,d=o+c,f=n+c,m=a-c*2,_=l-c*2,x=o+a,y=n+l;return(t>=o-u&&t<=o+h||t>=x-h&&t<=x+u)&&e>=f&&e<=f+_||(e>=n-u&&e<=n+h||e>=y-h&&e<=y+u)&&t>=d&&t<=d+m?!0:t<d&&e<f&&ua(t,e,d,f,c,h,u)||t>x-c&&e<f&&ua(t,e,x-c,f,c,h,u)||t>x-c&&e>y-c&&ua(t,e,x-c,y-c,c,h,u)||t<d&&e>y-c&&ua(t,e,d,y-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function fa(i,t,e,r,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??Ai.defaultOptions.bezierSmoothness)),d=(gw-h)/1;return d*=d,xw(t,e,r,s,o,n,a,l,i,d),i}function xw(i,t,e,r,s,o,n,a,l,c){bu(i,t,e,r,s,o,n,a,l,c,0),l.push(n,a)}function bu(i,t,e,r,s,o,n,a,l,c,u){if(u>mw)return;let h=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,_=(r+o)/2,x=(s+n)/2,y=(o+a)/2,b=(d+m)/2,v=(f+_)/2,T=(m+x)/2,E=(_+y)/2,S=(b+T)/2,w=(v+E)/2;if(u>0){let G=n-i,C=a-t,M=Math.abs((e-n)*C-(r-a)*G),F=Math.abs((s-n)*C-(o-a)*G),R,W;if(M>da&&F>da){if((M+F)*(M+F)<=c*(G*G+C*C)){if(Fi<yu){l.push(S,w);return}let q=Math.atan2(o-r,s-e);if(R=Math.abs(q-Math.atan2(r-t,e-i)),W=Math.abs(Math.atan2(a-o,n-s)-q),R>=h&&(R=2*h-R),W>=h&&(W=2*h-W),R+W<Fi){l.push(S,w);return}if(jr!==0){if(R>jr){l.push(e,r);return}if(W>jr){l.push(s,o);return}}}}else if(M>da){if(M*M<=c*(G*G+C*C)){if(Fi<yu){l.push(S,w);return}if(R=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),R>=h&&(R=2*h-R),R<Fi){l.push(e,r),l.push(s,o);return}if(jr!==0&&R>jr){l.push(e,r);return}}}else if(F>da){if(F*F<=c*(G*G+C*C)){if(Fi<yu){l.push(S,w);return}if(R=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),R>=h&&(R=2*h-R),R<Fi){l.push(e,r),l.push(s,o);return}if(jr!==0&&R>jr){l.push(s,o);return}}}else if(G=S-(i+n)/2,C=w-(t+a)/2,G*G+C*C<=c){l.push(S,w);return}}bu(i,t,d,f,b,v,S,w,l,c,u+1),bu(S,w,T,E,x,y,n,a,l,c,u+1)}var mw,da,gw,yu,Fi,jr,vu=p(()=>{Jn();mw=8,da=11920929e-14,gw=1,yu=.01,Fi=0,jr=0});function ax(i,t,e,r,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Ai.defaultOptions.bezierSmoothness)),u=(bw-c)/1;return u*=u,Tw(t,e,r,s,o,n,i,u),i}function Tw(i,t,e,r,s,o,n,a){Tu(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Tu(i,t,e,r,s,o,n,a,l){if(l>_w)return;let c=Math.PI,u=(t+r)/2,h=(e+s)/2,d=(r+o)/2,f=(s+n)/2,m=(u+d)/2,_=(h+f)/2,x=o-t,y=n-e,b=Math.abs((r-o)*y-(s-n)*x);if(b>yw){if(b*b<=a*(x*x+y*y)){if(nx<vw){i.push(m,_);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=c&&(v=2*c-v),v<nx){i.push(m,_);return}}}else if(x=m-(t+o)/2,y=_-(e+n)/2,x*x+y*y<=a){i.push(m,_);return}Tu(i,t,e,u,h,m,_,a,l+1),Tu(i,m,_,d,f,o,n,a,l+1)}var _w,yw,bw,vw,nx,lx=p(()=>{Jn();_w=8,yw=11920929e-14,bw=1,vw=.01,nx=0});function pa(i,t,e,r,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=n?-1:1;for(let h=0;h<a+1;h++){let d=Math.cos(u),f=Math.sin(u),m=t+d*r,_=e+f*r;i.push(m,_),u+=c}}var Su=p(()=>{"use strict"});function cx(i,t,e,r,s,o){let n=i[i.length-2],l=i[i.length-1]-e,c=n-t,u=s-e,h=r-t,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=l*l+c*c,m=u*u+h*h,_=l*u+c*h,x=o*Math.sqrt(f)/d,y=o*Math.sqrt(m)/d,b=x*_/f,v=y*_/m,T=x*h+y*c,E=x*u+y*l,S=c*(y+b),w=l*(y+b),G=h*(x+v),C=u*(x+v),M=Math.atan2(w-E,S-T),F=Math.atan2(C-E,G-T);pa(i,T+t,E+e,o,M,F,c*u>h*l)}var ux=p(()=>{Su()});function Sw(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function dx(i,t,e,r,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*$s/360),h=Math.cos(a*$s/360),d=h*(t-r)/2+u*(e-s)/2,f=-u*(t-r)/2+h*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),ww(t,e,r,s,o,n,l,c,u,h,d,f,wu);let{ang1:_,ang2:x}=wu,{centerX:y,centerY:b}=wu,v=Math.abs(x)/($s/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);x/=T;let E=i[i.length-2],S=i[i.length-1],w={x:0,y:0};for(let G=0;G<T;G++){let C=Sw(_,x),{x:M,y:F}=Pu(C[0],o,n,h,u,y,b,w),{x:R,y:W}=Pu(C[1],o,n,h,u,y,b,w),{x:q,y:Ft}=Pu(C[2],o,n,h,u,y,b,w);fa(i,E,S,M,F,R,W,q,Ft),E=q,S=Ft,_+=x}}var $s,wu,Pu,hx,ww,fx=p(()=>{vu();$s=Math.PI*2,wu={centerX:0,centerY:0,ang1:0,ang2:0},Pu=({x:i,y:t},e,r,s,o,n,a,l)=>{i*=e,t*=r;let c=s*i-o*t,u=o*i+s*t;return l.x=c+n,l.y=u+a,l};hx=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},ww=(i,t,e,r,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),_=Math.pow(u,2),x=Math.pow(h,2),y=f*m-f*x-m*_;y<0&&(y=0),y/=f*x+m*_,y=Math.sqrt(y)*(n===a?-1:1);let b=y*s/o*h,v=y*-o/s*u,T=c*b-l*v+(i+e)/2,E=l*b+c*v+(t+r)/2,S=(u-b)/s,w=(h-v)/o,G=(-u-b)/s,C=(-h-v)/o,M=hx(1,0,S,w),F=hx(S,w,G,C);a===0&&F>0&&(F-=$s),a===1&&F<0&&(F+=$s),d.centerX=T,d.centerY=E,d.ang1=M,d.ang2=F}});function px(i,t,e){let r=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c),h=l/u,d=c/u;return{len:u,nx:h,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let c=t[(n+1)%t.length],u=r(a,o),h=r(a,c);if(u.len<1e-4||h.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(u.nx*h.ny-u.ny*h.nx),f=1,m=!1;u.nx*h.nx-u.ny*-h.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let _=d/2,x,y=Math.abs(Math.cos(_)*l/Math.sin(_));y>Math.min(u.len/2,h.len/2)?(y=Math.min(u.len/2,h.len/2),x=Math.abs(y*Math.sin(_)/Math.cos(_))):x=l;let b=a.x+h.nx*y+-h.ny*x*f,v=a.y+h.ny*y+h.nx*x*f,T=Math.atan2(u.ny,u.nx)+Math.PI/2*f,E=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&i.moveTo(b+Math.cos(T)*x,v+Math.sin(T)*x),i.arc(b,v,x,T,E,m),o=a}}function mx(i,t,e,r){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],c=l.radius??e;if(c<=0){a===0?i.moveTo(l.x,l.y):i.lineTo(l.x,l.y);continue}let u=t[a],h=t[(a+2)%n],d=s(u,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,u,x/d)}let m=s(h,l),_;if(m<1e-4)_=l;else{let x=Math.min(m/2,c);_=o(l,h,x/m)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(l.x,l.y,_.x,_.y,r)}}var gx=p(()=>{"use strict"});var Pw,ma,xx=p(()=>{tx();ex();sx();It();ox();Jt();vu();lx();Su();ux();fx();gx();Pw=new X,ma=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ct,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return pa(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return cx(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let l=this._currentPoly.points;return dx(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return fa(this._currentPoly.points,l.lastX,l.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return ax(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let l=a.shape,c=o?.shape;c&&c.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new X(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new la(t,e,r),s),this}poly(t,e,r){let s=new Ri(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,c=[];for(let u=0;u<s;u++){let h=a-u*l;c.push(t+r*Math.cos(h),e+r*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let l=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-1*Math.PI/2+n,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*u+c,m=t+r*Math.cos(f),_=e+r*Math.sin(f),x=f+Math.PI+h,y=f-Math.PI-h,b=m+o*Math.cos(x),v=_+o*Math.sin(x),T=m+o*Math.cos(y),E=_+o*Math.sin(y);d===0?this.moveTo(b,v):this.lineTo(b,v),this.quadraticCurveTo(m,_,T,E,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?mx(this,t,e,s):px(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+r,c=e+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(t,e+h).arcTo(t+u,e+u,t+h,e,h).lineTo(l-h,e).arcTo(l-u,e+u,l,e+h,h).lineTo(l,c-h).arcTo(l-u,c-u,t+r-h,c,h).lineTo(t+h,c).arcTo(t+u,c-u,t,c-h,h).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),l=t+r,c=e+s,u=[t+a,e,l-a,e,l,e+a,l,c-a,l-a,c,t+a,c,t,c-a,t,e+a];for(let h=u.length-1;h>=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new ca(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new ha(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Ri,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let 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 Ri,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Pw);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function qs(i,t){return i?i.prepend(t):t.clone()}var me,ga=p(()=>{be();Gt();st();Jg();xx();me=class i{constructor(t,e=!1){this.instructions=[],this.uid=Y("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Qg(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new ma(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,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(Q.shared),l=0,c=0;if(!n||n.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=n.data[2],c=n.data[3];let u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,t,e,r,s,o]}),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,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(Q.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let l=o.x,c=o.y;n=l+(l-n),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),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,r,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=r*2,u=Math.PI*2/c,h=[];for(let d=0;d<c;d++){let f=d%2?o:s,m=d*u+l;h.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(h,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,c=0,u=0,h=0,d=0,f=0,m=0,_=0;for(let x=0;x<this.instructions.length;x++){let y=this.instructions[x],b=y.data;switch(y.action){case"moveTo":case"lineTo":l=b[0],c=b[1],b[0]=e*l+s*c+n,b[1]=r*l+o*c+a;break;case"bezierCurveTo":u=b[0],h=b[1],d=b[2],f=b[3],l=b[4],c=b[5],b[0]=e*u+s*h+n,b[1]=r*u+o*h+a,b[2]=e*d+s*f+n,b[3]=r*d+o*f+a,b[4]=e*l+s*c+n,b[5]=r*l+o*c+a;break;case"quadraticCurveTo":u=b[0],h=b[1],l=b[2],c=b[3],b[0]=e*u+s*h+n,b[1]=r*u+o*h+a,b[2]=e*l+s*c+n,b[3]=r*l+o*c+a;break;case"arcToSvg":l=b[5],c=b[6],m=b[0],_=b[1],b[0]=e*m+s*_,b[1]=r*m+o*_,b[5]=e*l+s*c+n,b[6]=r*l+o*c+a;break;case"circle":b[4]=qs(b[3],t);break;case"rect":b[4]=qs(b[4],t);break;case"ellipse":b[8]=qs(b[8],t);break;case"roundRect":b[5]=qs(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=qs(b[2],t);break;default:k("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function gt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Cu=p(()=>{"use strict"});function _x(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=Cw(n);break;case"radialgradient":t.defs[n.id]=Ew(n);break;default:break}}}}function Cw(i){let t=gt(i,"x1",0),e=gt(i,"y1",0),r=gt(i,"x2",1),s=gt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new ie(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let l=i.children[a],c=gt(l,"offset",0),u=$.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function Ew(i){return k("[SVG Parser] Radial gradients are not yet supported"),new ie(0,0,1,0)}var yx=p(()=>{Ht();st();Ei();Cu()});function Eu(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var bx=p(()=>{"use strict"});function Au(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in vx){let a=i.getAttribute(n);a&&Tx(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");vx[c]&&Tx(t,o,c,u.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Tx(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Eu(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=$.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=Eu(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=$.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var vx,Sx=p(()=>{Ht();bx();vx={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 wx(i){if(i.length<=2)return!0;let t=i.map(a=>a.area).sort((a,l)=>l-a),[e,r]=t,s=t[t.length-1],o=e/r,n=r/s;return!(o>3&&n<2)}var Px=p(()=>{"use strict"});function Cx(i){return i.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function Ex(i){let t=i.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;let e=t.map(Number),r=[],s=[];for(let u=0;u<e.length;u+=2)u+1<e.length&&(r.push(e[u]),s.push(e[u+1]));if(r.length===0||s.length===0)return 0;let o=Math.min(...r),n=Math.max(...r),a=Math.min(...s),l=Math.max(...s);return(n-o)*(l-a)}function Mu(i,t){let e=new me(i,!1);for(let r of e.instructions)t.instructions.push(r)}var Ax=p(()=>{ga()});function Mx(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new me};_x(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Au(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Bx(a,e,s,o)}return t}function Bx(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Au(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let l,c,u,h,d,f,m,_,x,y,b,v,T,E,S,w,G;switch(i.nodeName.toLowerCase()){case"path":{E=i.getAttribute("d");let C=i.getAttribute("fill-rule"),M=Cx(E),F=C==="evenodd",R=M.length>1;if(F&&R){let q=M.map(I=>({path:I,area:Ex(I)}));if(q.sort((I,L)=>L.area-I.area),M.length>3||!wx(q))for(let I=0;I<q.length;I++){let L=q[I],wt=I===0;t.context.beginPath();let H=new me(void 0,!0);Mu(L.path,H),t.context.path(H),wt?(e&&t.context.fill(e),r&&t.context.stroke(r)):t.context.cut()}else for(let I=0;I<q.length;I++){let L=q[I],wt=I%2===1;t.context.beginPath();let H=new me(void 0,!0);Mu(L.path,H),t.context.path(H),wt?t.context.cut():(e&&t.context.fill(e),r&&t.context.stroke(r))}}else{let q=C?C==="evenodd":!0;S=new me(E,q),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r)}break}case"circle":m=gt(i,"cx",0),_=gt(i,"cy",0),x=gt(i,"r",0),t.context.ellipse(m,_,x,x),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":l=gt(i,"x",0),c=gt(i,"y",0),w=gt(i,"width",0),G=gt(i,"height",0),y=gt(i,"rx",0),b=gt(i,"ry",0),y||b?t.context.roundRect(l,c,w,G,y||b):t.context.rect(l,c,w,G),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=gt(i,"cx",0),_=gt(i,"cy",0),y=gt(i,"rx",0),b=gt(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,_,y,b),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":u=gt(i,"x1",0),h=gt(i,"y1",0),d=gt(i,"x2",0),f=gt(i,"y2",0),t.context.beginPath(),t.context.moveTo(u,h),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{k(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let C=0;C<s.length;C++)Bx(s[C],t,e,r)}var Rx=p(()=>{st();ga();yx();Cu();Sx();Px();Ax()});function Aw(i){return $.isColorLike(i)}function Fx(i){return i instanceof er}function Gx(i){return i instanceof ie}function Mw(i){return i instanceof A}function Bw(i,t,e){let r=$.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=A.WHITE,{...e,...i}}function Rw(i,t,e){return i.texture=t,{...e,...i}}function Ix(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function kx(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function Fw(i,t){let e={...t,...i},r=$.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function rr(i,t){if(i==null)return null;let e={},r=i;return Aw(i)?Bw(e,i,t):Mw(i)?Rw(e,i,t):Fx(i)?Ix(e,i,t):Gx(i)?kx(e,i,t):r.fill&&Fx(r.fill)?Ix(r,r.fill,t):r.fill&&Gx(r.fill)?kx(r,r.fill,t):Fw(r,t)}function Gi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,c=rr(i,l);return c?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Bu=p(()=>{Ht();rt();Ei();aa()});var Gw,Ux,Ru,Kt,xa=p(()=>{Nt();Ht();Z();be();rt();Gt();pt();Jt();ga();Rx();Bu();Gw=new Q,Ux=new B,Ru=class Oe extends at{constructor(){super(...arguments),this.uid=Y("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new me,this._transform=new B,this._fillStyle={...Oe.defaultFillStyle},this._strokeStyle={...Oe.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ct,this._boundsDirty=!0}clone(){let t=new Oe;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...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=rr(t,Oe.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Gi(t,Oe.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=rr(t,Oe.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=rr(t,Oe.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?$.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new me,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(O(V,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=rr(t,Oe.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(Q.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Gi(t,Oe.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++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,Mx(t,this),this}restore(){let 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:{...this._fillStyle},strokeStyle:{...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,r,s,o,n){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof B?(this._transform.append(t),this):(Ux.set(t,e,r,s,o,n),this._transform.append(Ux),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._boundsDirty=!0,!this.dirty&&(this.emit("update",this,16),this.dirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,c=a.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){let h=c[u].shape;if(!l||!h)continue;let d=c[u].transform,f=d?d.applyInverse(t,Gw):t;if(o.action==="fill")r=h.contains(f.x,f.y);else{let _=l;r=h.strokeContains(f.x,f.y,_.width,_.alignment)}let m=n.hole;if(m){let _=m.shapePath?.shapePrimitives;if(_)for(let x=0;x<_.length;x++)_[x].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(r))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Ru.defaultFillStyle={color:16777215,alpha:1,texture:A.WHITE,matrix:null,fill:null,textureSpace:"local"};Ru.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:A.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Kt=Ru});function Iw(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=ir.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){O(V,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if($.isColorLike(e))r.color=e;else if(e instanceof ie||e instanceof er)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(O(V,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&k("The number of fill colors must match the number of fill gradient stops.");let e=new ie({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=t.fillGradientStops.slice(),s=t.fill.map(o=>$.shared.setValue(o).toNumber());r.forEach((o,n)=>{e.addColorStop(o,s[n])}),i.fill={fill:e}}}var Fu,ir,_a=p(()=>{Nt();Ht();Gt();pt();st();Ei();aa();xa();Bu();Fu=class Ii extends at{constructor(t={}){super(),this.uid=Y("textStyle"),this._tick=0,Iw(t);let e={...Ii.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Ii.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Ii.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._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&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._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({...Kt.defaultFillStyle,...t},()=>{this._fill=rr({...this._originalFill},Kt.defaultFillStyle)})),this._fill=rr(t===0?"black":t,Kt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Kt.defaultStrokeStyle,...t},()=>{this._stroke=Gi({...this._originalStroke},Kt.defaultStrokeStyle)})),this._stroke=Gi(t,Kt.defaultStrokeStyle),this.update())}update(){this._tick++,this.emit("update",this)}reset(){let t=Ii.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return`${this.uid}-${this._tick}`}clone(){return new Ii({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...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){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]===o||(r[s]=o,e?.(s,o),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!($.isColorLike(t)||t instanceof ie||t instanceof er)}};Fu.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Fu.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};ir=Fu});function ya(i,t,e,r){let s=kw;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=ot.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var kw,Gu=p(()=>{$e();Jt();kw=new ct});var Iu,se,ki=p(()=>{it();ds();Ar();Iu=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=D.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=je(t),e=je(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.resetTransform(),t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},se=new Iu;de.register(se)});function Uw(i,t){$r||($r=D.get().createCanvas(256,128),sr=$r.getContext("2d",{willReadFrequently:!0}),sr.globalCompositeOperation="copy",sr.globalAlpha=1),($r.width<i||$r.height<t)&&($r.width=je(i),$r.height=je(t))}function Dx(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function Ox(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function Lx(...i){let t=i[0];t.canvas||(t={canvas:i[0],resolution:i[1]});let{canvas:e}=t,r=Math.min(t.resolution??1,1),s=t.width??e.width,o=t.height??e.height,n=t.output;if(Uw(s,o),!sr)throw new TypeError("Failed to get canvas 2D context");sr.drawImage(e,0,0,s,o,0,0,s*r,o*r);let l=sr.getImageData(0,0,s,o).data,c=0,u=0,h=s-1,d=o-1;for(;u<o&&Dx(l,s,u);)++u;if(u===o)return X.EMPTY;for(;Dx(l,s,d);)--d;for(;Ox(l,s,c,u,d);)++c;for(;Ox(l,s,h,u,d);)--h;return++h,++d,sr.globalCompositeOperation="source-over",sr.strokeRect(c,u,h-c,d-u),sr.globalCompositeOperation="copy",n??(n=new X),n.set(c/r,u/r,(h-c)/r,(d-u)/r),n}var $r,sr,Nx=p(()=>{it();ds();It();$r=null,sr=null});function ba(i=1e3,t=0,e=!1){if(isNaN(i)||i<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof e!="boolean")throw new TypeError("Invalid resetTtl value");return new ku(i,t,e)}var ku,Uu=p(()=>{ku=class{constructor(t=0,e=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=r,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map(e=>[e,this.get(e)])}evict(t=!1){if(t||this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){let t=[],e=this.first;for(;e!==null;)t.push(e.key),e=e.next;return t}setWithEvicted(t,e,r=this.resetTtl){let s=null;if(this.has(t))this.set(t,e,!0,r);else{this.max>0&&this.size===this.max&&(s={...this.first},this.evict(!0));let o=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=o:this.last.next=o,this.last=o}return s}set(t,e,r=!1,s=this.resetTtl){let o=this.items[t];return r||o!==void 0?(o.value=e,r===!1&&s&&(o.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(o)):(this.max>0&&this.size===this.max&&this.evict(!0),o=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=o:this.last.next=o,this.last=o),this}values(t=this.keys()){return t.map(e=>this.get(e))}}});function qr(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!Dw.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var Dw,va=p(()=>{"use strict";Dw=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Du,Ce,oe,Ks=p(()=>{Uu();it();va();Du={willReadFrequently:!0},Ce=class z{static get experimentalLetterSpacingSupported(){let t=z._experimentalLetterSpacingSupported;if(t===void 0){let e=D.get().getCanvasRenderingContext2D().prototype;t=z._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,l,c){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(t=" ",e,r=z._canvas,s=e.wordWrap){let o=`${t}-${e.styleKey}-wordWrap-${s}`;if(z._measurementCache.has(o))return z._measurementCache.get(o);let n=qr(e),a=z.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=z.__context;l.font=n;let u=(s?z._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let b=0;b<u.length;b++){let v=z._measureText(u[b],e.letterSpacing,l);h[b]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let _=e.lineHeight||a.fontSize,x=Math.max(_,a.fontSize+f)+(u.length-1)*(_+e.leading);e.dropShadow&&(x+=e.dropShadow.distance);let y=new z(t,e,m,x,u,h,_+e.leading,d,a);return z._measurementCache.set(o,y),y}static _measureText(t,e,r){let s=!1;z.experimentalLetterSpacingSupported&&(z.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,c-=e;else{let u=(z.graphemeSegmenter(t).length-1)*e;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(t,e,r=z._canvas){let s=r.getContext("2d",Du),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=e,h=z._collapseSpaces(u),d=z._collapseNewlines(u),f=!h,m=e.wordWrapWidth+c,_=z._tokenize(t);for(let x=0;x<_.length;x++){let y=_[x];if(z._isNewline(y)){if(!d){a+=z._addLine(n),f=!h,n="",o=0;continue}y=" "}if(h){let v=z.isBreakingSpace(y),T=z.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let b=z._getFromCache(y,c,l,s);if(b>m)if(n!==""&&(a+=z._addLine(n),n="",o=0),z.canBreakWords(y,e.breakWords)){let v=z.wordWrapSplit(y);for(let T=0;T<v.length;T++){let E=v[T],S=E,w=1;for(;v[T+w];){let C=v[T+w];if(!z.canBreakChars(S,C,y,T,e.breakWords))E+=C;else break;S=C,w++}T+=w-1;let G=z._getFromCache(E,c,l,s);G+o>m&&(a+=z._addLine(n),f=!1,n="",o=0),n+=E,o+=G}}else{n.length>0&&(a+=z._addLine(n),n="",o=0);let v=x===_.length-1;a+=z._addLine(y,!v),f=!1,n="",o=0}else b+o>m&&(f=!1,a+=z._addLine(n),n="",o=0),(n.length>0||!z.isBreakingSpace(y)||f)&&(n+=y,o+=b)}return a+=z._addLine(n,!1),a}static _addLine(t,e=!0){return t=z._trimRight(t),t=e?`${t}
|
|
375
|
-
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=z._measureText(t,e,s)+e,r[t]=o),o}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--){let r=t[e];if(!z.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:z._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:z._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(z.isBreakingSpace(o,n)||z._isNewline(o)){r!==""&&(e.push(r),r=""),o==="\r"&&n===`
|
|
376
|
-
`?(e.push(`\r
|
|
377
|
-
`),s++):e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return z.graphemeSegmenter(t)}static measureFont(t){if(z._fonts[t])return z._fonts[t];let e=z._context;e.font=t;let r=e.measureText(z.METRICS_STRING+z.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return z._fonts[t]=s,s}static clearMetrics(t=""){t?delete z._fonts[t]:z._fonts={}}static get _canvas(){if(!z.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Du)?.measureText)return z.__canvas=e,e;t=D.get().createCanvas()}catch{t=D.get().createCanvas()}t.width=t.height=10,z.__canvas=t}return z.__canvas}static get _context(){return z.__context||(z.__context=z._canvas.getContext("2d",Du)),z.__context}};Ce.METRICS_STRING="|\xC9q\xC5";Ce.BASELINE_SYMBOL="M";Ce.BASELINE_MULTIPLIER=1.4;Ce.HEIGHT_MULTIPLIER=2;Ce.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>{let e=i.segment(t),r=[],s=0;for(let o of e)r[s++]=o.segment;return r}}return i=>[...i]})();Ce.experimentalLetterSpacing=!1;Ce._fonts={};Ce._newlines=[10,13];Ce._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Ce._measurementCache=ba(1e3);oe=Ce});function Ui(i,t,e,r=0){if(i.texture===A.WHITE&&!i.fill)return $.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof er){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof ie){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+r,l=e.height+r);let c,u=!1;if(o){let{start:h,end:d}=s;c=t.createLinearGradient(h.x*a,h.y*l,d.x*a,d.y*l),u=Math.abs(d.x-h.x)<Math.abs((d.y-h.y)*.1)}else{let{center:h,innerRadius:d,outerCenter:f,outerRadius:m}=s;c=t.createRadialGradient(h.x*a,h.y*l,d*a,f.x*a,f.y*l,m*a)}if(u&&n&&e){let h=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/l;s.colorStops.forEach(m=>{let _=f+m.offset*h;c.addColorStop(Math.floor(_*zx)/zx,$.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,$.shared.setValue(h.color).toHex())});return c}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(B.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return k("FillStyle not recognised",i),"red"}var zx,Ou=p(()=>{Ht();Z();rt();st();Ei();aa();zx=1e5});var Hx,Lu,Ta,Wx=p(()=>{Ht();It();ki();Nx();Ks();va();Ou();Hx=new X,Lu=class{getCanvasAndContext(t){let{text:e,style:r,resolution:s=1}=t,o=r._getFinalPadding(),n=oe.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,n.width)+o*2)*s),l=Math.ceil(Math.ceil(Math.max(1,n.height)+o*2)*s),c=se.getOptimalCanvasAndContext(a,l);this._renderTextToCanvas(e,r,o,s,c);let u=r.trim?Lx({canvas:c.canvas,width:a,height:l,resolution:1,output:Hx}):Hx.set(0,0,a,l);return{canvasAndContext:c,frame:u}}returnCanvasAndContext(t){se.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,r,s,o){let{canvas:n,context:a}=o,l=qr(e),c=oe.measureText(t||" ",e),u=c.lines,h=c.lineHeight,d=c.lineWidths,f=c.maxLineWidth,m=c.fontProperties,_=n.height;if(a.resetTransform(),a.scale(s,s),a.textBaseline=e.textBaseline,e._stroke?.width){let v=e._stroke;a.lineWidth=v.width,a.miterLimit=v.miterLimit,a.lineJoin=v.join,a.lineCap=v.cap}a.font=l;let x,y,b=e.dropShadow?2:1;for(let v=0;v<b;++v){let T=e.dropShadow&&v===0,E=T?Math.ceil(Math.max(1,_)+r*2):0,S=E*s;if(T){a.fillStyle="black",a.strokeStyle="black";let C=e.dropShadow,M=C.color,F=C.alpha;a.shadowColor=$.shared.setValue(M).setAlpha(F).toRgbaString();let R=C.blur*s,W=C.distance*s;a.shadowBlur=R,a.shadowOffsetX=Math.cos(C.angle)*W,a.shadowOffsetY=Math.sin(C.angle)*W+S}else{if(a.fillStyle=e._fill?Ui(e._fill,a,c,r*2):null,e._stroke?.width){let C=e._stroke.width*.5+r*2;a.strokeStyle=Ui(e._stroke,a,c,C)}a.shadowColor="black"}let w=(h-m.fontSize)/2;h-m.fontSize<0&&(w=0);let G=e._stroke?.width??0;for(let C=0;C<u.length;C++)x=G/2,y=G/2+C*h+m.ascent+w,e.align==="right"?x+=f-d[C]:e.align==="center"&&(x+=(f-d[C])/2),e._stroke?.width&&this._drawLetterSpacing(u[C],e,o,x+r,y+r-E,!0),e._fill!==void 0&&this._drawLetterSpacing(u[C],e,o,x+r,y+r-E)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,l=e.letterSpacing,c=!1;if(oe.experimentalLetterSpacingSupported&&(oe.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||c){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let u=s,h=oe.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let m=0;m<h.length;++m){let _=h[m];n?a.strokeText(_,u,o):a.fillText(_,u,o);let x="";for(let y=m+1;y<h.length;++y)x+=h[y];f=a.measureText(x).width,u+=d-f+l,d=f}}},Ta=new Lu});var Zs,Vx=p(()=>{P();$e();Br();pt();_a();Gu();Wx();Zs=class{constructor(t){this._activeTextures={},this._renderer=t}getTexture(t,e,r,s){typeof t=="string"&&(O("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof ir||(t.style=new ir(t.style)),t.textureStyle instanceof te||(t.textureStyle=new te(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:o,style:n,textureStyle:a}=t,l=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:u}=Ta.getCanvasAndContext({text:o,style:n,resolution:l}),h=ya(u.canvas,c.width,c.height,l);if(a&&(h.source.style=a),n.trim&&(c.pad(n.padding),h.frame.copyFrom(c),h.frame.scale(1/l),h.updateUvs()),n.filters){let d=this._applyFilters(h,n.filters);return this.returnTexture(h),Ta.returnCanvasAndContext(u),d}return this._renderer.texture.initSource(h._source),Ta.returnCanvasAndContext(u),h}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ot.returnTexture(t,!0)}renderTextToCanvas(){O("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let r=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle});return this._activeTextures[e]={texture:r,usageCount:1},r}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,s=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(r,!1),s}destroy(){this._renderer=null;for(let t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}};Zs.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"canvasText"}});var Nu=p(()=>{P();jg();Vx();U.add(Zs);U.add(js)});var Sa,Xx=p(()=>{pt();mc();xa();Sa=class i extends fi{constructor(t){t instanceof Kt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Kt,this._context.on("update",this.onViewUpdate,this),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!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?.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 i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){O(V,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){O(V,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){O(V,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Kt.defaultStrokeStyle.width||t.color!==Kt.defaultStrokeStyle.color||t.alpha!==Kt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return O(V,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return O(V,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return O(V,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return O(V,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return O(V,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return O(V,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var Yx,jx,$x=p(()=>{"use strict";Yx={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
378
|
-
struct LocalUniforms {
|
|
379
|
-
uColor:vec4<f32>,
|
|
380
|
-
uTransformMatrix:mat3x3<f32>,
|
|
381
|
-
uDistance: f32,
|
|
382
|
-
uRound:f32,
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
386
|
-
`,main:`
|
|
387
|
-
vColor *= localUniforms.uColor;
|
|
388
|
-
modelMatrix *= localUniforms.uTransformMatrix;
|
|
389
|
-
`,end:`
|
|
390
|
-
if(localUniforms.uRound == 1)
|
|
391
|
-
{
|
|
392
|
-
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
393
|
-
}
|
|
394
|
-
`},fragment:{header:`
|
|
395
|
-
struct LocalUniforms {
|
|
396
|
-
uColor:vec4<f32>,
|
|
397
|
-
uTransformMatrix:mat3x3<f32>,
|
|
398
|
-
uDistance: f32
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
402
|
-
`,main:`
|
|
403
|
-
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
404
|
-
`}},jx={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
405
|
-
uniform mat3 uTransformMatrix;
|
|
406
|
-
uniform vec4 uColor;
|
|
407
|
-
uniform float uRound;
|
|
408
|
-
`,main:`
|
|
409
|
-
vColor *= uColor;
|
|
410
|
-
modelMatrix *= uTransformMatrix;
|
|
411
|
-
`,end:`
|
|
412
|
-
if(uRound == 1.)
|
|
413
|
-
{
|
|
414
|
-
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
415
|
-
}
|
|
416
|
-
`},fragment:{header:`
|
|
417
|
-
uniform float uDistance;
|
|
418
|
-
`,main:`
|
|
419
|
-
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
420
|
-
`}}});var qx,Kx,Zx=p(()=>{"use strict";qx={name:"msdf-bit",fragment:{header:`
|
|
421
|
-
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
422
|
-
|
|
423
|
-
// MSDF
|
|
424
|
-
var median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
425
|
-
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
426
|
-
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
427
|
-
|
|
428
|
-
// SDF
|
|
429
|
-
median = min(median, msdfColor.a);
|
|
430
|
-
|
|
431
|
-
var screenPxDistance = distance * (median - 0.5);
|
|
432
|
-
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
433
|
-
if (median < 0.01) {
|
|
434
|
-
alpha = 0.0;
|
|
435
|
-
} else if (median > 0.99) {
|
|
436
|
-
alpha = 1.0;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// Gamma correction for coverage-like alpha
|
|
440
|
-
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
|
|
441
|
-
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
|
|
442
|
-
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
|
|
443
|
-
|
|
444
|
-
return coverage;
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
`}},Kx={name:"msdf-bit",fragment:{header:`
|
|
448
|
-
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
449
|
-
|
|
450
|
-
// MSDF
|
|
451
|
-
float median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
452
|
-
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
453
|
-
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
454
|
-
|
|
455
|
-
// SDF
|
|
456
|
-
median = min(median, msdfColor.a);
|
|
457
|
-
|
|
458
|
-
float screenPxDistance = distance * (median - 0.5);
|
|
459
|
-
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
460
|
-
|
|
461
|
-
if (median < 0.01) {
|
|
462
|
-
alpha = 0.0;
|
|
463
|
-
} else if (median > 0.99) {
|
|
464
|
-
alpha = 1.0;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// Gamma correction for coverage-like alpha
|
|
468
|
-
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
469
|
-
float gamma = mix(1.0, 1.0 / 2.2, luma);
|
|
470
|
-
float coverage = pow(shapeColor.a * alpha, gamma);
|
|
471
|
-
|
|
472
|
-
return coverage;
|
|
473
|
-
}
|
|
474
|
-
`}}});var zu,Hu,wa,Qx=p(()=>{Z();gr();Is();ks();xr();Yn();we();qt();$x();Zx();wa=class extends St{constructor(t){let e=new ut({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});zu??(zu=Re({name:"sdf-shader",bits:[bi,Ti(t),Yx,qx,Ge]})),Hu??(Hu=Fe({name:"sdf-shader",bits:[vi,Si(t),jx,Kx,Ie]})),super({glProgram:Hu,gpuProgram:zu,resources:{localUniforms:e,batchSamplers:wi(t)}})}}});var Di,Wu=p(()=>{Nt();pt();Di=class extends at{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 O(V,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return O(V,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return O(V,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return O(V,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return O(V,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});var Jx,Vu,e_=p(()=>{Ht();It();ki();mi();rt();Br();pt();Ks();va();Ou();_a();Wu();Jx=class t_ extends Di{constructor(t){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;let e={...t_.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=A.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=qr(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof te?e.textureStyle:new te(e.textureStyle)),this.fontMetrics=oe.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=oe.graphemeSegmenter(t).filter(x=>!this._currentChars.includes(x)).filter((x,y,b)=>b.indexOf(x)===y);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,l=this._currentX,c=this._currentY,u=this._currentMaxCharHeight,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,d=this._padding*h,f=!1,m=s.width/this.resolution,_=s.height/this.resolution;for(let x=0;x<e.length;x++){let y=e[x],b=oe.measureText(y,a,s,!1);b.lineHeight=b.height;let v=b.width*h,T=Math.ceil((a.fontStyle==="italic"?2:1)*v),E=b.height*h,S=T+d*2,w=E+d*2;if(f=!1,y!==`
|
|
475
|
-
`&&y!=="\r"&&y!==" "&&y!==" "&&(f=!0,u=Math.ceil(Math.max(w,u))),l+S>m&&(c+=u,u=w,l=0,c+u>_)){n.update();let C=this._nextPage();s=C.canvasAndContext.canvas,o=C.canvasAndContext.context,n=C.texture.source,l=0,c=0,u=0}let G=v/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:G,kerning:{}},f){this._drawGlyph(o,b,l+d,c+d,h,a);let C=n.width*h,M=n.height*h,F=new X(l/C*n.width,c/M*n.height,S/C*n.width,w/M*n.height);this.chars[y].texture=new A({source:n,frame:F}),l+=Math.ceil(S)}}n.update(),this._currentX=l,this._currentY=c,this._currentMaxCharHeight=u,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return O(V,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=r[o];l||(l=r[o]=e.measureText(o).width);let c=r[a];c||(c=r[a]=e.measureText(a).width);let u=e.measureText(o+a).width,h=u-(l+c);h&&(this.chars[o].kerning[a]=h),u=e.measureText(o+a).width,h=u-(l+c),h&&(this.chars[a].kerning[o]=h)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=se.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new A({source:new ee({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(s.source.style=this._textureStyle);let o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=qr(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=Ui(s,t)),e._fill&&(t.fillStyle=Ui(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=$.shared.setValue(n.color).toArray(),l=n.blur*r,c=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*c,t.shadowOffsetY=Math.sin(n.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,s,o,n){let a=e.text,l=e.fontProperties,u=(n._stroke?.width??0)*o,h=r+u/2,d=s-u/2,f=l.descent*o,m=e.lineHeight*o,_=!1;n.stroke&&u&&(_=!0,t.strokeText(a,h,d+m-f));let{shadowBlur:x,shadowOffsetX:y,shadowOffsetY:b}=t;n._fill&&(_&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillText(a,h,d+m-f)),_&&(t.shadowBlur=x,t.shadowOffsetX=y,t.shadowOffsetY=b)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];se.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};Jx.defaultOptions={textureSize:512,style:new ir,mipmap:!0};Vu=Jx});function Pa(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},c=e.baseMeasurementFontSize/t.fontSize,u=t.letterSpacing*c,h=t.wordWrapWidth*c,d=t.lineHeight?t.lineHeight*c:e.lineHeight,f=t.wordWrap&&t.breakWords,m=y=>{let b=o.width;for(let v=0;v<l.index;v++){let T=y.positions[v];o.chars.push(y.chars[v]),o.charPositions.push(T+b)}o.width+=y.width,a=!1,l.width=0,l.index=0,l.chars.length=0},_=()=>{let y=o.chars.length-1;if(r){let b=o.chars[y];for(;b===" ";)o.width-=e.chars[b].xAdvance,b=o.chars[--y]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=d},x=y=>y-u>h;for(let y=0;y<i.length+1;y++){let b,v=y===i.length;v||(b=i[y]);let T=e.chars[b]||e.chars[" "];if(/(?:\s)/.test(b)||b==="\r"||b===`
|
|
476
|
-
`||v){if(!a&&t.wordWrap&&x(o.width+l.width)?(_(),m(l),v||o.charPositions.push(0)):(l.start=o.width,m(l),v||o.charPositions.push(0)),b==="\r"||b===`
|
|
477
|
-
`)_();else if(!v){let G=T.xAdvance+(T.kerning[n]||0)+u;o.width+=G,o.spaceWidth=G,o.spacesIndex.push(o.charPositions.length),o.chars.push(b)}}else{let w=T.kerning[n]||0,G=T.xAdvance+w+u;f&&x(o.width+l.width+G)&&(m(l),_()),l.positions[l.index++]=l.width+w,l.chars.push(b),l.width+=G}n=b}return _(),t.align==="center"?Ow(s):t.align==="right"?Lw(s):t.align==="justify"&&Nw(s),s}function Ow(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function Lw(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function Nw(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,c=(t-r.width)/a;for(let u=0;u<r.charPositions.length;u++)u===o&&(o=r.spacesIndex[s++],n+=c),r.charPositions[u]+=n}}var Xu=p(()=>{"use strict"});function r_(i){if(i==="")return[];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,l=n;a<=l;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var i_=p(()=>{"use strict"});var Ca,Yu,Qs,ju=p(()=>{Uu();hr();pt();st();Ks();_a();e_();Xu();i_();Ca=0,Yu=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},this.measureCache=ba(1e3)}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke?(r+=e._fill.fill.styleKey,s=!1):(e._stroke||e.dropShadow)&&(r=`${e.styleKey}-bitmap`,s=!1),!J.has(r)){let n=Object.create(e);n.lineHeight=0;let a=new Vu({style:n,overrideFill:s,overrideSize:!0,...this.defaultOptions});Ca++,Ca>50&&k("BitmapText",`You have dynamically created ${Ca} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{Ca--,J.remove(r)}),J.set(r,a)}let o=J.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e),o=`${t}-${e.styleKey}-${r}`;if(this.measureCache.has(o))return this.measureCache.get(o);let n=oe.graphemeSegmenter(t),a=Pa(n,e,s,r);return this.measureCache.set(o,a),a}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},O(V,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof ir?s:new ir(s),n=e.dynamicFill??this._canUseTintForStyle(o),a=new Vu({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1,textureStyle:e.textureStyle}),l=r_(e.chars);return a.ensureCharacters(l.join("")),J.set(`${r}-bitmap`,a),a.once("destroy",()=>J.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=J.get(e);r&&r.destroy()}_canUseTintForStyle(t){return!t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}},Qs=new Yu});function s_(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var $u,Js,o_=p(()=>{hr();P();Xx();Ks();Qx();ju();Xu();$u=class extends Sa{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}},Js=class{constructor(t){this._renderer=t}validateRenderable(t){let e=this._getGpuBitmapText(t);return this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);s_(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}updateRenderable(t){let e=this._getGpuBitmapText(t);s_(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Qs.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=new wa(this._renderer.limits.maxBatchableTextures)));let o=oe.graphemeSegmenter(t.text),n=t._style,a=s.baseLineOffset,l=Pa(o,n,s,!0),c=n.padding,u=l.scale,h=l.width,d=l.height+l.offsetY;n._stroke&&(h+=n._stroke.width/u,d+=n._stroke.width/u),r.translate(-t._anchor._x*h-c,-t._anchor._y*d-c).scale(u,u);let f=s.applyFillAsTint?n._fill.color:16777215,m=s.fontMetrics.fontSize,_=s.lineHeight;n.lineHeight&&(m=n.fontSize/u,_=n.lineHeight/u);let x=(_-m)/2;x-s.baseLineOffset<0&&(x=0);for(let y=0;y<l.lines.length;y++){let b=l.lines[y];for(let v=0;v<b.charPositions.length;v++){let T=b.chars[v],E=s.chars[T];if(E?.texture){let S=E.texture;r.texture(S,f||"black",Math.round(b.charPositions[v]+E.xOffset),Math.round(a+E.yOffset+x),S.orig.width,S.orig.height)}}a+=_}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new $u;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),e}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=J.get(`${r}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,c=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+l*l),h=(Math.abs(c)+Math.abs(u))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=h*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){this._renderer=null}};Js.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"bitmapText"}});var qu=p(()=>{P();o_();U.add(Js)});var Ea,n_=p(()=>{Ys();Ea=class extends De{constructor(t){super(),this.generatingTexture=!1,this.currentKey="--",this._renderer=t,t.runners.resolutionChange.add(this)}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate()}destroy(){let{htmlText:t}=this._renderer;t.getReferenceCount(this.currentKey)===null?t.returnTexturePromise(this.texturePromise):t.decreaseReferenceCount(this.currentKey),this._renderer.runners.resolutionChange.remove(this),this.texturePromise=null,this._renderer=null}}});var to,a_=p(()=>{P();rt();xu();n_();to=class{constructor(t){this._renderer=t}validateRenderable(t){let e=this._getGpuText(t),r=t.styleKey;return e.currentKey!==r}addRenderable(t,e){let r=this._getGpuText(t);if(t._didTextUpdate){let s=t._autoResolution?this._renderer.resolution:t.resolution;(r.currentKey!==t.styleKey||t.resolution!==s)&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Xs(r,t)}this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=e.texturePromise;e.texturePromise=null,e.generatingTexture=!0,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let s=this._renderer.htmlText.getTexturePromise(t);r&&(s=s.finally(()=>{this._renderer.htmlText.decreaseReferenceCount(e.currentKey),this._renderer.htmlText.returnTexturePromise(r)})),e.texturePromise=s,e.currentKey=t.styleKey,e.texture=await s;let o=t.renderGroup||t.parentRenderGroup;o&&(o.structureDidChange=!0),e.generatingTexture=!1,Xs(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new Ea(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.texture=A.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}};to.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"htmlText"}});function l_(){let{userAgent:i}=D.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var c_=p(()=>{it()});var u_,h_,Oi,Ku=p(()=>{it();u_="http://www.w3.org/2000/svg",h_="http://www.w3.org/1999/xhtml",Oi=class{constructor(){this.svgRoot=document.createElementNS(u_,"svg"),this.foreignObject=document.createElementNS(u_,"foreignObject"),this.domElement=document.createElementNS(h_,"div"),this.styleElement=document.createElementNS(h_,"style");let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s),this.image=D.get().createImage()}destroy(){this.svgRoot.remove(),this.foreignObject.remove(),this.styleElement.remove(),this.domElement.remove(),this.image.src="",this.image.remove(),this.svgRoot=null,this.foreignObject=null,this.styleElement=null,this.domElement=null,this.image=null,this.canvasAndContext=null}}});function d_(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(l){s[l]||(r.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);n&&n.forEach(l=>{let c=l.split(":")[1].trim();a(c)});for(let l in t.tagStyles){let c=t.tagStyles[l].fontFamily;a(c)}return r}var f_=p(()=>{"use strict"});async function p_(i){let e=await(await D.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var m_=p(()=>{it()});async function g_(i,t){let e=await p_(t);return`@font-face {
|
|
478
|
-
font-family: "${i.fontFamily}";
|
|
479
|
-
font-weight: ${i.fontWeight};
|
|
480
|
-
font-style: ${i.fontStyle};
|
|
481
|
-
src: url('${e}');
|
|
482
|
-
}`}var x_=p(()=>{m_()});async function __(i){let t=i.filter(e=>J.has(`${e}-and-url`)).map(e=>{if(!Zu.has(e)){let{entries:r}=J.get(`${e}-and-url`),s=[];r.forEach(o=>{let n=o.url,l=o.faces.map(c=>({weight:c.weight,style:c.style}));s.push(...l.map(c=>g_({fontWeight:c.weight,fontStyle:c.style,fontFamily:e},n)))}),Zu.set(e,Promise.all(s).then(o=>o.join(`
|
|
483
|
-
`)))}return Zu.get(e)});return(await Promise.all(t)).join(`
|
|
484
|
-
`)}var Zu,y_=p(()=>{hr();x_();Zu=new Map});function b_(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:l,height:c}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",c.toString()),new XMLSerializer().serializeToString(a)}var v_=p(()=>{"use strict"});function T_(i,t){let e=se.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var S_=p(()=>{ki()});function w_(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var P_=p(()=>{"use strict"});function E_(i,t,e,r){r||(r=C_||(C_=new Oi));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return{width:a.width-l,height:a.height-l}}var C_,A_=p(()=>{Ku()});var eo,M_=p(()=>{P();ki();$e();ke();c_();st();Ae();Gu();Ku();f_();y_();v_();S_();P_();A_();eo=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Bt.WEBGPU}getTexture(t){return this.getTexturePromise(t)}getManagedTexture(t){let e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].promise;let r=this._buildTexturePromise(t).then(s=>(this._activeTextures[e].texture=s,s));return this._activeTextures[e]={texture:null,promise:r,usageCount:1},r}getReferenceCount(t){return this._activeTextures[t]?.usageCount??null}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e.texture):e.promise.then(r=>{e.texture=r,this._cleanUp(e.texture)}).catch(()=>{k("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:s,textureStyle:o}=t,n=lt.get(Oi),a=d_(e,r),l=await __(a),c=E_(e,r,l,n),u=Math.ceil(Math.ceil(Math.max(1,c.width)+r.padding*2)*s),h=Math.ceil(Math.ceil(Math.max(1,c.height)+r.padding*2)*s),d=n.image,f=2;d.width=(u|0)+f,d.height=(h|0)+f;let m=b_(e,r,s,l,n);await w_(d,m,l_()&&a.length>0);let _=d,x;this._createCanvas&&(x=T_(d,s));let y=ya(x?x.canvas:_,d.width-f,d.height-f,s);return o&&(y.source.style=o),this._createCanvas&&(this._renderer.texture.initSource(y.source),se.returnCanvasAndContext(x)),lt.return(n),y}returnTexturePromise(t){t.then(e=>{this._cleanUp(e)}).catch(()=>{k("HTMLTextSystem: Failed to clean texture")})}_cleanUp(t){ot.returnTexture(t,!0),t.source.resource=null,t.source.uploadMethodId="unknown"}destroy(){this._renderer=null;for(let t in this._activeTextures)this._activeTextures[t]&&this.returnTexturePromise(this._activeTextures[t].promise);this._activeTextures=null}};eo.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"htmlText"}});var Qu=p(()=>{P();a_();M_();U.add(eo);U.add(to)});var B_,Li,Aa=p(()=>{fr();Qe();_i();pt();B_=class R_ extends pe{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(O(V,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...R_.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new bt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:j.VERTEX|j.COPY_DST}),l=new bt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:j.VERTEX|j.COPY_DST}),c=new bt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:j.INDEX|j.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:e.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}};B_.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Li=B_});var Kr,F_,Ni,zi=p(()=>{"use strict";Kr={name:"local-uniform-bit",vertex:{header:`
|
|
485
|
-
|
|
486
|
-
struct LocalUniforms {
|
|
487
|
-
uTransformMatrix:mat3x3<f32>,
|
|
488
|
-
uColor:vec4<f32>,
|
|
489
|
-
uRound:f32,
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
493
|
-
`,main:`
|
|
494
|
-
vColor *= localUniforms.uColor;
|
|
495
|
-
modelMatrix *= localUniforms.uTransformMatrix;
|
|
496
|
-
`,end:`
|
|
497
|
-
if(localUniforms.uRound == 1)
|
|
498
|
-
{
|
|
499
|
-
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
500
|
-
}
|
|
501
|
-
`}},F_={...Kr,vertex:{...Kr.vertex,header:Kr.vertex.header.replace("group(1)","group(2)")}},Ni={name:"local-uniform-bit",vertex:{header:`
|
|
502
|
-
|
|
503
|
-
uniform mat3 uTransformMatrix;
|
|
504
|
-
uniform vec4 uColor;
|
|
505
|
-
uniform float uRound;
|
|
506
|
-
`,main:`
|
|
507
|
-
vColor *= uColor;
|
|
508
|
-
modelMatrix = uTransformMatrix;
|
|
509
|
-
`,end:`
|
|
510
|
-
if(uRound == 1.)
|
|
511
|
-
{
|
|
512
|
-
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
513
|
-
}
|
|
514
|
-
`}}});var G_,I_,k_=p(()=>{"use strict";G_={name:"tiling-bit",vertex:{header:`
|
|
515
|
-
struct TilingUniforms {
|
|
516
|
-
uMapCoord:mat3x3<f32>,
|
|
517
|
-
uClampFrame:vec4<f32>,
|
|
518
|
-
uClampOffset:vec2<f32>,
|
|
519
|
-
uTextureTransform:mat3x3<f32>,
|
|
520
|
-
uSizeAnchor:vec4<f32>
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
524
|
-
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
525
|
-
@group(2) @binding(2) var uSampler: sampler;
|
|
526
|
-
`,main:`
|
|
527
|
-
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
|
528
|
-
|
|
529
|
-
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
|
530
|
-
`},fragment:{header:`
|
|
531
|
-
struct TilingUniforms {
|
|
532
|
-
uMapCoord:mat3x3<f32>,
|
|
533
|
-
uClampFrame:vec4<f32>,
|
|
534
|
-
uClampOffset:vec2<f32>,
|
|
535
|
-
uTextureTransform:mat3x3<f32>,
|
|
536
|
-
uSizeAnchor:vec4<f32>
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
540
|
-
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
541
|
-
@group(2) @binding(2) var uSampler: sampler;
|
|
542
|
-
`,main:`
|
|
543
|
-
|
|
544
|
-
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
|
545
|
-
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
|
546
|
-
var unclamped = coord;
|
|
547
|
-
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
|
548
|
-
|
|
549
|
-
var bias = 0.;
|
|
550
|
-
|
|
551
|
-
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
|
552
|
-
{
|
|
553
|
-
bias = -32.;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
557
|
-
`}},I_={name:"tiling-bit",vertex:{header:`
|
|
558
|
-
uniform mat3 uTextureTransform;
|
|
559
|
-
uniform vec4 uSizeAnchor;
|
|
560
|
-
|
|
561
|
-
`,main:`
|
|
562
|
-
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
|
563
|
-
|
|
564
|
-
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
|
565
|
-
`},fragment:{header:`
|
|
566
|
-
uniform sampler2D uTexture;
|
|
567
|
-
uniform mat3 uMapCoord;
|
|
568
|
-
uniform vec4 uClampFrame;
|
|
569
|
-
uniform vec2 uClampOffset;
|
|
570
|
-
`,main:`
|
|
571
|
-
|
|
572
|
-
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
|
573
|
-
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
574
|
-
vec2 unclamped = coord;
|
|
575
|
-
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
576
|
-
|
|
577
|
-
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
578
|
-
|
|
579
|
-
`}}});var Ju,th,Ma,U_=p(()=>{Z();gr();zi();xr();we();qt();rt();k_();Ma=class extends St{constructor(){Ju??(Ju=Re({name:"tiling-sprite-shader",bits:[Kr,G_,Ge]})),th??(th=Fe({name:"tiling-sprite-shader",bits:[Ni,I_,Ie]}));let t=new ut({uMapCoord:{value:new B,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 B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:th,gpuProgram:Ju,resources:{localUniforms:new ut({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:A.EMPTY.source,uSampler:A.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,u=n.textureMatrix,h=a.uniforms.uTextureTransform;h.set(r.a*l/t,r.b*l/e,r.c*c/t,r.d*c/e,r.tx/t,r.ty/e),h.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var Ba,D_=p(()=>{Aa();Ba=class extends Li{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 O_(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var L_=p(()=>{"use strict"});function N_(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,l=r.c,c=r.d,u=r.tx,h=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+l*f+u,i[e+1]=a*d+c*f+h,e+=t,s++}}var z_=p(()=>{"use strict"});function H_(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=B.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),N_(t,2,0,a)}var W_=p(()=>{Z();z_()});var Ra,eh,ro,V_=p(()=>{P();As();Pe();ke();Mi();ta();Aa();U_();D_();L_();W_();Ra=new Ba,eh=class{constructor(){this.canBatch=!0,this.geometry=new Li({indices:Ra.indices.slice(),positions:Ra.positions.slice(),uvs:Ra.uvs.slice()})}destroy(){this.geometry.destroy(),this.shader?.destroy()}},ro=class{constructor(t){this._state=Et.default2d,this._renderer=t}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new _r);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new Ma),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Ue(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ze(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Ra,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.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){let e=new eh;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),H_(t,r.uvs),O_(t,r.positions)}destroy(){this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===Bt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};ro.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"tilingSprite"}});var rh=p(()=>{P();V_();U.add(ro)});var X_,j_,$_=p(()=>{pt();Aa();X_=class Y_ extends Li{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(O(V,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...Y_.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,c=this.height/a;for(let h=0;h<e;h++){let d=h%this.verticesX,f=h/this.verticesX|0;r.push(d*l,f*c),s.push(d/n,f/a)}let u=n*a;for(let h=0;h<u;h++){let d=h%n,f=h/n|0,m=f*this.verticesX+d,_=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,y=(f+1)*this.verticesX+d+1;o.push(m,_,x,_,y,x)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};X_.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};j_=X_});var q_,Z_,Q_=p(()=>{$_();q_=class K_ extends j_{constructor(t={}){t={...K_.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=e>u?1:e/u,d=n+a,f=r>d?1:r/d,m=Math.min(h,f),_=l*e,x=c*r;t[0]=t[8]=t[16]=t[24]=-_,t[2]=t[10]=t[18]=t[26]=s*m-_,t[4]=t[12]=t[20]=t[28]=e-o*m-_,t[6]=t[14]=t[22]=t[30]=e-_,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*m-x,t[17]=t[19]=t[21]=t[23]=r-a*m-x,t[25]=t[27]=t[29]=t[31]=r-x,this.getBuffer("aPosition").update()}updateUvs(){let 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;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};q_.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Z_=q_});var ih,io,J_=p(()=>{P();ta();Q_();ih=class extends _r{constructor(){super(),this.geometry=new Z_}destroy(){this.geometry.destroy()}},io=class{constructor(t){this._renderer=t}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let 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){let e=t._gpuData[this._renderer.uid]=new ih,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null}};io.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"nineSliceSprite"}});var sh=p(()=>{P();J_();U.add(io)});var so,ty=p(()=>{P();so=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.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}};so.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"filter"}});var ey,ge,Fa=p(()=>{tr();pr();we();Pe();ey=class oh extends St{constructor(t){t={...oh.defaultOptions,...t},super(t),this.enabled=!0,this._state=Et.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,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=Tt.from(e)),r&&(n=vt.from(r)),new oh({gpuProgram:o,glProgram:n,...s})}};ey.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};ge=ey});var ry,iy=p(()=>{ry=`in vec2 aPosition;
|
|
580
|
-
out vec2 vTextureCoord;
|
|
581
|
-
|
|
582
|
-
uniform vec4 uInputSize;
|
|
583
|
-
uniform vec4 uOutputFrame;
|
|
584
|
-
uniform vec4 uOutputTexture;
|
|
585
|
-
|
|
586
|
-
vec4 filterVertexPosition( void )
|
|
587
|
-
{
|
|
588
|
-
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
589
|
-
|
|
590
|
-
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
591
|
-
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
592
|
-
|
|
593
|
-
return vec4(position, 0.0, 1.0);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
vec2 filterTextureCoord( void )
|
|
597
|
-
{
|
|
598
|
-
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
void main(void)
|
|
602
|
-
{
|
|
603
|
-
gl_Position = filterVertexPosition();
|
|
604
|
-
vTextureCoord = filterTextureCoord();
|
|
605
|
-
}
|
|
606
|
-
`});var sy,oy=p(()=>{sy=`in vec2 vTextureCoord;
|
|
607
|
-
out vec4 finalColor;
|
|
608
|
-
uniform sampler2D uTexture;
|
|
609
|
-
void main() {
|
|
610
|
-
finalColor = texture(uTexture, vTextureCoord);
|
|
611
|
-
}
|
|
612
|
-
`});var nh,ny=p(()=>{nh=`struct GlobalFilterUniforms {
|
|
613
|
-
uInputSize: vec4<f32>,
|
|
614
|
-
uInputPixel: vec4<f32>,
|
|
615
|
-
uInputClamp: vec4<f32>,
|
|
616
|
-
uOutputFrame: vec4<f32>,
|
|
617
|
-
uGlobalFrame: vec4<f32>,
|
|
618
|
-
uOutputTexture: vec4<f32>,
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
|
|
622
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
623
|
-
@group(0) @binding(2) var uSampler: sampler;
|
|
624
|
-
|
|
625
|
-
struct VSOutput {
|
|
626
|
-
@builtin(position) position: vec4<f32>,
|
|
627
|
-
@location(0) uv: vec2<f32>
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
631
|
-
{
|
|
632
|
-
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
633
|
-
|
|
634
|
-
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
635
|
-
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
636
|
-
|
|
637
|
-
return vec4(position, 0.0, 1.0);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
|
|
641
|
-
{
|
|
642
|
-
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
@vertex
|
|
646
|
-
fn mainVertex(
|
|
647
|
-
@location(0) aPosition: vec2<f32>,
|
|
648
|
-
) -> VSOutput {
|
|
649
|
-
return VSOutput(
|
|
650
|
-
filterVertexPosition(aPosition),
|
|
651
|
-
filterTextureCoord(aPosition)
|
|
652
|
-
);
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
@fragment
|
|
656
|
-
fn mainFragment(
|
|
657
|
-
@location(0) uv: vec2<f32>,
|
|
658
|
-
) -> @location(0) vec4<f32> {
|
|
659
|
-
return textureSample(uTexture, uSampler, uv);
|
|
660
|
-
}
|
|
661
|
-
`});var Ga,ay=p(()=>{tr();pr();Fa();iy();oy();ny();Ga=class extends ge{constructor(){let t=Tt.from({vertex:{source:nh,entryPoint:"mainVertex"},fragment:{source:nh,entryPoint:"mainFragment"},name:"passthrough-filter"}),e=vt.from({vertex:ry,fragment:sy,name:"passthrough-filter"});super({gpuProgram:t,glProgram:e})}}});function cy(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];if(s.globalDisplayStatus<7)continue;let o=s.renderGroup??s.parentRenderGroup;o?.isCachedAsTexture?t.matrix=ly.copyFrom(o.textureOffsetInverseTransform).append(s.worldTransform):o?._parentCacheAsTextureRenderGroup?t.matrix=ly.copyFrom(o._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(s.groupTransform):t.matrix=s.worldTransform,t.addBounds(s.bounds)}return t.matrix=e,t}var ly,uy=p(()=>{Z();ly=new B});var zw,ah,oo,hy=p(()=>{P();ay();Z();dr();_i();qt();rt();$e();ke();Jt();uy();st();zw=new pe({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])}),ah=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new ct,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}},oo=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ut({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 Ot({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=!1,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let o=e.renderTarget.renderTarget.colorTexture.source,n=o.resolution,a=o.antialias;if(r.every(f=>!f.enabled)){s.skip=!0;return}let l=s.bounds;if(this._calculateFilterArea(t,l),this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,n,1),s.skip)return;let c=this._getPreviousFilterData(),u=this._findFilterResolution(n),h=0,d=0;c&&(h=c.bounds.minX,d=c.bounds.minY),this._calculateGlobalFrame(s,h,d,u,o.width,o.height),this._setupFilterTextures(s,l,e,c)}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=e;let s=t.source,o=s.resolution,n=s.antialias;if(e.every(f=>!f.enabled))return r.skip=!0,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,n,o,0),r.skip)return t;let l=o;this._calculateGlobalFrame(r,0,0,l,s.width,s.height),r.outputRenderSurface=ot.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=A.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);let d=r.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,!1),e.blendRequired&&ot.returnTexture(e.backTexture),ot.returnTexture(e.inputTexture))}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=ot.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),c=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._activeFilterData,l=n.outputRenderSurface===r,c=o.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._findFilterResolution(c),h=0,d=0;if(l){let m=this._findPreviousFilterOffset();h=m.x,d=m.y}this._updateFilterUniforms(e,r,n,h,d,u,l,s);let f=t.enabled?t:this._getPassthroughFilter();this._setupBindGroupsAndRender(f,e,o)}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(B.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.orig.width,1/e.texture.orig.height),s.translate(e.anchor.x,e.anchor.y),s}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new Ga),this._passthroughFilter}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let s=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(s,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:zw,shader:t,state:t._state,topology:"triangle-list"}),r.type===Bt.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(t,e,r,s){if(t.backTexture=A.EMPTY,t.inputTexture=ot.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),t.blendRequired){r.renderTarget.finishRenderPass();let o=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(o,e,s?.bounds)}r.renderTarget.bind(t.inputTexture,!0),r.globalUniforms.push({offset:e})}_calculateGlobalFrame(t,e,r,s,o,n){let a=t.globalFrame;a.x=e*s,a.y=r*s,a.width=o*s,a.height=n*s}_updateFilterUniforms(t,e,r,s,o,n,a,l){let c=this._filterGlobalUniforms.uniforms,u=c.uOutputFrame,h=c.uInputSize,d=c.uInputPixel,f=c.uInputClamp,m=c.uGlobalFrame,_=c.uOutputTexture;a?(u[0]=r.bounds.minX-s,u[1]=r.bounds.minY-o):(u[0]=0,u[1]=0),u[2]=t.frame.width,u[3]=t.frame.height,h[0]=t.source.width,h[1]=t.source.height,h[2]=1/h[0],h[3]=1/h[1],d[0]=t.source.pixelWidth,d[1]=t.source.pixelHeight,d[2]=1/d[0],d[3]=1/d[1],f[0]=.5*d[2],f[1]=.5*d[3],f[2]=t.frame.width*h[2]-.5*d[2],f[3]=t.frame.height*h[3]-.5*d[3];let x=this.renderer.renderTarget.rootRenderTarget.colorTexture;m[0]=s*n,m[1]=o*n,m[2]=x.source.width*n,m[3]=x.source.height*n,e instanceof A&&(e.source.resource=null);let y=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!l),e instanceof A?(_[0]=e.frame.width,_[1]=e.frame.height):(_[0]=y.width,_[1]=y.height),_[2]=y.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let s=this._filterStack[r];if(!s.skip){t=s.bounds.minX,e=s.bounds.minY;break}}return{x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?cy(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;s&&e.applyMatrix(s)}}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,o=t.filters,n=t.firstEnabledIndex,a=t.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),n===a)o[n].apply(this,r,t.outputRenderSurface,e);else{let l=t.inputTexture,c=ot.getOptimalTexture(s.width,s.height,l.source._resolution,!1),u=c;for(let h=n;h<a;h++){let d=o[h];if(!d.enabled)continue;d.apply(this,l,u,!0);let f=l;l=u,u=f}o[a].apply(this,l,t.outputRenderSurface,e),ot.returnTexture(c)}}_calculateFilterBounds(t,e,r,s,o){let n=this.renderer,a=t.bounds,l=t.filters,c=1/0,u=0,h=!0,d=!1,f=!1,m=!0,_=-1,x=-1;for(let y=0;y<l.length;y++){let b=l[y];if(!b.enabled)continue;if(_===-1&&(_=y),x=y,c=Math.min(c,b.resolution==="inherit"?s:b.resolution),u+=b.padding,b.antialias==="off"?h=!1:b.antialias==="inherit"&&h&&(h=r),b.clipToViewport||(m=!1),!!!(b.compatibleRenderers&n.type)){f=!1;break}if(b.blendRequired&&!(n.backBuffer?.useBackBuffer??!0)){k("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),f=!1;break}f=!0,d||(d=b.blendRequired)}if(!f){t.skip=!0;return}if(m&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(c).ceil().scale(1/c).pad((u|0)*o),!a.isPositive){t.skip=!0;return}t.antialias=h,t.resolution=c,t.blendRequired=d,t.firstEnabledIndex=_,t.lastEnabledIndex=x}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>0&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new ah),this._filterStackIndex++,t}};oo.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"filter"}});var lh=p(()=>{P();ty();hy();U.add(oo);U.add(so)});var Hw={};var dy=p(()=>{ep();ac();ap();cp();Bn();Un();hu();du();gu();Nu();qu();Qu();rh();sh();lh()});var Ww={};var py=p(()=>{ac();Bn();Un();hu();du();gu();Nu();qu();Qu();rh();sh();lh()});async function gy(i){if(!i)for(let t=0;t<ch.length;t++){let e=ch[t];if(e.value.test()){await e.value.load();return}}}var ch,xy=p(()=>{P();ch=[];U.handleByNamedList(g.Environment,ch)});function Ia(){if(typeof no=="boolean")return no;try{no=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{no=!1}return no}var no,uh=p(()=>{"use strict"});var Lt,Hi=p(()=>{"use strict";Lt=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Lt||{})});var Wi,hh=p(()=>{"use strict";Wi=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,l){let{name:c,items:u}=this;for(let h=0,d=u.length;h<d;h++)u[h][c](t,e,r,s,o,n,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let 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 Vw,_y,yr,ao=p(()=>{Ht();xy();ve();uh();Gt();pt();Ar();Hi();hh();Nt();Vw=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],_y=class yy extends at{constructor(t){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;let e=[...Vw,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await gy(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...yy.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof dt&&(r={container:r},e&&(O(V,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:$.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.visible&&(r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r))}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Lt.ALL);let{clear:r,clearColor:s,target:o}=t;$.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,$.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 Wi(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null),this.runners.destroy.add(this.renderPipes[n])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&de.release(),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Ia())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()}};_y.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};yr=_y});var lo,Ty=p(()=>{P();Z();Dn();gr();Is();ks();zi();xr();we();qt();lo=class{constructor(){this._maxTextures=0}contextChange(t){let e=new ut({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=t.limits.maxBatchableTextures;let r=Re({name:"graphics",bits:[bi,Ti(this._maxTextures),F_,Ge]});this.shader=new St({gpuProgram:r,resources:{localUniforms:e}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(r),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let u=o.globalUniforms.bindGroup;c.setBindGroup(0,u,s.gpuProgram);let h=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,s.gpuProgram);let d=l.instructions,f=null;for(let m=0;m<l.instructionSize;m++){let _=d[m];if(_.topology!==f&&(f=_.topology,c.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,_.topology)),s.groups[1]=_.bindGroup,!_.gpuBindGroup){let x=_.textures;_.bindGroup=gi(x.textures,x.count,this._maxTextures),_.gpuBindGroup=o.bindGroup.getBindGroup(_.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,_.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(_.size,1,_.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};lo.extension={type:[g.WebGPUPipesAdaptor],name:"graphics"}});var Sy,wy,dh=p(()=>{"use strict";Sy={name:"texture-bit",vertex:{header:`
|
|
662
|
-
|
|
663
|
-
struct TextureUniforms {
|
|
664
|
-
uTextureMatrix:mat3x3<f32>,
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
|
|
668
|
-
`,main:`
|
|
669
|
-
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
670
|
-
`},fragment:{header:`
|
|
671
|
-
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
672
|
-
@group(2) @binding(1) var uSampler: sampler;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
`,main:`
|
|
676
|
-
outColor = textureSample(uTexture, uSampler, vUV);
|
|
677
|
-
`}},wy={name:"texture-bit",vertex:{header:`
|
|
678
|
-
uniform mat3 uTextureMatrix;
|
|
679
|
-
`,main:`
|
|
680
|
-
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
681
|
-
`},fragment:{header:`
|
|
682
|
-
uniform sampler2D uTexture;
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
`,main:`
|
|
686
|
-
outColor = texture(uTexture, vUV);
|
|
687
|
-
`}}});var co,Py=p(()=>{P();Z();gr();zi();xr();dh();we();rt();st();co=class{init(){let t=Re({name:"mesh",bits:[Kr,Sy,Ge]});this._shader=new St({gpuProgram:t,resources:{uTexture:A.EMPTY._source,uSampler:A.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){k("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};co.extension={type:[g.WebGPUPipesAdaptor],name:"mesh"}});var Da,uo,Cy=p(()=>{P();Pe();Dn();Da=Et.for2d(),uo=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Da.blendMode="normal",s.pipeline.getPipeline(e,n,Da);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=gi(l.textures,l.count,s.limits.maxBatchableTextures)}Da.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Da,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};uo.extension={type:[g.WebGPUPipesAdaptor],name:"batch"}});var ho,Ey=p(()=>{P();ho=class{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}};ho.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"customRender"}});function fo(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var fh=p(()=>{"use strict"});var Xw,po,Ay=p(()=>{P();Z();Ae();Ys();fh();Xw=new B,po=class{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&&(lt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=lt.get(De));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.blendMode.pushBlendMode(t,t.root.groupBlendMode,e),this._renderer.renderPipes.batch.addToBatch(r,e),this._renderer.renderPipes.blendMode.popBlendMode(e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=Xw.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,offset:{x:0,y:0}}),fo(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}),fo(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};po.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"renderGroup"}});function mo(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var ph=p(()=>{"use strict"});function mh(i,t=!1){jw(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,l=n.index;for(let c=0;c<l;c++){let u=a[c];u.parentRenderGroup===i&&u.relativeRenderGroupDepth===o&&Ry(u,r,0)}mo(a,l),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)mh(i.renderGroupChildren[s],t)}function jw(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=si(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function Ry(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&My&&By(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&My&&By(i,Yw,e)),!i.renderGroup){let o=i.children,n=o.length;for(let c=0;c<n;c++)Ry(o[c],t,e);let a=i.parentRenderGroup,l=i;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function By(i,t,e){if(e&li){i.groupColor=si(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&fs&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Dr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var Yw,My,Fy=p(()=>{ve();ph();Wl();Yw=new dt,My=Dr|li|fs});function Gy(i,t){let{list:e}=i.childrenRenderablesToUpdate,r=!1;for(let s=0;s<i.childrenRenderablesToUpdate.index;s++){let o=e[s];if(r=t[o.renderPipeId].validateRenderable(o),r)break}return i.structureDidChange=r,r}var Iy=p(()=>{"use strict"});var $w,go,ky=p(()=>{P();Z();$e();Br();Jt();ph();fh();Fy();Iy();$w=new B,go=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=$w;e&&(n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),fo(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t._parentCacheAsTextureRenderGroup=e,t.isCachedAsTexture){if(!t.textureNeedsUpdate)return;e=t}for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&ot.returnTexture(t.texture,!0);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias,l=t.textureOptions.scaleMode??"linear",c=ot.getOptimalTexture(r.width,r.height,n,a);c._source.style=new te({scaleMode:l}),t.texture=c,t._textureBounds||(t._textureBounds=new ct),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(ot.returnTexture(t.texture,!0),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?mo(t.childrenRenderablesToUpdate.list,0):Gy(t,r),mh(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 s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}mo(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};go.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"renderGroup"}});var xo,Uy=p(()=>{P();Ys();xo=class{constructor(t){this._renderer=t}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let 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){let e=new De;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}};xo.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"sprite"}});var Vi,gh=p(()=>{Nt();Vi="8.14.0"});var _o,yo,xh=p(()=>{P();gh();_o=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Vi)}static destroy(){}};_o.extension=g.Application;yo=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Vi)}destroy(){this._renderer=null}};yo.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"initHook",priority:-10}});var _h,yh,Oy=p(()=>{P();Pe();Xc();_h=class Dy{constructor(t,e){this.state=Et.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(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 Us({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=Dy.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};_h.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"batch"};_h._availableBatchers=Object.create(null);yh=_h;U.handleByMap(g.Batcher,yh._availableBatchers);U.add(Us)});var Ly,Ny=p(()=>{Ly=`in vec2 vMaskCoord;
|
|
688
|
-
in vec2 vTextureCoord;
|
|
689
|
-
|
|
690
|
-
uniform sampler2D uTexture;
|
|
691
|
-
uniform sampler2D uMaskTexture;
|
|
692
|
-
|
|
693
|
-
uniform float uAlpha;
|
|
694
|
-
uniform vec4 uMaskClamp;
|
|
695
|
-
uniform float uInverse;
|
|
696
|
-
|
|
697
|
-
out vec4 finalColor;
|
|
698
|
-
|
|
699
|
-
void main(void)
|
|
700
|
-
{
|
|
701
|
-
float clip = step(3.5,
|
|
702
|
-
step(uMaskClamp.x, vMaskCoord.x) +
|
|
703
|
-
step(uMaskClamp.y, vMaskCoord.y) +
|
|
704
|
-
step(vMaskCoord.x, uMaskClamp.z) +
|
|
705
|
-
step(vMaskCoord.y, uMaskClamp.w));
|
|
706
|
-
|
|
707
|
-
// TODO look into why this is needed
|
|
708
|
-
float npmAlpha = uAlpha;
|
|
709
|
-
vec4 original = texture(uTexture, vTextureCoord);
|
|
710
|
-
vec4 masky = texture(uMaskTexture, vMaskCoord);
|
|
711
|
-
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
712
|
-
|
|
713
|
-
float a = alphaMul * masky.r * npmAlpha * clip;
|
|
714
|
-
|
|
715
|
-
if (uInverse == 1.0) {
|
|
716
|
-
a = 1.0 - a;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
finalColor = original * a;
|
|
720
|
-
}
|
|
721
|
-
`});var zy,Hy=p(()=>{zy=`in vec2 aPosition;
|
|
722
|
-
|
|
723
|
-
out vec2 vTextureCoord;
|
|
724
|
-
out vec2 vMaskCoord;
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
uniform vec4 uInputSize;
|
|
728
|
-
uniform vec4 uOutputFrame;
|
|
729
|
-
uniform vec4 uOutputTexture;
|
|
730
|
-
uniform mat3 uFilterMatrix;
|
|
731
|
-
|
|
732
|
-
vec4 filterVertexPosition( vec2 aPosition )
|
|
733
|
-
{
|
|
734
|
-
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
735
|
-
|
|
736
|
-
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
737
|
-
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
738
|
-
|
|
739
|
-
return vec4(position, 0.0, 1.0);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
vec2 filterTextureCoord( vec2 aPosition )
|
|
743
|
-
{
|
|
744
|
-
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
vec2 getFilterCoord( vec2 aPosition )
|
|
748
|
-
{
|
|
749
|
-
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
void main(void)
|
|
753
|
-
{
|
|
754
|
-
gl_Position = filterVertexPosition(aPosition);
|
|
755
|
-
vTextureCoord = filterTextureCoord(aPosition);
|
|
756
|
-
vMaskCoord = getFilterCoord(aPosition);
|
|
757
|
-
}
|
|
758
|
-
`});var bh,Wy=p(()=>{bh=`struct GlobalFilterUniforms {
|
|
759
|
-
uInputSize:vec4<f32>,
|
|
760
|
-
uInputPixel:vec4<f32>,
|
|
761
|
-
uInputClamp:vec4<f32>,
|
|
762
|
-
uOutputFrame:vec4<f32>,
|
|
763
|
-
uGlobalFrame:vec4<f32>,
|
|
764
|
-
uOutputTexture:vec4<f32>,
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
struct MaskUniforms {
|
|
768
|
-
uFilterMatrix:mat3x3<f32>,
|
|
769
|
-
uMaskClamp:vec4<f32>,
|
|
770
|
-
uAlpha:f32,
|
|
771
|
-
uInverse:f32,
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
775
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
776
|
-
@group(0) @binding(2) var uSampler : sampler;
|
|
777
|
-
|
|
778
|
-
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
|
|
779
|
-
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
|
|
780
|
-
|
|
781
|
-
struct VSOutput {
|
|
782
|
-
@builtin(position) position: vec4<f32>,
|
|
783
|
-
@location(0) uv : vec2<f32>,
|
|
784
|
-
@location(1) filterUv : vec2<f32>,
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
788
|
-
{
|
|
789
|
-
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
790
|
-
|
|
791
|
-
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
792
|
-
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
793
|
-
|
|
794
|
-
return vec4(position, 0.0, 1.0);
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
798
|
-
{
|
|
799
|
-
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
803
|
-
{
|
|
804
|
-
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
808
|
-
{
|
|
809
|
-
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
fn getSize() -> vec2<f32>
|
|
813
|
-
{
|
|
814
|
-
return gfu.uGlobalFrame.zw;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
@vertex
|
|
818
|
-
fn mainVertex(
|
|
819
|
-
@location(0) aPosition : vec2<f32>,
|
|
820
|
-
) -> VSOutput {
|
|
821
|
-
return VSOutput(
|
|
822
|
-
filterVertexPosition(aPosition),
|
|
823
|
-
filterTextureCoord(aPosition),
|
|
824
|
-
getFilterCoord(aPosition)
|
|
825
|
-
);
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
@fragment
|
|
829
|
-
fn mainFragment(
|
|
830
|
-
@location(0) uv: vec2<f32>,
|
|
831
|
-
@location(1) filterUv: vec2<f32>,
|
|
832
|
-
@builtin(position) position: vec4<f32>
|
|
833
|
-
) -> @location(0) vec4<f32> {
|
|
834
|
-
|
|
835
|
-
var maskClamp = filterUniforms.uMaskClamp;
|
|
836
|
-
var uAlpha = filterUniforms.uAlpha;
|
|
837
|
-
|
|
838
|
-
var clip = step(3.5,
|
|
839
|
-
step(maskClamp.x, filterUv.x) +
|
|
840
|
-
step(maskClamp.y, filterUv.y) +
|
|
841
|
-
step(filterUv.x, maskClamp.z) +
|
|
842
|
-
step(filterUv.y, maskClamp.w));
|
|
843
|
-
|
|
844
|
-
var mask = textureSample(uMaskTexture, uSampler, filterUv);
|
|
845
|
-
var source = textureSample(uTexture, uSampler, uv);
|
|
846
|
-
var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
|
|
847
|
-
|
|
848
|
-
var a: f32 = alphaMul * mask.r * uAlpha * clip;
|
|
849
|
-
|
|
850
|
-
if (filterUniforms.uInverse == 1.0) {
|
|
851
|
-
a = 1.0 - a;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
return source * a;
|
|
855
|
-
}
|
|
856
|
-
`});var Oa,Vy=p(()=>{Z();tr();pr();qt();Ql();Fa();Ny();Hy();Wy();Oa=class extends ge{constructor(t){let{sprite:e,...r}=t,s=new ai(e.texture),o=new ut({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=Tt.from({vertex:{source:bh,entryPoint:"mainVertex"},fragment:{source:bh,entryPoint:"mainFragment"}}),a=vt.from({vertex:zy,fragment:Ly,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,clipToViewport:!1,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){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,r,s)}}});var qw,vh,bo,Xy=p(()=>{P();fn();Vy();Jt();us();Ss();Ae();rt();$e();ke();qw=new ct,vh=class extends Ye{constructor(){super(),this.filters=[new Oa({sprite:new $t(A.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}},bo=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=lt.get(vh);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=ii(t.mask.mask,!0,qw);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=ot.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===Bt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&ot.returnTexture(s.filterTexture),lt.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};bo.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"alphaMask"}});var vo,Yy=p(()=>{P();vo=class{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,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._renderer=null,this._colorStack=null}};vo.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"colorMask"}});var To,jy=p(()=>{P();Hi();Hr();To=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let c=r.instructionSize-l.instructionsStart-1;l.instructionsLength=c;let u=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[u]??(s[u]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(ft.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(ft.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(ft.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(ft.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,Lt.STENCIL),r.stencil.setStencilMode(ft.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(ft.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(ft.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};To.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"stencilMask"}});var Th,qy,Ky=p(()=>{Ht();P();st();Th=class $y{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new $(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...$y.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){$.shared.setValue(t).alpha<1&&this._backgroundColor.alpha===1&&k("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Th.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"background",priority:0};Th.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};qy=Th});var So,wo,Zy=p(()=>{P();fn();Jl();st();So={};U.handle(g.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");So[i.name]=i.ref},i=>{delete So[i.name]});wo=class{constructor(t){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(t,e,r){this._blendModeStack.push(e),this.setBlendMode(t,e,r)}popBlendMode(t){this._blendModeStack.pop();let e=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,e,t)}setBlendMode(t,e,r){let s=t instanceof Ur;if(this._activeBlendMode===e){this._isAdvanced&&t&&!s&&this._renderableList?.push(t);return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=e,t&&(this._isAdvanced=!!So[e],this._isAdvanced&&this._beginAdvancedBlendMode(t,r))}_beginAdvancedBlendMode(t,e){this._renderer.renderPipes.batch.break(e);let r=this._activeBlendMode;if(!So[r]){k(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let s=this._ensureFilterEffect(r),o=t instanceof Ur,n={renderPipeId:"filter",action:"pushFilter",filterEffect:s,renderables:o?null:[t],container:o?t.root:null,canBundle:!1};this._renderableList=n.renderables,e.add(n)}_ensureFilterEffect(t){let e=this._filterHash[t];return e||(e=this._filterHash[t]=new Ye,e.filters=[new So[t]]),e}_endAdvancedBlendMode(t){this._isAdvanced=!1,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(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};wo.extension={type:[g.WebGLPipes,g.WebGPUPipes,g.CanvasPipes],name:"blendMode"}});var Sh,wh,Jy,tb=p(()=>{it();P();ve();rt();Sh={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},wh=class Qy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof dt||t instanceof A?{target:t,...e}:{...e,...t}}async image(t){let e=D.get().createImage();return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Qy.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},Sh[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Sh[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Sh[e],quality:r});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof A)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof A?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof dt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof A?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};wh.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"extract"};wh.defaultImageOptions={format:"png",quality:1};Jy=wh});var La,eb=p(()=>{Vt();rt();La=class i extends A{static create(t){return new i({source:new et(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var Kw,Zw,Qw,Po,rb=p(()=>{Ht();P();Z();It();Jt();_n();ve();eb();Kw=new X,Zw=new ct,Qw=[0,0,0,0],Po=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof dt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:$.shared.setValue(o).toArray():o=Qw;let n=t.frame?.copyTo(Kw)||oi(s,Zw).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=La.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),l=B.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};Po.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"textureGenerator"}});var Co,ib=p(()=>{P();Z();be();Mi();dr();ke();qt();Co=class{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:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new B,worldColor:4294967295,offset:new Q},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},c=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(c);let u=c.uniforms;u.uProjectionMatrix=l.projectionMatrix,u.uResolution=l.resolution,u.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),u.uWorldTransformMatrix.tx-=l.offset.x,u.uWorldTransformMatrix.ty-=l.offset.y,Ue(l.worldColor,u.uWorldColorAlpha,0),c.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(c,!1):(h=this._bindGroupPool.pop()||new Ot,this._activeBindGroups.push(h),h.setResource(c,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Bt.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 ut({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}};Co.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"globalUniforms"}});var Jw,Eo,sb=p(()=>{P();Or();Jw=1,Eo=class{constructor(){this._tasks=[],this._offset=0}init(){xt.system.add(this._update,this)}repeat(t,e,r=!0){let s=Jw++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){xt.system.remove(this._update,this),this._tasks.length=0}};Eo.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"scheduler",priority:0}});function nb(i){if(!ob){if(D.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Vi} (${i}) http://www.pixijs.com/
|
|
857
|
-
|
|
858
|
-
`,"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 ${Vi} - ${i} - http://www.pixijs.com/`);ob=!0}}var ob,ab=p(()=>{it();gh();ob=!1});var Xi,lb=p(()=>{P();ab();ke();Xi=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Bt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),nb(e)}}};Xi.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"hello",priority:-2};Xi.defaultOptions={hello:!1}});function cb(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function ub(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var hb=p(()=>{"use strict"});var tP,Ph,fb,pb=p(()=>{P();hb();tP=0,Ph=class db{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...db.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(let e of this._managedHashes)e.context[e.hash]=cb(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)ub(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=tP++,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(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,l=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===l&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let c=r;a&&(a.structureDidChange=!0),c[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let 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(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Ph.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"renderableGC",priority:0};Ph.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};fb=Ph});var Ch,gb,xb=p(()=>{P();Ch=class mb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...mb.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??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(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Ch.extension={type:[g.WebGLSystem,g.WebGPUSystem],name:"textureGC"};Ch.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};gb=Ch});var _b,Ao,Eh=p(()=>{Gt();Vt();rt();_b=class yb{constructor(t={}){if(this.uid=Y("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...yb.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 et({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let 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 A||t.depthStencilTexture instanceof et?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let 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 et({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}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)}};_b.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Ao=_b});function Na(i,t){if(!Yi.has(i)){let e=new A({source:new Dt({resource:i,...t})}),r=()=>{Yi.get(i)===e&&Yi.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Yi.set(i,e)}return Yi.get(i)}var Yi,Ah=p(()=>{Ar();Nr();rt();Yi=new Map;de.register(Yi)});var Mh,vb,Tb=p(()=>{it();P();It();pt();Eh();Ah();Mh=class bb{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={...bb.defaultOptions,...t},t.view&&(O(V,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new X(0,0,t.width,t.height),this.canvas=t.canvas||D.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Na(this.canvas,t),this.renderTarget=new Ao({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};Mh.extension={type:[g.WebGLSystem,g.WebGPUSystem,g.CanvasSystem],name:"view",priority:0};Mh.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};vb=Mh});var za,Ha,Bh=p(()=>{Ey();Ay();ky();Uy();xh();Oy();Xy();Yy();jy();Ky();Zy();tb();rb();ib();sb();lb();pb();xb();Tb();za=[qy,Co,Xi,vb,go,gb,Po,Jy,yo,fb,Eo],Ha=[wo,yh,xo,po,bo,To,vo,ho]});var Mo,Sb=p(()=>{P();Mo=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let u in o){let h=t.resources[u]??t.resources[o[u]],d;if(h._resourceType==="uniformGroup"){let f=h;a.ubo.updateUniformGroup(f);let m=f.buffer;d={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(h._resourceType==="buffer"){let f=h;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(h._resourceType==="bufferResource"){let f=h;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(h._resourceType==="textureSampler"){let f=h;d=a.texture.getGpuSampler(f)}else if(h._resourceType==="textureSource"){let f=h;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[u],resource:d})}let l=a.shader.getProgramData(e).bindGroups[r],c=s.createBindGroup({layout:l,entries:n});return this._hash[t._key]=c,c}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};Mo.extension={type:[g.WebGPUSystem],name:"bindGroup"}});var Bo,wb=p(()=>{P();Ac();Bo=class{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){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let 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));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Es(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}};Bo.extension={type:[g.WebGPUSystem],name:"buffer"}});var Ro,Pb=p(()=>{P();Ro=class{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}};Ro.extension={type:[g.WebGPUSystem],name:"colorMask"}});var ji,Cb=p(()=>{it();P();ji=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=(t.gpu?Promise.resolve(t.gpu):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){let e=await D.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};ji.extension={type:[g.WebGPUSystem],name:"device"};ji.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Fo,Eb=p(()=>{P();Fo=class{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,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}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;let 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,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(parseInt(s,10),t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:c}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,c),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,l??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),l??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(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_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}};Fo.extension={type:[g.WebGPUSystem],name:"encoder",priority:1}});var Go,Ab=p(()=>{P();Go=class{constructor(t){this._renderer=t}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}};Go.extension={type:[g.WebGPUSystem],name:"limits"}});var Io,Mb=p(()=>{P();Hr();Io=class{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:ft.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Io.extension={type:[g.WebGPUSystem],name:"stencil"}});var $i,Rh=p(()=>{uh();fr();Qe();$i=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Ia())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new bt({data:new Float32Array(e.layout.size/4),usage:j.UNIFORM|j.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new bt({data:new Float32Array(s.layout.size/4),usage:j.UNIFORM|j.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function Bb(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=ko[s.data.type].size,n=ko[s.data.type].align;if(!ko[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var ko,Fh=p(()=>{"use strict";ko={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}}});var or,Gh=p(()=>{"use strict";or=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
859
|
-
var matrix = uv[name].toArray(true);
|
|
860
|
-
data[offset] = matrix[0];
|
|
861
|
-
data[offset + 1] = matrix[1];
|
|
862
|
-
data[offset + 2] = matrix[2];
|
|
863
|
-
data[offset + 4] = matrix[3];
|
|
864
|
-
data[offset + 5] = matrix[4];
|
|
865
|
-
data[offset + 6] = matrix[5];
|
|
866
|
-
data[offset + 8] = matrix[6];
|
|
867
|
-
data[offset + 9] = matrix[7];
|
|
868
|
-
data[offset + 10] = matrix[8];
|
|
869
|
-
`,uniform:`
|
|
870
|
-
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
|
|
871
|
-
`},{type:"vec4<f32>",test:i=>i.type==="vec4<f32>"&&i.size===1&&i.value.width!==void 0,ubo:`
|
|
872
|
-
v = uv[name];
|
|
873
|
-
data[offset] = v.x;
|
|
874
|
-
data[offset + 1] = v.y;
|
|
875
|
-
data[offset + 2] = v.width;
|
|
876
|
-
data[offset + 3] = v.height;
|
|
877
|
-
`,uniform:`
|
|
878
|
-
cv = ud[name].value;
|
|
879
|
-
v = uv[name];
|
|
880
|
-
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
|
|
881
|
-
cv[0] = v.x;
|
|
882
|
-
cv[1] = v.y;
|
|
883
|
-
cv[2] = v.width;
|
|
884
|
-
cv[3] = v.height;
|
|
885
|
-
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
|
|
886
|
-
}
|
|
887
|
-
`},{type:"vec2<f32>",test:i=>i.type==="vec2<f32>"&&i.size===1&&i.value.x!==void 0,ubo:`
|
|
888
|
-
v = uv[name];
|
|
889
|
-
data[offset] = v.x;
|
|
890
|
-
data[offset + 1] = v.y;
|
|
891
|
-
`,uniform:`
|
|
892
|
-
cv = ud[name].value;
|
|
893
|
-
v = uv[name];
|
|
894
|
-
if (cv[0] !== v.x || cv[1] !== v.y) {
|
|
895
|
-
cv[0] = v.x;
|
|
896
|
-
cv[1] = v.y;
|
|
897
|
-
gl.uniform2f(ud[name].location, v.x, v.y);
|
|
898
|
-
}
|
|
899
|
-
`},{type:"vec4<f32>",test:i=>i.type==="vec4<f32>"&&i.size===1&&i.value.red!==void 0,ubo:`
|
|
900
|
-
v = uv[name];
|
|
901
|
-
data[offset] = v.red;
|
|
902
|
-
data[offset + 1] = v.green;
|
|
903
|
-
data[offset + 2] = v.blue;
|
|
904
|
-
data[offset + 3] = v.alpha;
|
|
905
|
-
`,uniform:`
|
|
906
|
-
cv = ud[name].value;
|
|
907
|
-
v = uv[name];
|
|
908
|
-
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
|
|
909
|
-
cv[0] = v.red;
|
|
910
|
-
cv[1] = v.green;
|
|
911
|
-
cv[2] = v.blue;
|
|
912
|
-
cv[3] = v.alpha;
|
|
913
|
-
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
|
|
914
|
-
}
|
|
915
|
-
`},{type:"vec3<f32>",test:i=>i.type==="vec3<f32>"&&i.size===1&&i.value.red!==void 0,ubo:`
|
|
916
|
-
v = uv[name];
|
|
917
|
-
data[offset] = v.red;
|
|
918
|
-
data[offset + 1] = v.green;
|
|
919
|
-
data[offset + 2] = v.blue;
|
|
920
|
-
`,uniform:`
|
|
921
|
-
cv = ud[name].value;
|
|
922
|
-
v = uv[name];
|
|
923
|
-
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
|
|
924
|
-
cv[0] = v.red;
|
|
925
|
-
cv[1] = v.green;
|
|
926
|
-
cv[2] = v.blue;
|
|
927
|
-
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
928
|
-
}
|
|
929
|
-
`}]});function Wa(i,t,e,r){let s=[`
|
|
930
|
-
var v = null;
|
|
931
|
-
var v2 = null;
|
|
932
|
-
var t = 0;
|
|
933
|
-
var index = 0;
|
|
934
|
-
var name = null;
|
|
935
|
-
var arrayOffset = null;
|
|
936
|
-
`],o=0;for(let a=0;a<i.length;a++){let l=i[a],c=l.data.name,u=!1,h=0;for(let d=0;d<or.length;d++)if(or[d].test(l.data)){h=l.offset/4,s.push(`name = "${c}";`,`offset += ${h-o};`,or[d][t]||or[d].ubo),u=!0;break}if(!u)if(l.data.size>1)h=l.offset/4,s.push(e(l,h-o));else{let d=r[l.data.type];h=l.offset/4,s.push(`
|
|
937
|
-
v = uv.${c};
|
|
938
|
-
offset += ${h-o};
|
|
939
|
-
${d};
|
|
940
|
-
`)}o=h}let n=s.join(`
|
|
941
|
-
`);return new Function("uv","data","dataInt32","offset",n)}var Ih=p(()=>{Gh()});function qi(i,t){return`
|
|
942
|
-
for (let i = 0; i < ${i*t}; i++) {
|
|
943
|
-
data[offset + (((i / ${i})|0) * 4) + (i % ${i})] = v[i];
|
|
944
|
-
}
|
|
945
|
-
`}var kh,Rb,Uh=p(()=>{"use strict";kh={f32:`
|
|
946
|
-
data[offset] = v;`,i32:`
|
|
947
|
-
dataInt32[offset] = v;`,"vec2<f32>":`
|
|
948
|
-
data[offset] = v[0];
|
|
949
|
-
data[offset + 1] = v[1];`,"vec3<f32>":`
|
|
950
|
-
data[offset] = v[0];
|
|
951
|
-
data[offset + 1] = v[1];
|
|
952
|
-
data[offset + 2] = v[2];`,"vec4<f32>":`
|
|
953
|
-
data[offset] = v[0];
|
|
954
|
-
data[offset + 1] = v[1];
|
|
955
|
-
data[offset + 2] = v[2];
|
|
956
|
-
data[offset + 3] = v[3];`,"vec2<i32>":`
|
|
957
|
-
dataInt32[offset] = v[0];
|
|
958
|
-
dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
|
|
959
|
-
dataInt32[offset] = v[0];
|
|
960
|
-
dataInt32[offset + 1] = v[1];
|
|
961
|
-
dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
|
|
962
|
-
dataInt32[offset] = v[0];
|
|
963
|
-
dataInt32[offset + 1] = v[1];
|
|
964
|
-
dataInt32[offset + 2] = v[2];
|
|
965
|
-
dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
|
|
966
|
-
data[offset] = v[0];
|
|
967
|
-
data[offset + 1] = v[1];
|
|
968
|
-
data[offset + 4] = v[2];
|
|
969
|
-
data[offset + 5] = v[3];`,"mat3x3<f32>":`
|
|
970
|
-
data[offset] = v[0];
|
|
971
|
-
data[offset + 1] = v[1];
|
|
972
|
-
data[offset + 2] = v[2];
|
|
973
|
-
data[offset + 4] = v[3];
|
|
974
|
-
data[offset + 5] = v[4];
|
|
975
|
-
data[offset + 6] = v[5];
|
|
976
|
-
data[offset + 8] = v[6];
|
|
977
|
-
data[offset + 9] = v[7];
|
|
978
|
-
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
979
|
-
for (let i = 0; i < 16; i++) {
|
|
980
|
-
data[offset + i] = v[i];
|
|
981
|
-
}`,"mat3x2<f32>":qi(3,2),"mat4x2<f32>":qi(4,2),"mat2x3<f32>":qi(2,3),"mat4x3<f32>":qi(4,3),"mat2x4<f32>":qi(2,4),"mat3x4<f32>":qi(3,4)},Rb={...kh,"mat2x2<f32>":`
|
|
982
|
-
data[offset] = v[0];
|
|
983
|
-
data[offset + 1] = v[1];
|
|
984
|
-
data[offset + 2] = v[2];
|
|
985
|
-
data[offset + 3] = v[3];
|
|
986
|
-
`}});function Fb(i,t){let{size:e,align:r}=ko[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
987
|
-
v = uv.${i.data.name};
|
|
988
|
-
${t!==0?`offset += ${t};`:""}
|
|
989
|
-
|
|
990
|
-
arrayOffset = offset;
|
|
991
|
-
|
|
992
|
-
t = 0;
|
|
993
|
-
|
|
994
|
-
for(var i=0; i < ${i.data.size*(e/4)}; i++)
|
|
995
|
-
{
|
|
996
|
-
for(var j = 0; j < ${e/4}; j++)
|
|
997
|
-
{
|
|
998
|
-
${o}[arrayOffset++] = v[t++];
|
|
999
|
-
}
|
|
1000
|
-
${s!==0?`arrayOffset += ${s};`:""}
|
|
1001
|
-
}
|
|
1002
|
-
`}var Gb=p(()=>{Fh()});function Ib(i){return Wa(i,"uboWgsl",Fb,Rb)}var kb=p(()=>{Ih();Uh();Gb()});var Uo,Ub=p(()=>{P();Rh();Fh();kb();Uo=class extends $i{constructor(){super({createUboElements:Bb,generateUboSync:Ib})}};Uo.extension={type:[g.WebGPUSystem],name:"ubo"}});var br,Va=p(()=>{Nt();Gt();br=class extends at{constructor({buffer:t,offset:e,size:r}){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=r,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}}});var Xa,Db=p(()=>{"use strict";Xa=class{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}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var vr,Do,Ob=p(()=>{P();fr();Va();Qe();Db();dr();vr=128,Do=class{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 Xa({minUniformOffsetAlignment:vr});let e=256/vr;for(let r=0;r<e;r++){let s=j.UNIFORM|j.COPY_DST;r===0&&(s|=j.COPY_SRC),this._buffers.push(new bt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let 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);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/vr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/vr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/vr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/vr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new br({buffer:e,offset:(t/2|0)*256,size:vr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new Ot({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),vr,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.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}};Do.extension={type:[g.WebGPUPipes],name:"uniformBatch"}});function Ya(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):k(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}eP(i)}function eP(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=re(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=re(n.format).stride}}var Dh=p(()=>{st();Wr()});var Le,Oh=p(()=>{Hr();Le=[];Le[ft.NONE]=void 0;Le[ft.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Le[ft.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Le[ft.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Le[ft.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Le[ft.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}}});function iP(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function sP(i,t,e,r){return e<<6|i<<3|r<<1|t}var rP,Oo,Lb=p(()=>{P();st();Dh();Hr();Rs();Oh();rP={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Oo=class{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(ft.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=Le[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Ya(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=iP(t._layoutKey,e._layoutKey,r.data,r._blendModeId,rP[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===ft.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(e).pipeline,c={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(c.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(c)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Je(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Je(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let c=Object.values(s[a].attributes)[0].shaderLocation;for(let u in n)if(n[u].location===c){o[a]=u;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in e.attributeData){let c=t.attributes[l];(c.divisor??1)!==1&&k(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===o&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=sP(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}};Oo.extension={type:[g.WebGPUSystem],name:"pipeline"}});function Nb(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var zb=p(()=>{"use strict"});function Hb(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Wb=p(()=>{"use strict"});var Ki,Lh=p(()=>{Z();It();Hi();zb();hh();Nr();Vt();rt();Ah();Wb();Eh();Ki=class{constructor(t){this.rootViewPort=new X,this.viewport=new X,this.onRenderTargetChange=new Wi("onRenderTargetChange"),this.projectionMatrix=new B,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:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Hb(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,c=this.viewport,u=l.pixelWidth,h=l.pixelHeight;if(!s&&t instanceof A&&(s=t.frame),s){let d=l._resolution;c.x=s.x*d+.5|0,c.y=s.y*d+.5|0,c.width=s.width*d+.5|0,c.height=s.height*d+.5|0}else c.x=0,c.y=0,c.width=u,c.height=h;return Nb(this.projectionMatrix,0,0,c.width/l.resolution,c.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,c),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=Lt.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Lt.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}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 Dt.test(t)&&(t=Na(t).source),t instanceof Ao?e=t:t instanceof et&&(e=new Ao({colorTextures:[t]}),t.source instanceof Dt&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),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}}});var ja,Vb=p(()=>{"use strict";ja=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var $a,Xb=p(()=>{Hi();Nr();Vt();Vb();$a=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),l=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:l,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?Lt.ALL:Lt.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((c,u)=>{let h=o.contexts[u],d,f;h?d=h.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(c).createView({mipLevelCount:1}),o.msaaTextures[u]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[u]));let m=e&Lt.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:m}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let c=e&Lt.STENCIL?"clear":"load",u=e&Lt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:c,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let c=a.createCommandEncoder(),u=this.getDescriptor(t,e,r),h=c.beginRenderPass(u);h.setViewport(s.x,s.y,s.width,s.height,0,1),h.end();let d=c.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new ja;return t.colorTextures.forEach((r,s)=>{if(r instanceof Dt){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new et({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),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){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Lo,Yb=p(()=>{P();Lh();Xb();Lo=class extends Ki{constructor(t){super(t),this.adaptor=new $a,this.adaptor.init(t,this)}};Lo.extension={type:[g.WebGPUSystem],name:"renderTarget"}});var No,jb=p(()=>{P();No=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};No.extension={type:[g.WebGPUSystem],name:"shader"}});var Zt,$b=p(()=>{"use strict";Zt={};Zt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Zt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Zt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Zt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Zt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Zt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Zt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Zt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Zt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Zt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Zt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Zt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var zo,qb=p(()=>{P();Pe();$b();zo=class{constructor(){this.defaultState=new Et,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Zt[t.blendMode]||Zt.normal}]}destroy(){this.gpu=null}};zo.extension={type:[g.WebGPUSystem],name:"state"}});var Kb,Zb=p(()=>{"use strict";Kb={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var Nh,oP,Qb,Jb=p(()=>{"use strict";Nh={"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}},oP={blockBytes:4,blockWidth:1,blockHeight:1},Qb={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=Nh[i.format]||oP;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],l=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:l},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var qa,zh=p(()=>{it();st();qa={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;if(globalThis.HTMLImageElement&&r instanceof HTMLImageElement){let a=D.get().createCanvas(r.width,r.height);a.getContext("2d").drawImage(r,0,0,r.width,r.height),i.resource=a,k("ImageSource: Image element passed, converting to canvas and replacing resource.")}let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var tv,ev=p(()=>{zh();tv={type:"video",upload(i,t,e){qa.upload(i,t,e)}}});var Ka,rv=p(()=>{"use strict";Ka=class{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:`
|
|
1003
|
-
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
1004
|
-
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
1005
|
-
|
|
1006
|
-
struct VertexOutput {
|
|
1007
|
-
@builtin(position) position : vec4<f32>,
|
|
1008
|
-
@location(0) texCoord : vec2<f32>,
|
|
1009
|
-
};
|
|
1010
|
-
|
|
1011
|
-
@vertex
|
|
1012
|
-
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
|
1013
|
-
var output : VertexOutput;
|
|
1014
|
-
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
|
1015
|
-
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
|
1016
|
-
return output;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
@group(0) @binding(0) var imgSampler : sampler;
|
|
1020
|
-
@group(0) @binding(1) var img : texture_2d<f32>;
|
|
1021
|
-
|
|
1022
|
-
@fragment
|
|
1023
|
-
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
1024
|
-
return textureSample(img, imgSampler, texCoord);
|
|
1025
|
-
}
|
|
1026
|
-
`})),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){let 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 r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let c=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),u=o?1:0;for(let h=1;h<t.mipLevelCount;++h){let d=r.createView({baseMipLevel:u++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),c=d}}if(!o){let l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let c=1;c<t.mipLevelCount;++c)n.copyTextureToTexture({texture:r,mipLevel:c-1},{texture:t,mipLevel:c},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var Ho,iv=p(()=>{it();P();qt();ki();dr();Zb();Jb();zh();ev();rv();Ho=class{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:qa,buffer:Kb,video:tv,compressed:Qb},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){return this._gpuSources[t.uid]?this._gpuSources[t.uid]:this._initSource(t)}_initSource(t){if(t.autoGenerateMipmaps){let l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=Nh[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpuSources[t.uid]=this._gpu.device.createTexture(n);return 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){let 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){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Ka(this._gpu.device));let 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){let 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){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new Ot({0:e,1:e.style,2:new ut({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=D.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:D.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=se.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return se.returnCanvasAndContext(r),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Ho.extension={type:[g.WebGPUSystem],name:"texture"}});var av={};bd(av,{WebGPURenderer:()=>Hh});var nP,aP,lP,sv,ov,nv,Hh,lv=p(()=>{P();Ty();Py();Cy();ao();Bh();ke();Sb();wb();Pb();Cb();Eb();Ab();Mb();Ub();Ob();Lb();Yb();jb();qb();iv();nP=[...za,Uo,Fo,ji,Go,Bo,Ho,Lo,No,zo,Oo,Ro,Io,Mo],aP=[...Ha,Do],lP=[uo,co,lo],sv=[],ov=[],nv=[];U.handleByNamedList(g.WebGPUSystem,sv);U.handleByNamedList(g.WebGPUPipes,ov);U.handleByNamedList(g.WebGPUPipesAdaptor,nv);U.add(...nP,...aP,...lP);Hh=class extends yr{constructor(){let t={name:"webgpu",type:Bt.WEBGPU,systems:sv,renderPipes:ov,renderPipeAdaptors:nv};super(t)}}});var Wo,cv=p(()=>{P();Z();gr();Is();ks();zi();xr();Yn();we();qt();Wo=class{contextChange(t){let e=new ut({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),r=t.limits.maxBatchableTextures,s=Fe({name:"graphics",bits:[vi,Si(r),Ni,Ie]});this.shader=new St({glProgram:s,resources:{localUniforms:e,batchSamplers:wi(r)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let c=l.instructions;for(let u=0;u<l.instructionSize;u++){let h=c[u];if(h.size){for(let d=0;d<h.textures.count;d++)o.texture.bind(h.textures.textures[d],d);o.geometry.draw(h.topology,h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Wo.extension={type:[g.WebGLPipesAdaptor],name:"graphics"}});var Vo,uv=p(()=>{P();Z();gr();zi();xr();dh();we();rt();st();Vo=class{init(){let t=Fe({name:"mesh",bits:[Ni,wy,Ie]});this._shader=new St({glProgram:t,resources:{uTexture:A.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){k("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Vo.extension={type:[g.WebGLPipesAdaptor],name:"mesh"}});var Xo,hv=p(()=>{P();Pe();Xo=class{constructor(){this._tempState=Et.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Xo.extension={type:[g.WebGLPipesAdaptor],name:"batch"}});var Yo,dv=p(()=>{"use strict";Yo=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Yo||{})});var Za,fv=p(()=>{"use strict";Za=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var jo,pv=p(()=>{P();Qe();dv();fv();jo=class{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){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.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 r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&j.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=Yo.ARRAY_BUFFER;t.descriptor.usage&j.INDEX?r=Yo.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&j.UNIFORM&&(r=Yo.UNIFORM_BUFFER);let s=new Za(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};jo.extension={type:[g.WebGLSystem],name:"buffer"}});var Wh,gv,xv=p(()=>{it();P();st();Wh=class mv{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){t={...mv.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(k("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=D.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&k("multiView is disabled, but targetCanvas is not the main canvas");return}let{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 D.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{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={...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={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&k("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||k("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Wh.extension={type:[g.WebGLSystem],name:"context"};Wh.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};gv=Wh});var Qa,Vh,tt,Xh=p(()=>{"use strict";Qa=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Qa||{}),Vh=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Vh||{}),tt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(tt||{})});function yv(i){return _v[i]??_v.float32}var _v,bv=p(()=>{Xh();_v={uint8x2:tt.UNSIGNED_BYTE,uint8x4:tt.UNSIGNED_BYTE,sint8x2:tt.BYTE,sint8x4:tt.BYTE,unorm8x2:tt.UNSIGNED_BYTE,unorm8x4:tt.UNSIGNED_BYTE,snorm8x2:tt.BYTE,snorm8x4:tt.BYTE,uint16x2:tt.UNSIGNED_SHORT,uint16x4:tt.UNSIGNED_SHORT,sint16x2:tt.SHORT,sint16x4:tt.SHORT,unorm16x2:tt.UNSIGNED_SHORT,unorm16x4:tt.UNSIGNED_SHORT,snorm16x2:tt.SHORT,snorm16x4:tt.SHORT,float16x2:tt.HALF_FLOAT,float16x4:tt.HALF_FLOAT,float32:tt.FLOAT,float32x2:tt.FLOAT,float32x3:tt.FLOAT,float32x4:tt.FLOAT,uint32:tt.UNSIGNED_INT,uint32x2:tt.UNSIGNED_INT,uint32x3:tt.UNSIGNED_INT,uint32x4:tt.UNSIGNED_INT,sint32:tt.INT,sint32x2:tt.INT,sint32x3:tt.INT,sint32x4:tt.INT}});var cP,$o,vv=p(()=>{P();Wr();Dh();bv();cP={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},$o=class{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(){let 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");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,l)=>{r.drawElementsInstancedANGLE(s,o,n,a,l)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],l=a[n];if(l)return a[e._key]=l,l;Ya(t,e._attributeData);let c=t.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let u=0;u<c.length;u++){let h=c[u];o.bind(h)}return this.activateVao(t,e),a[e._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let l=o[a],c=l.buffer,u=s.getGlBuffer(c),h=e._attributeData[a];if(h){n!==u&&(s.bind(c),n=u);let d=h.location;r.enableVertexAttribArray(d);let f=re(l.format),m=yv(l.format);if(h.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,m,l.stride,l.offset):r.vertexAttribPointer(d,f.size,m,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let _=l.divisor??1;r.vertexAttribDivisor(d,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=cP[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,c=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s!==1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,c,(r||0)*l,s):o.drawElements(a,e||n.indexBuffer.data.length,c,(r||0)*l)}else s!==1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.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,this._geometryVaoHash=null}};$o.extension={type:[g.WebGLSystem],name:"geometry"}});var uP,Yh,Sv,wv=p(()=>{P();st();_i();we();Pe();Vt();rt();tr();uP=new pe({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Yh=class Tv{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Tv.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(k("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Et.for2d();let s=new vt({vertex:`
|
|
1027
|
-
attribute vec2 aPosition;
|
|
1028
|
-
out vec2 vUv;
|
|
1029
|
-
|
|
1030
|
-
void main() {
|
|
1031
|
-
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
1032
|
-
|
|
1033
|
-
vUv = (aPosition + 1.0) / 2.0;
|
|
1034
|
-
|
|
1035
|
-
// flip dem UVs
|
|
1036
|
-
vUv.y = 1.0 - vUv.y;
|
|
1037
|
-
}`,fragment:`
|
|
1038
|
-
in vec2 vUv;
|
|
1039
|
-
out vec4 finalColor;
|
|
1040
|
-
|
|
1041
|
-
uniform sampler2D uTexture;
|
|
1042
|
-
|
|
1043
|
-
void main() {
|
|
1044
|
-
finalColor = texture(uTexture, vUv);
|
|
1045
|
-
}`,name:"big-triangle"});this._bigTriangleShader=new St({glProgram:s,resources:{uTexture:A.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let 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:uP,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new A({source:new et({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)}};Yh.extension={type:[g.WebGLSystem],name:"backBuffer",priority:1};Yh.defaultOptions={useBackBuffer:!1};Sv=Yh});var qo,Pv=p(()=>{P();qo=class{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)))}};qo.extension={type:[g.WebGLSystem],name:"colorMask"}});var Ko,Cv=p(()=>{P();Ko=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:s,state:o,skipSync:n,topology:a,size:l,start:c,instanceCount:u}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,l,c,u??r.instanceCount)}destroy(){this._renderer=null}};Ko.extension={type:[g.WebGLSystem],name:"encoder"}});var Zo,Ev=p(()=>{P();Bc();Zo=class{constructor(t){this._renderer=t}contextChange(){let t=this._renderer.gl;this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=Nn(this.maxTextures,t);let e=this._renderer.context.webGLVersion===2;this.maxUniformBindings=e?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}};Zo.extension={type:[g.WebGLSystem],name:"limits"}});var Qo,Av=p(()=>{P();Oh();Hr();Qo=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:ft.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:ft.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=ft.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Le[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===ft.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};Qo.extension={type:[g.WebGLSystem],name:"stencil"}});function Mv(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=jh[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let l=s%e;l>0&&e-l<a?s+=(e-l)%16:s+=(r-l%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var jh,$h=p(()=>{"use strict";jh={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 Bv(i,t){let e=Math.max(jh[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
1046
|
-
v = uv.${i.data.name};
|
|
1047
|
-
offset += ${t};
|
|
1048
|
-
|
|
1049
|
-
arrayOffset = offset;
|
|
1050
|
-
|
|
1051
|
-
t = 0;
|
|
1052
|
-
|
|
1053
|
-
for(var i=0; i < ${i.data.size*e}; i++)
|
|
1054
|
-
{
|
|
1055
|
-
for(var j = 0; j < ${r}; j++)
|
|
1056
|
-
{
|
|
1057
|
-
${o}[arrayOffset++] = v[t++];
|
|
1058
|
-
}
|
|
1059
|
-
${s!==0?`arrayOffset += ${s};`:""}
|
|
1060
|
-
}
|
|
1061
|
-
`}var Rv=p(()=>{$h()});function Fv(i){return Wa(i,"uboStd40",Bv,kh)}var Gv=p(()=>{Ih();Uh();Rv()});var Jo,Iv=p(()=>{P();Rh();$h();Gv();Jo=class extends $i{constructor(){super({createUboElements:Mv,generateUboSync:Fv})}};Jo.extension={type:[g.WebGLSystem],name:"ubo"}});var Ja,kv=p(()=>{"use strict";Ja=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var tl,Uv=p(()=>{It();st();Nr();Hi();kv();tl=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new X}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new X}copyToTexture(t,e,r,s,o){let n=this._renderTargetSystem,a=this._renderer,l=n.getGpuRenderTarget(t),c=a.gl;return this.finishRenderPass(t),c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),c.copyTexSubImage2D(c.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),l=s.y;t.isRoot&&(l=n.pixelHeight-s.height),t.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});let c=this._renderer.gl;c.bindFramebuffer(c.FRAMEBUFFER,a.framebuffer);let u=this._viewPortCache;(u.x!==s.x||u.y!==l||u.width!==s.width||u.height!==s.height)&&(u.x=s.x,u.y=l,u.width=s.width,u.height=s.height,c.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Ja;return t.colorTexture instanceof Dt?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let 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(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Lt.ALL:Lt.NONE);let o=this._renderer.gl;if(e&Lt.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let l=n.source;l.antialias&&(r.context.supports.msaa?e.msaa=!0:k("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(l,0);let u=r.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,u,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let c=s.createRenderbuffer();e.msaaRenderBuffer[l]=c})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let c=a.source;s.texture.bindSource(c,0);let h=s.texture.getGlSource(c).internalFormat,d=e.msaaRenderBuffer[l];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,h,c.pixelWidth,c.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+l,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let 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){let e=t.colorTexture.resource;this._renderer.context.multiView&&Dt.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Dt.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var tn,Dv=p(()=>{P();Lh();Uv();tn=class extends Ki{constructor(t){super(t),this.adaptor=new tl,this.adaptor.init(t,this)}};tn.extension={type:[g.WebGLSystem],name:"renderTarget"}});function Ov(i,t){let e=[],r=[`
|
|
1062
|
-
var g = s.groups;
|
|
1063
|
-
var sS = r.shader;
|
|
1064
|
-
var p = s.glProgram;
|
|
1065
|
-
var ugS = r.uniformGroup;
|
|
1066
|
-
var resources;
|
|
1067
|
-
`],s=!1,o=0,n=t._getProgramData(i.glProgram);for(let l in i.groups){let c=i.groups[l];e.push(`
|
|
1068
|
-
resources = g[${l}].resources;
|
|
1069
|
-
`);for(let u in c.resources){let h=c.resources[u];if(h instanceof ut)if(h.ubo){let d=i._uniformBindMap[l][Number(u)];e.push(`
|
|
1070
|
-
sS.bindUniformBlock(
|
|
1071
|
-
resources[${u}],
|
|
1072
|
-
'${d}',
|
|
1073
|
-
${i.glProgram._uniformBlockData[d].index}
|
|
1074
|
-
);
|
|
1075
|
-
`)}else e.push(`
|
|
1076
|
-
ugS.updateUniformGroup(resources[${u}], p, sD);
|
|
1077
|
-
`);else if(h instanceof br){let d=i._uniformBindMap[l][Number(u)];e.push(`
|
|
1078
|
-
sS.bindUniformBlock(
|
|
1079
|
-
resources[${u}],
|
|
1080
|
-
'${d}',
|
|
1081
|
-
${i.glProgram._uniformBlockData[d].index}
|
|
1082
|
-
);
|
|
1083
|
-
`)}else if(h instanceof et){let d=i._uniformBindMap[l][u],f=n.uniformData[d];f&&(s||(s=!0,r.push(`
|
|
1084
|
-
var tS = r.texture;
|
|
1085
|
-
`)),t._gl.uniform1i(f.location,o),e.push(`
|
|
1086
|
-
tS.bind(resources[${u}], ${o});
|
|
1087
|
-
`),o++)}}}let a=[...r,...e].join(`
|
|
1088
|
-
`);return new Function("r","s","sD",a)}var Lv=p(()=>{Va();qt();Vt()});var el,Nv=p(()=>{"use strict";el=class{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 qh(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var zv=p(()=>{"use strict"});function Kh(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function rl(i,t){switch(i){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 Kh(2*t);case"bvec3":return Kh(3*t);case"bvec4":return Kh(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}var Zh=p(()=>{"use strict"});function Qh(i,t){if(!il){let e=Object.keys(Hv);il={};for(let r=0;r<e.length;++r){let s=e[r];il[i[s]]=Hv[s]}}return il[t]}function Wv(i,t){let e=Qh(i,t);return hP[e]||"float32"}var il,Hv,hP,Jh=p(()=>{"use strict";il=null,Hv={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"},hP={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 Vv(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let l=Wv(t,a.type);r[a.name]={location:0,format:l,stride:re(l).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var Xv=p(()=>{Wr();Jh()});function Yv(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var jv=p(()=>{"use strict"});function $v(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Qh(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:rl(l,o.size)}}return e}var qv=p(()=>{Zh();Jh()});function Kv(i,t){let e=i.getShaderSource(t).split(`
|
|
1089
|
-
`).map((c,u)=>`${u}: ${c}`),r=i.getShaderInfoLog(t),s=r.split(`
|
|
1090
|
-
`),o={},n=s.map(c=>parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(c=>c&&!o[c]?(o[c]=!0,!0):!1),a=[""];n.forEach(c=>{e[c-1]=`%c${e[c-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(`
|
|
1091
|
-
`);a[0]=l,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Zv(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||Kv(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||Kv(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var Qv=p(()=>{"use strict"});function Jv(i,t){let e=qh(i,i.VERTEX_SHADER,t.vertex),r=qh(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?k("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||Zv(i,s,e,r),t._attributeData=Vv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=$v(s,i),t._uniformBlockData=Yv(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let l in t._uniformData){let c=t._uniformData[l];n[l]={location:i.getUniformLocation(s,l),value:rl(c.type,c.size)}}return new el(s,n)}var t0=p(()=>{st();Nv();zv();Zh();Xv();jv();qv();Qv()});var sl,en,e0=p(()=>{P();Lv();t0();sl={textureCount:0,blockIndex:0},en=class{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;sl.textureCount=0,sl.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,sl)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,sl)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,l=s.updateBuffer(a),c=s.freeLocationForBufferBase(l);if(n){let{offset:h,size:d}=t;h===0&&d===a.data.byteLength?s.bindBufferBase(l,c):s.bindBufferRange(l,c,h)}else s.getLastBindBaseLocation(l)!==c&&s.bindBufferBase(l,c);let u=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==c&&(o.uniformBlockBindings[r]=c,this._renderer.gl.uniformBlockBinding(o.program,u,c))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=Jv(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(t,e){return Ov(t,e)}resetState(){this._activeProgram=null}};en.extension={type:[g.WebGLSystem],name:"shader"}});var r0,i0,s0=p(()=>{"use strict";r0={f32:`if (cv !== v) {
|
|
1092
|
-
cu.value = v;
|
|
1093
|
-
gl.uniform1f(location, v);
|
|
1094
|
-
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
1095
|
-
cv[0] = v[0];
|
|
1096
|
-
cv[1] = v[1];
|
|
1097
|
-
gl.uniform2f(location, v[0], v[1]);
|
|
1098
|
-
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
1099
|
-
cv[0] = v[0];
|
|
1100
|
-
cv[1] = v[1];
|
|
1101
|
-
cv[2] = v[2];
|
|
1102
|
-
gl.uniform3f(location, v[0], v[1], v[2]);
|
|
1103
|
-
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
1104
|
-
cv[0] = v[0];
|
|
1105
|
-
cv[1] = v[1];
|
|
1106
|
-
cv[2] = v[2];
|
|
1107
|
-
cv[3] = v[3];
|
|
1108
|
-
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
1109
|
-
}`,i32:`if (cv !== v) {
|
|
1110
|
-
cu.value = v;
|
|
1111
|
-
gl.uniform1i(location, v);
|
|
1112
|
-
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
1113
|
-
cv[0] = v[0];
|
|
1114
|
-
cv[1] = v[1];
|
|
1115
|
-
gl.uniform2i(location, v[0], v[1]);
|
|
1116
|
-
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
1117
|
-
cv[0] = v[0];
|
|
1118
|
-
cv[1] = v[1];
|
|
1119
|
-
cv[2] = v[2];
|
|
1120
|
-
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
1121
|
-
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
1122
|
-
cv[0] = v[0];
|
|
1123
|
-
cv[1] = v[1];
|
|
1124
|
-
cv[2] = v[2];
|
|
1125
|
-
cv[3] = v[3];
|
|
1126
|
-
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
1127
|
-
}`,u32:`if (cv !== v) {
|
|
1128
|
-
cu.value = v;
|
|
1129
|
-
gl.uniform1ui(location, v);
|
|
1130
|
-
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
1131
|
-
cv[0] = v[0];
|
|
1132
|
-
cv[1] = v[1];
|
|
1133
|
-
gl.uniform2ui(location, v[0], v[1]);
|
|
1134
|
-
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
1135
|
-
cv[0] = v[0];
|
|
1136
|
-
cv[1] = v[1];
|
|
1137
|
-
cv[2] = v[2];
|
|
1138
|
-
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
1139
|
-
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
1140
|
-
cv[0] = v[0];
|
|
1141
|
-
cv[1] = v[1];
|
|
1142
|
-
cv[2] = v[2];
|
|
1143
|
-
cv[3] = v[3];
|
|
1144
|
-
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
1145
|
-
}`,bool:`if (cv !== v) {
|
|
1146
|
-
cu.value = v;
|
|
1147
|
-
gl.uniform1i(location, v);
|
|
1148
|
-
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
1149
|
-
cv[0] = v[0];
|
|
1150
|
-
cv[1] = v[1];
|
|
1151
|
-
gl.uniform2i(location, v[0], v[1]);
|
|
1152
|
-
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
1153
|
-
cv[0] = v[0];
|
|
1154
|
-
cv[1] = v[1];
|
|
1155
|
-
cv[2] = v[2];
|
|
1156
|
-
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
1157
|
-
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
1158
|
-
cv[0] = v[0];
|
|
1159
|
-
cv[1] = v[1];
|
|
1160
|
-
cv[2] = v[2];
|
|
1161
|
-
cv[3] = v[3];
|
|
1162
|
-
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
1163
|
-
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},i0={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 o0(i,t){let e=[`
|
|
1164
|
-
var v = null;
|
|
1165
|
-
var cv = null;
|
|
1166
|
-
var cu = null;
|
|
1167
|
-
var t = 0;
|
|
1168
|
-
var gl = renderer.gl;
|
|
1169
|
-
var name = null;
|
|
1170
|
-
`];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof ut?i.uniforms[r].ubo?e.push(`
|
|
1171
|
-
renderer.shader.bindUniformBlock(uv.${r}, "${r}");
|
|
1172
|
-
`):e.push(`
|
|
1173
|
-
renderer.shader.updateUniformGroup(uv.${r});
|
|
1174
|
-
`):i.uniforms[r]instanceof br&&e.push(`
|
|
1175
|
-
renderer.shader.bindBufferResource(uv.${r}, "${r}");
|
|
1176
|
-
`);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<or.length;n++){let a=or[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,or[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?r0:i0)[s.type].replace("location",`ud["${r}"].location`);e.push(`
|
|
1177
|
-
cu = ud["${r}"];
|
|
1178
|
-
cv = cu.value;
|
|
1179
|
-
v = uv["${r}"];
|
|
1180
|
-
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1181
|
-
`))}var n0=p(()=>{Va();qt();Gh();s0()});var rn,a0=p(()=>{P();n0();rn=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return o0(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};rn.extension={type:[g.WebGLSystem],name:"uniformGroup"}});function l0(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof D.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var c0=p(()=>{it()});var dP,fP,pP,mP,gP,xP,u0,h0,d0=p(()=>{P();Pe();c0();dP=0,fP=1,pP=2,mP=3,gP=4,xP=5,u0=class td{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[dP]=this.setBlend,this.map[fP]=this.setOffset,this.map[pP]=this.setCullFace,this.map[mP]=this.setDepthTest,this.map[gP]=this.setFrontFace,this.map[xP]=this.setDepthMask,this.checks=[],this.defaultState=Et.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=l0(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;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(td._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(td._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;let 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;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.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){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,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}};u0.extension={type:[g.WebGLSystem],name:"state"};h0=u0});var ol,f0=p(()=>{Xh();ol=class{constructor(t){this.target=Vh.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=tt.UNSIGNED_BYTE,this.internalFormat=Qa.RGBA,this.format=Qa.RGBA,this.samplerType=0}}});var p0,m0=p(()=>{"use strict";p0={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var _P,g0,x0=p(()=>{"use strict";_P={"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},g0={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!_P[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var nl,ed=p(()=>{"use strict";nl={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,l=i.resourceWidth,c=i.resourceHeight;l<n||c<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var _0,y0=p(()=>{ed();_0={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}nl.upload(i,t,e,r)}}});var rd,b0,al,v0,T0=p(()=>{"use strict";rd={linear:9729,nearest:9728},b0={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},al={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},v0={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function id(i,t,e,r,s,o,n,a){let l=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let c=al[n?"clamp-to-edge":i.addressModeU],u=al[n?"clamp-to-edge":i.addressModeV],h=al[n?"clamp-to-edge":i.addressModeW];t[s](l,t.TEXTURE_WRAP_S,c),t[s](l,t.TEXTURE_WRAP_T,u),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,h)}if((!a||i.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,rd[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let c=b0[i.minFilter][i.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,c)}}else t[s](l,t.TEXTURE_MIN_FILTER,rd[i.minFilter]);if(r&&i.maxAnisotropy>1){let c=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,r.TEXTURE_MAX_ANISOTROPY_EXT,c)}i.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,v0[i.compare])}var S0=p(()=>{T0()});function w0(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var P0=p(()=>{"use strict"});function C0(i,t){let e={},r=i.RGBA;return i instanceof D.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.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}:{}}}var E0=p(()=>{it()});function A0(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var M0=p(()=>{"use strict"});var yP,sn,B0=p(()=>{it();P();rt();f0();m0();x0();ed();y0();S0();P0();E0();M0();yP=4,sn=class{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:nl,buffer:p0,video:_0,compressed:g0},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=C0(t,this._renderer.context.extensions),this._mapFormatToType=A0(t),this._mapFormatToFormat=w0(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(A.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=A.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new ol(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,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),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,id(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,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);let r=this.getGlSource(t);this._gl.generateMipmap(r.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){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,id(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!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){let{pixels:e,width:r,height:s}=this.getPixels(t),o=D.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(yP*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),c=a.renderTarget.getGpuRenderTarget(l),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),u.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,u.RGBA,u.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._glTextures=null,this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(A.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};sn.extension={type:[g.WebGLSystem],name:"texture"}});var I0={};bd(I0,{WebGLRenderer:()=>sd});var bP,vP,TP,R0,F0,G0,sd,k0=p(()=>{P();cv();uv();hv();ao();Bh();ke();pv();xv();vv();wv();Pv();Cv();Ev();Av();Iv();Dv();e0();a0();d0();B0();bP=[...za,Jo,Sv,gv,Zo,jo,sn,tn,$o,rn,en,Ko,h0,Qo,qo],vP=[...Ha],TP=[Xo,Vo,Wo],R0=[],F0=[],G0=[];U.handleByNamedList(g.WebGLSystem,R0);U.handleByNamedList(g.WebGLPipes,F0);U.handleByNamedList(g.WebGLPipesAdaptor,G0);U.add(...bP,...vP,...TP);sd=class extends yr{constructor(){let t={name:"webgl",type:Bt.WEBGL,systems:R0,renderPipes:F0,renderPipeAdaptors:G0};super(t)}}});var fd=ar(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.loop=wr.conditional=wr.parse=void 0;var KP=function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:r;if(Array.isArray(e))e.forEach(function(n){return i(t,n,r,s)});else if(typeof e=="function")e(t,r,s,i);else{var o=Object.keys(e)[0];Array.isArray(e[o])?(s[o]={},i(t,e[o],r,s[o])):s[o]=e[o](t,r,s,i)}return r};wr.parse=KP;var ZP=function(t,e){return function(r,s,o,n){e(r,s,o)&&n(r,t,s,o)}};wr.conditional=ZP;var QP=function(t,e){return function(r,s,o,n){for(var a=[],l=r.pos;e(r,s,o);){var c={};if(n(r,t,s,c),r.pos===l)break;l=r.pos,a.push(c)}return a}};wr.loop=QP});var pd=ar(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.readBits=Rt.readArray=Rt.readUnsigned=Rt.readString=Rt.peekBytes=Rt.readBytes=Rt.peekByte=Rt.readByte=Rt.buildStream=void 0;var JP=function(t){return{data:t,pos:0}};Rt.buildStream=JP;var oT=function(){return function(t){return t.data[t.pos++]}};Rt.readByte=oT;var tC=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(e){return e.data[e.pos+t]}};Rt.peekByte=tC;var gl=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};Rt.readBytes=gl;var eC=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};Rt.peekBytes=eC;var rC=function(t){return function(e){return Array.from(gl(t)(e)).map(function(r){return String.fromCharCode(r)}).join("")}};Rt.readString=rC;var iC=function(t){return function(e){var r=gl(2)(e);return t?(r[1]<<8)+r[0]:(r[0]<<8)+r[1]}};Rt.readUnsigned=iC;var sC=function(t,e){return function(r,s,o){for(var n=typeof e=="function"?e(r,s,o):e,a=gl(t),l=new Array(n),c=0;c<n;c++)l[c]=a(r);return l}};Rt.readArray=sC;var oC=function(t,e,r){for(var s=0,o=0;o<r;o++)s+=t[e+o]&&Math.pow(2,r-o-1);return s},nC=function(t){return function(e){for(var r=oT()(e),s=new Array(8),o=0;o<8;o++)s[7-o]=!!(r&1<<o);return Object.keys(t).reduce(function(n,a){var l=t[a];return l.length?n[a]=oC(s,l.index,l.length):n[a]=s[l.index],n},{})}};Rt.readBits=nC});var nT=ar(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.default=void 0;var Pr=fd(),K=pd(),xl={blocks:function(t){for(var e=0,r=[],s=t.data.length,o=0,n=(0,K.readByte)()(t);n!==e&&n;n=(0,K.readByte)()(t)){if(t.pos+n>=s){var a=s-t.pos;r.push((0,K.readBytes)(a)(t)),o+=a;break}r.push((0,K.readBytes)(n)(t)),o+=n}for(var l=new Uint8Array(o),c=0,u=0;u<r.length;u++)l.set(r[u],c),c+=r[u].length;return l}},aC=(0,Pr.conditional)({gce:[{codes:(0,K.readBytes)(2)},{byteSize:(0,K.readByte)()},{extras:(0,K.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,K.readUnsigned)(!0)},{transparentColorIndex:(0,K.readByte)()},{terminator:(0,K.readByte)()}]},function(i){var t=(0,K.peekBytes)(2)(i);return t[0]===33&&t[1]===249}),lC=(0,Pr.conditional)({image:[{code:(0,K.readByte)()},{descriptor:[{left:(0,K.readUnsigned)(!0)},{top:(0,K.readUnsigned)(!0)},{width:(0,K.readUnsigned)(!0)},{height:(0,K.readUnsigned)(!0)},{lct:(0,K.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,Pr.conditional)({lct:(0,K.readArray)(3,function(i,t,e){return Math.pow(2,e.descriptor.lct.size+1)})},function(i,t,e){return e.descriptor.lct.exists}),{data:[{minCodeSize:(0,K.readByte)()},xl]}]},function(i){return(0,K.peekByte)()(i)===44}),cC=(0,Pr.conditional)({text:[{codes:(0,K.readBytes)(2)},{blockSize:(0,K.readByte)()},{preData:function(t,e,r){return(0,K.readBytes)(r.text.blockSize)(t)}},xl]},function(i){var t=(0,K.peekBytes)(2)(i);return t[0]===33&&t[1]===1}),uC=(0,Pr.conditional)({application:[{codes:(0,K.readBytes)(2)},{blockSize:(0,K.readByte)()},{id:function(t,e,r){return(0,K.readString)(r.blockSize)(t)}},xl]},function(i){var t=(0,K.peekBytes)(2)(i);return t[0]===33&&t[1]===255}),hC=(0,Pr.conditional)({comment:[{codes:(0,K.readBytes)(2)},xl]},function(i){var t=(0,K.peekBytes)(2)(i);return t[0]===33&&t[1]===254}),dC=[{header:[{signature:(0,K.readString)(3)},{version:(0,K.readString)(3)}]},{lsd:[{width:(0,K.readUnsigned)(!0)},{height:(0,K.readUnsigned)(!0)},{gct:(0,K.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,K.readByte)()},{pixelAspectRatio:(0,K.readByte)()}]},(0,Pr.conditional)({gct:(0,K.readArray)(3,function(i,t){return Math.pow(2,t.lsd.gct.size+1)})},function(i,t){return t.lsd.gct.exists}),{frames:(0,Pr.loop)([aC,uC,hC,lC,cC],function(i){var t=(0,K.peekByte)()(i);return t===33||t===44})}],fC=dC;_l.default=fC});var aT=ar(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.deinterlace=void 0;var pC=function(t,e){for(var r=new Array(t.length),s=t.length/e,o=function(d,f){var m=t.slice(f*e,(f+1)*e);r.splice.apply(r,[d*e,e].concat(m))},n=[0,4,2,1],a=[8,8,4,2],l=0,c=0;c<4;c++)for(var u=n[c];u<s;u+=a[c])o(u,l),l++;return r};yl.deinterlace=pC});var lT=ar(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.lzw=void 0;var mC=function(t,e,r){var s=4096,o=-1,n=r,a,l,c,u,h,d,f,S,m,_,E,x,G,C,F,M,y=new Array(r),b=new Array(s),v=new Array(s),T=new Array(s+1);for(x=t,l=1<<x,h=l+1,a=l+2,f=o,u=x+1,c=(1<<u)-1,m=0;m<l;m++)b[m]=0,v[m]=m;var E,S,w,G,C,M,F;for(E=S=w=G=C=M=F=0,_=0;_<n;){if(C===0){if(S<u){E+=e[F]<<S,S+=8,F++;continue}if(m=E&c,E>>=u,S-=u,m>a||m==h)break;if(m==l){u=x+1,c=(1<<u)-1,a=l+2,f=o;continue}if(f==o){T[C++]=v[m],f=m,G=m;continue}for(d=m,m==a&&(T[C++]=G,m=f);m>l;)T[C++]=v[m],m=b[m];G=v[m]&255,T[C++]=G,a<s&&(b[a]=f,v[a]=G,a++,!(a&c)&&a<s&&(u++,c+=a)),f=d}C--,y[M++]=T[C],_++}for(_=M;_<n;_++)y[_]=0;return y};bl.lzw=mC});var uT=ar(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.decompressFrames=Cr.decompressFrame=Cr.parseGIF=void 0;var gC=vC(nT()),xC=fd(),_C=pd(),yC=aT(),bC=lT();function vC(i){return i&&i.__esModule?i:{default:i}}var TC=function(t){var e=new Uint8Array(t);return(0,xC.parse)((0,_C.buildStream)(e),gC.default)};Cr.parseGIF=TC;var SC=function(t){for(var e=t.pixels.length,r=new Uint8ClampedArray(e*4),s=0;s<e;s++){var o=s*4,n=t.pixels[s],a=t.colorTable[n]||[0,0,0];r[o]=a[0],r[o+1]=a[1],r[o+2]=a[2],r[o+3]=n!==t.transparentIndex?255:0}return r},cT=function(t,e,r){if(!t.image){console.warn("gif frame does not have associated image.");return}var s=t.image,o=s.descriptor.width*s.descriptor.height,n=(0,bC.lzw)(s.data.minCodeSize,s.data.blocks,o);s.descriptor.lct.interlaced&&(n=(0,yC.deinterlace)(n,s.descriptor.width));var a={pixels:n,dims:{top:t.image.descriptor.top,left:t.image.descriptor.left,width:t.image.descriptor.width,height:t.image.descriptor.height}};return s.descriptor.lct&&s.descriptor.lct.exists?a.colorTable=s.lct:a.colorTable=e,t.gce&&(a.delay=(t.gce.delay||10)*10,a.disposalType=t.gce.extras.disposal,t.gce.extras.transparentColorGiven&&(a.transparentIndex=t.gce.transparentColorIndex)),r&&(a.patch=SC(a)),a};Cr.decompressFrame=cT;var wC=function(t,e){return t.frames.filter(function(r){return r.image}).map(function(r){return cT(r,t.gct,e)})};Cr.decompressFrames=wC});P();var fy={extension:{type:g.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(dy(),Hw))}};P();var my={extension:{type:g.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(py(),Ww))}};P();Un();Bn();P();it();ao();var ka;function by(i){return ka!==void 0||(ka=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??yr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!D.get().getWebGLRenderingContext())return!1;let r=D.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),ka}it();var Ua;async function vy(i={}){return Ua!==void 0||(Ua=await(async()=>{let t=D.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Ua}ao();var U0=["webgl","webgpu","canvas"];async function D0(i){let t=[];i.preference?(t.push(i.preference),U0.forEach(o=>{o!==i.preference&&t.push(o)})):t=U0.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await vy()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(lv(),av));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&by(i.failIfMajorPerformanceCaveat??yr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(k0(),I0));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}ve();xh();pt();var O0=class od{constructor(...t){this.stage=new dt,t[0]!==void 0&&O(V,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await D0(t),od._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return O(V,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=od._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};O0._plugins=[];var ll=O0;U.handleByList(g.Application,ll._plugins);U.add(_o);P();cr();gc();it();P();ur();ql();It();rt();Wu();ju();var on=class extends Di{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l,rotate:c}=r[n.page],u=nt.transformRectCoords(n,a,c,new X),h=new A({frame:u,orig:new X(0,0,n.width,n.height),source:l,rotate:c});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:h}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Qs.install(t)}static uninstall(t){Qs.uninstall(t)}};var cl={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let h in t){let d=t[h].match(/^[a-z]+/gm)[0],f=t[h].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let _ in f){let x=f[_].split("="),y=x[0],b=x[1].replace(/"/gm,""),v=parseFloat(b),T=isNaN(v)?b:v;m[y]=T}e[d].push(m)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let h=0;h<a.length;h++)r.pages.push({id:parseInt(a[h].id,10)||0,file:a[h].file});let l={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let c=e.char;for(let h=0;h<c.length;h++){let d=c[h],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),l[f]=m,r.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let u=e.kerning||[];for(let h=0;h<u.length;h++){let d=parseInt(u[h].first,10),f=parseInt(u[h].second,10),m=parseInt(u[h].amount,10);r.chars[l[f]].kerning[l[d]]=m}return r}};it();var nd={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)t.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let c=0;c<n.length;c++){let u=n[c],h=parseInt(u.getAttribute("id"),10),d=u.getAttribute("letter")??u.getAttribute("char")??String.fromCharCode(h);d==="space"&&(d=" "),l[h]=d,t.chars[d]={id:h,page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xOffset:parseInt(u.getAttribute("xoffset"),10),yOffset:parseInt(u.getAttribute("yoffset"),10),xAdvance:parseInt(u.getAttribute("xadvance"),10),kerning:{}}}for(let c=0;c<a.length;c++){let u=parseInt(a[c].getAttribute("first"),10),h=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);t.chars[l[h]].kerning[l[u]]=d}return t}};var ad={test(i){return typeof i=="string"&&i.includes("<font>")?nd.test(D.get().parseXML(i)):!1},parse(i){return nd.parse(D.get().parseXML(i))}};var SP=[".xml",".fnt"],L0={extension:{type:g.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof on,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},N0={extension:{type:g.LoadParser,priority:Yt.Normal},name:"loadBitmapFont",id:"bitmap-font",test(i){return SP.includes(Ct.extname(i).toLowerCase())},async testParse(i){return cl.test(i)||ad.test(i)},async parse(i,t,e){let r=cl.test(i)?cl.parse(i):ad.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;h<o.length;++h){let d=o[h].file,f=Ct.join(Ct.dirname(s),d);f=vs(f,s),n.push({src:f,data:a})}let l=await e.load(n),c=n.map(h=>l[h.src]);return new on({data:r,textures:c},s)},async load(i,t){return await(await D.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};st();var ul=class{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;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)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())}};hr();P();rt();var z0={extension:{type:g.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof A),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};P();async function hl(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var H0={extension:{type:g.DetectionParser,priority:1},test:async()=>hl("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};P();var W0=["png","jpg","jpeg"],V0={extension:{type:g.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...W0],remove:async i=>i.filter(t=>!W0.includes(t))};P();var wP="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Tr(i){return wP?!1:document.createElement("video").canPlayType(i)!==""}var X0={extension:{type:g.DetectionParser,priority:0},test:async()=>Tr("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};P();var Y0={extension:{type:g.DetectionParser,priority:0},test:async()=>Tr("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};P();var j0={extension:{type:g.DetectionParser,priority:0},test:async()=>Tr("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};P();var $0={extension:{type:g.DetectionParser,priority:0},test:async()=>hl("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};st();ur();bs();Mn();var q0=class dl{constructor(){this.loadOptions={...dl.defaultOptions},this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if((e.parser||e.loadParser)&&(o=this._parserHash[e.parser||e.loadParser],e.loadParser&&k(`[Assets] "loadParser" is deprecated, use "parser" instead for ${t}`),o||k(`[Assets] specified load parser "${e.parser||e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return k(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=typeof e=="function"?{...dl.defaultOptions,...this.loadOptions,onProgress:e}:{...dl.defaultOptions,...this.loadOptions,...e||{}},{onProgress:s,onError:o,strategy:n,retryCount:a,retryDelay:l}=r,c=0,u={},h=Lr(t),d=jt(t,_=>({alias:[_],src:_,data:{}})),f=d.reduce((_,x)=>_+(x.progressSize||1),0),m=d.map(async _=>{let x=Ct.toAbsolute(_.src);u[_.src]||(await this._loadAssetWithRetry(x,_,{onProgress:s,onError:o,strategy:n,retryCount:a,retryDelay:l},u),c+=_.progressSize||1,s&&s(c/f))});return await Promise.all(m),h?u[d[0].src]:u}async unload(t){let r=jt(t,s=>({alias:[s],src:s})).map(async s=>{let o=Ct.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id?k("[Assets] parser should have an id"):(t[e.name]||t[e.id])&&k(`[Assets] parser id conflict "${e.id}"`),t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,r,s){let o=0,{onError:n,strategy:a,retryCount:l,retryDelay:c}=r,u=h=>new Promise(d=>setTimeout(d,h));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),s[e.src]=await this.promiseCache[t].promise;return}catch(h){delete this.promiseCache[t],delete s[e.src],o++;let d=a!=="retry"||o>l;if(a==="retry"&&!d){n&&n(h,e),await u(c);continue}if(a==="skip"){n&&n(h,e);return}throw n&&n(h,e),new Error(`[Loader.load] Failed to load ${t}.
|
|
1182
|
-
${h}`)}}};q0.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};var K0=q0;it();P();function xe(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}ur();function _e(i,t){let e=i.split("?")[0],r=Ct.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}cr();var PP=".json",CP="application/json",Z0={extension:{type:g.LoadParser,priority:Yt.Low},name:"loadJson",id:"json",test(i){return xe(i,CP)||_e(i,PP)},async load(i){return await(await D.get().fetch(i)).json()}};it();P();cr();var EP=".txt",AP="text/plain",Q0={name:"loadTxt",id:"text",extension:{type:g.LoadParser,priority:Yt.Low,name:"loadTxt"},test(i){return xe(i,AP)||_e(i,EP)},async load(i){return await(await D.get().fetch(i)).text()}};it();P();st();ur();hr();cr();var MP=["normal","bold","100","200","300","400","500","600","700","800","900"],BP=[".ttf",".otf",".woff",".woff2"],RP=["font/ttf","font/otf","font/woff","font/woff2"],FP=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function GP(i){let t=Ct.extname(i),s=Ct.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(FP)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var IP=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function kP(i){return IP.test(i)?i:encodeURI(i)}var J0={extension:{type:g.LoadParser,priority:Yt.Low},name:"loadWebFont",id:"web-font",test(i){return xe(i,RP)||_e(i,BP)},async load(i,t){let e=D.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??GP(i),o=t.data?.weights?.filter(a=>MP.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let l=o[a],c=new FontFace(s,`url(${kP(i)})`,{...n,weight:l});await c.load(),e.add(c),r.push(c)}return J.has(`${s}-and-url`)?J.get(`${s}-and-url`).entries.push({url:i,faces:r}):J.set(`${s}-and-url`,{entries:[{url:i,faces:r}]}),r.length===1?r[0]:r}return k("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){let t=Array.isArray(i)?i:[i],e=t[0].family,r=J.get(`${e}-and-url`),s=r.entries.find(o=>o.faces.some(n=>t.indexOf(n)!==-1));s.faces=s.faces.filter(o=>t.indexOf(o)===-1),s.faces.length===0&&(r.entries=r.entries.filter(o=>o!==s)),t.forEach(o=>{D.get().getFontFaceSet().delete(o)}),r.entries.length===0&&J.remove(`${e}-and-url`)}};it();P();mi();xa();pi();function Zi(i,t=1){let e=ce.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}cr();rt();st();hr();function Qi(i,t,e){i.label=e,i._sourceOrigin=e;let r=new A({source:i,label:e}),s=()=>{delete t.promiseCache[e],J.has(e)&&J.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(k("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(k("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var UP=".svg",DP="image/svg+xml",tT={extension:{type:g.LoadParser,priority:Yt.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return xe(i,DP)||_e(i,UP)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?LP(i):OP(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function OP(i,t,e,r){let s=await D.get().fetch(i),o=D.get().createImage();o.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await s.text())}`,o.crossOrigin=r,await o.decode();let n=t.data?.width??o.width,a=t.data?.height??o.height,l=t.data?.resolution||Zi(i),c=Math.ceil(n*l),u=Math.ceil(a*l),h=D.get().createCanvas(c,u),d=h.getContext("2d");d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(o,0,0,n*l,a*l);let{parseAsGraphicsContext:f,...m}=t.data??{},_=new ee({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:l,...m});return Qi(_,e,i)}async function LP(i){let e=await(await D.get().fetch(i)).text(),r=new Kt;return r.svg(e),r}it();P();mi();var NP=`(function () {
|
|
1183
|
-
'use strict';
|
|
1184
|
-
|
|
1185
|
-
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
1186
|
-
async function checkImageBitmap() {
|
|
1187
|
-
try {
|
|
1188
|
-
if (typeof createImageBitmap !== "function")
|
|
1189
|
-
return false;
|
|
1190
|
-
const response = await fetch(WHITE_PNG);
|
|
1191
|
-
const imageBlob = await response.blob();
|
|
1192
|
-
const imageBitmap = await createImageBitmap(imageBlob);
|
|
1193
|
-
return imageBitmap.width === 1 && imageBitmap.height === 1;
|
|
1194
|
-
} catch (_e) {
|
|
1195
|
-
return false;
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
void checkImageBitmap().then((result) => {
|
|
1199
|
-
self.postMessage(result);
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
})();
|
|
1203
|
-
`,Ji=null,ts=class{constructor(){Ji||(Ji=URL.createObjectURL(new Blob([NP],{type:"application/javascript"}))),this.worker=new Worker(Ji)}};ts.revokeObjectURL=function(){Ji&&(URL.revokeObjectURL(Ji),Ji=null)};var zP=`(function () {
|
|
1204
|
-
'use strict';
|
|
1205
|
-
|
|
1206
|
-
async function loadImageBitmap(url, alphaMode) {
|
|
1207
|
-
const response = await fetch(url);
|
|
1208
|
-
if (!response.ok) {
|
|
1209
|
-
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
|
|
1210
|
-
}
|
|
1211
|
-
const imageBlob = await response.blob();
|
|
1212
|
-
return alphaMode === "premultiplied-alpha" ? createImageBitmap(imageBlob, { premultiplyAlpha: "none" }) : createImageBitmap(imageBlob);
|
|
1213
|
-
}
|
|
1214
|
-
self.onmessage = async (event) => {
|
|
1215
|
-
try {
|
|
1216
|
-
const imageBitmap = await loadImageBitmap(event.data.data[0], event.data.data[1]);
|
|
1217
|
-
self.postMessage({
|
|
1218
|
-
data: imageBitmap,
|
|
1219
|
-
uuid: event.data.uuid,
|
|
1220
|
-
id: event.data.id
|
|
1221
|
-
}, [imageBitmap]);
|
|
1222
|
-
} catch (e) {
|
|
1223
|
-
self.postMessage({
|
|
1224
|
-
error: e,
|
|
1225
|
-
uuid: event.data.uuid,
|
|
1226
|
-
id: event.data.id
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
};
|
|
1230
|
-
|
|
1231
|
-
})();
|
|
1232
|
-
`,es=null,nn=class{constructor(){es||(es=URL.createObjectURL(new Blob([zP],{type:"application/javascript"}))),this.worker=new Worker(es)}};nn.revokeObjectURL=function(){es&&(URL.revokeObjectURL(es),es=null)};var eT=0,ld,cd=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=>{let{worker:e}=new ts;e.addEventListener("message",r=>{e.terminate(),ts.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){ld===void 0&&(ld=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<ld&&(this._createdWorkers++,t=new nn().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();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[eT]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:eT++,id:r})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>{t?.(new Error("WorkerManager destroyed"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}},ud=new cd;cr();var HP=[".jpeg",".jpg",".png",".webp",".avif"],WP=["image/jpeg","image/png","image/webp","image/avif"];async function VP(i,t){let e=await D.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var fl={name:"loadTextures",id:"texture",extension:{type:g.LoadParser,priority:Yt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return xe(i,WP)||_e(i,HP)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await ud.isImageBitmapSupported()?r=await ud.loadImageBitmap(i,t):r=await VP(i,t):r=await new Promise((o,n)=>{r=D.get().createImage(),r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new ee({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Zi(i),...t.data});return Qi(s,e,i)},unload(i){i.destroy(!0)}};P();Sc();Tc();var XP=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],hd,dd;function YP(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=$P(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function jP(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function $P(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function qP(){let i=[],t=[];for(let e of XP){let r=zr.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;Tr(r)&&(i.push(e),t.includes(r)||t.push(r))}return{validVideoExtensions:i,validVideoMime:t}}var rT={name:"loadVideo",id:"video",extension:{type:g.LoadParser,name:"loadVideo"},test(i){if(!hd||!dd){let{validVideoExtensions:r,validVideoMime:s}=qP();hd=r,dd=s}let t=xe(i,dd),e=_e(i,hd);return t||e},async load(i,t,e){let r={...zr.defaultOptions,resolution:t.data?.resolution||Zi(i),alphaMode:t.data?.alphaMode||await In(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),r.muted===!0&&(s.muted=!0),YP(s,i,r.crossorigin);let n=document.createElement("source"),a;if(r.mime)a=r.mime;else if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let l=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=zr.MIME_TYPES[l]||`video/${l}`}return n.src=i,a&&(n.type=a),new Promise(l=>{let c=async()=>{let u=new zr({...r,resource:s});s.removeEventListener("canplay",c),t.data.preload&&await jP(s),l(Qi(u,e,i))};r.preload&&!r.autoPlay&&s.load(),s.addEventListener("canplay",c),s.appendChild(n)})},unload(i){i.destroy(!0)}};P();pi();P();pi();var pl={extension:{type:g.ResolveParser,name:"resolveTexture"},test:fl.test,parse:i=>({resolution:parseFloat(ce.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var iT={extension:{type:g.ResolveParser,priority:-2,name:"resolveJson"},test:i=>ce.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:pl.parse};pi();bs();Mn();var ml=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ce,this.loader=new K0,this.cache=J,this._backgroundLoader=new ul(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){k("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences),t.loadOptions&&(this.loader.loadOptions={...this.loader.loadOptions,...t.loadOptions})}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=Lr(t),s=jt(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=[],c=()=>{e?.(l.reduce((h,d)=>h+d,0)/a)},u=n.map((h,d)=>{let f=s[h],m=Object.values(f),x=[...new Set(m.flat())].reduce((y,b)=>y+(b.progressSize||1),0);return l.push(0),a+=x,this._mapLoadToResolve(f,y=>{l[d]=y*x,c()}).then(y=>{o[h]=y})});return await Promise.all(u),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return J.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=J.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),J.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=jt(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=jt(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{J.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},Sr=new ml;U.handleByList(g.LoadParser,Sr.loader.parsers).handleByList(g.ResolveParser,Sr.resolver.parsers).handleByList(g.CacheParser,Sr.cache.parsers).handleByList(g.DetectionParser,Sr.detections);U.add(z0,V0,H0,$0,X0,Y0,j0,Z0,Q0,J0,tT,fl,rT,N0,L0,pl,iT);var sT={loader:g.LoadParser,resolver:g.ResolveParser,cache:g.CacheParser,detection:g.DetectionParser};U.handle(g.Asset,i=>{let t=i.ref;Object.entries(sT).filter(([e])=>!!t[e]).forEach(([e,r])=>U.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(sT).filter(e=>!!t[e]).forEach(e=>U.remove(t[e]))});Ht();Fa();tr();pr();rt();$e();Cc();ve();Ss();Nt();pt();U.add(fy,my);P();it();P();ur();var vl=Pl(uT(),1);it();Nr();rt();var rs=class i{constructor(t){if(!t||!t.length)throw new Error("Invalid frames");let[{texture:{width:e,height:r}}]=t;this.width=e,this.height=r,this.frames=t,this.textures=this.frames.map(s=>s.texture),this.totalFrames=this.frames.length,this.duration=this.frames[this.totalFrames-1].end}destroy(){for(let t of this.textures)t.destroy(!0);for(let t of this.frames)t.texture=null;this.frames.length=0,this.textures.length=0,Object.assign(this,{frames:null,textures:null,width:0,height:0,duration:0,totalFrames:0})}static from(t,e){if(!t||t.byteLength===0)throw new Error("Invalid buffer");let r=b=>{let v=null;for(let T of b.frames)v=T.gce??v,"image"in T&&!("gce"in T)&&(T.gce=v)},s=(0,vl.parseGIF)(t);r(s);let o=(0,vl.decompressFrames)(s,!0),n=[],a=s.lsd.width,l=s.lsd.height,c=D.get().createCanvas(a,l),u=c.getContext("2d",{willReadFrequently:!0}),h=D.get().createCanvas(),d=h.getContext("2d"),f=0,m=null,{fps:_=30,...x}=e??{},y=1e3/_;for(let b=0;b<o.length;b++){let{disposalType:v=2,delay:T=y,patch:E,dims:{width:S,height:w,left:G,top:C}}=o[b];h.width=S,h.height=w,d.clearRect(0,0,S,w);let M=d.createImageData(S,w);M.data.set(E),d.putImageData(M,0,0),v===3&&(m=u.getImageData(0,0,a,l)),u.drawImage(h,G,C);let F=u.getImageData(0,0,a,l);v===2?u.clearRect(0,0,a,l):v===3&&u.putImageData(m,0,0);let R=D.get().createCanvas(F.width,F.height);R.getContext("2d").putImageData(F,0,0),n.push({start:f,end:f+T,texture:new A({source:new Dt({resource:R,...x})})}),f+=T}return c.width=c.height=0,h.width=h.height=0,new i(n)}};var hT={extension:g.Asset,detection:{test:async()=>!0,add:async i=>[...i,"gif"],remove:async i=>i.filter(t=>t!=="gif")},loader:{name:"gifLoader",id:"gif",test:i=>Ct.extname(i)===".gif"||i.startsWith("data:image/gif"),load:async(i,t)=>{let r=await(await D.get().fetch(i)).arrayBuffer();return rs.from(r,t?.data)},unload:async i=>{i.destroy()}}};rt();Ss();ci();Or();var dT=class md extends $t{constructor(...t){let e=t[0]instanceof rs?{source:t[0]}:t[0],{source:r,fps:s,loop:o,animationSpeed:n,autoPlay:a,autoUpdate:l,onComplete:c,onFrameChange:u,onLoop:h,...d}=Object.assign({},md.defaultOptions,e);super({texture:A.EMPTY,...d}),this.animationSpeed=1,this.loop=!0,this.duration=0,this.autoPlay=!0,this.dirty=!1,this._currentFrame=0,this._autoUpdate=!1,this._isConnectedToTicker=!1,this._playing=!1,this._currentTime=0,this.onRender=()=>this._updateFrame(),this.texture=r.textures[0],this.duration=r.frames[r.frames.length-1].end,this._source=r,this._playing=!1,this._currentTime=0,this._isConnectedToTicker=!1,Object.assign(this,{fps:s,loop:o,animationSpeed:n,autoPlay:a,autoUpdate:l,onComplete:c,onFrameChange:u,onLoop:h}),this.currentFrame=0,a&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(xt.shared.add(this.update,this,fe.HIGH),this._isConnectedToTicker=!0),!this.loop&&this.currentFrame===this._source.frames.length-1&&(this._currentTime=0))}get progress(){return this._currentTime/this.duration}get playing(){return this._playing}update(t){if(!this._playing)return;let e=this.animationSpeed*t.deltaTime/xt.targetFPMS,r=this._currentTime+e,s=r%this.duration,o=this._source.frames.findIndex(n=>n.start<=s&&n.end>s);r>=this.duration?this.loop?(this._currentTime=s,this._updateFrameIndex(o),this.onLoop?.()):(this._currentTime=this.duration,this._updateFrameIndex(this.totalFrames-1),this.onComplete?.(),this.stop()):(this._currentTime=s,this._updateFrameIndex(o))}_updateFrame(){this.dirty&&(this.texture=this._source.frames[this._currentFrame].texture,this.dirty=!1)}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(xt.shared.add(this.update,this),this._isConnectedToTicker=!0))}get currentFrame(){return this._currentFrame}set currentFrame(t){this._updateFrameIndex(t),this._currentTime=this._source.frames[t].start}get source(){return this._source}_updateFrameIndex(t){if(t<0||t>=this.totalFrames)throw new Error(`Frame index out of range, expecting 0 to ${this.totalFrames}, got ${t}`);this._currentFrame!==t&&(this._currentFrame=t,this.dirty=!0,this.onFrameChange?.(t))}get totalFrames(){return this._source.totalFrames}destroy(t=!1){this.stop(),super.destroy(),t&&this._source.destroy();let e=null;this._source=e,this.onComplete=e,this.onFrameChange=e,this.onLoop=e}clone(){let t=new md({source:this._source,autoUpdate:this._autoUpdate,loop:this.loop,autoPlay:this.autoPlay,animationSpeed:this.animationSpeed,onComplete:this.onComplete,onFrameChange:this.onFrameChange,onLoop:this.onLoop});return t.dirty=!0,t}};dT.defaultOptions={fps:30,loop:!0,animationSpeed:1,autoPlay:!0,autoUpdate:!0,onComplete:null,onFrameChange:null,onLoop:null};var Tl=dT;U.add(hT);var Zr=`in vec2 aPosition;
|
|
1233
|
-
out vec2 vTextureCoord;
|
|
1234
|
-
|
|
1235
|
-
uniform vec4 uInputSize;
|
|
1236
|
-
uniform vec4 uOutputFrame;
|
|
1237
|
-
uniform vec4 uOutputTexture;
|
|
1238
|
-
|
|
1239
|
-
vec4 filterVertexPosition( void )
|
|
1240
|
-
{
|
|
1241
|
-
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
1242
|
-
|
|
1243
|
-
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
1244
|
-
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
1245
|
-
|
|
1246
|
-
return vec4(position, 0.0, 1.0);
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
vec2 filterTextureCoord( void )
|
|
1250
|
-
{
|
|
1251
|
-
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
void main(void)
|
|
1255
|
-
{
|
|
1256
|
-
gl_Position = filterVertexPosition();
|
|
1257
|
-
vTextureCoord = filterTextureCoord();
|
|
1258
|
-
}
|
|
1259
|
-
`;var Qr=`struct GlobalFilterUniforms {
|
|
1260
|
-
uInputSize:vec4<f32>,
|
|
1261
|
-
uInputPixel:vec4<f32>,
|
|
1262
|
-
uInputClamp:vec4<f32>,
|
|
1263
|
-
uOutputFrame:vec4<f32>,
|
|
1264
|
-
uGlobalFrame:vec4<f32>,
|
|
1265
|
-
uOutputTexture:vec4<f32>,
|
|
1266
|
-
};
|
|
1267
|
-
|
|
1268
|
-
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1269
|
-
|
|
1270
|
-
struct VSOutput {
|
|
1271
|
-
@builtin(position) position: vec4<f32>,
|
|
1272
|
-
@location(0) uv : vec2<f32>
|
|
1273
|
-
};
|
|
1274
|
-
|
|
1275
|
-
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1276
|
-
{
|
|
1277
|
-
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1278
|
-
|
|
1279
|
-
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1280
|
-
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1281
|
-
|
|
1282
|
-
return vec4(position, 0.0, 1.0);
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1286
|
-
{
|
|
1287
|
-
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1291
|
-
{
|
|
1292
|
-
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
fn getSize() -> vec2<f32>
|
|
1296
|
-
{
|
|
1297
|
-
return gfu.uGlobalFrame.zw;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
@vertex
|
|
1301
|
-
fn mainVertex(
|
|
1302
|
-
@location(0) aPosition : vec2<f32>,
|
|
1303
|
-
) -> VSOutput {
|
|
1304
|
-
return VSOutput(
|
|
1305
|
-
filterVertexPosition(aPosition),
|
|
1306
|
-
filterTextureCoord(aPosition)
|
|
1307
|
-
);
|
|
1308
|
-
}`;var fT=`
|
|
1309
|
-
in vec2 vTextureCoord;
|
|
1310
|
-
out vec4 finalColor;
|
|
1311
|
-
|
|
1312
|
-
uniform sampler2D uTexture;
|
|
1313
|
-
uniform vec2 uOffset;
|
|
1314
|
-
|
|
1315
|
-
void main(void)
|
|
1316
|
-
{
|
|
1317
|
-
vec4 color = vec4(0.0);
|
|
1318
|
-
|
|
1319
|
-
// Sample top left pixel
|
|
1320
|
-
color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));
|
|
1321
|
-
|
|
1322
|
-
// Sample top right pixel
|
|
1323
|
-
color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));
|
|
1324
|
-
|
|
1325
|
-
// Sample bottom right pixel
|
|
1326
|
-
color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));
|
|
1327
|
-
|
|
1328
|
-
// Sample bottom left pixel
|
|
1329
|
-
color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));
|
|
1330
|
-
|
|
1331
|
-
// Average
|
|
1332
|
-
color *= 0.25;
|
|
1333
|
-
|
|
1334
|
-
finalColor = color;
|
|
1335
|
-
}`;var pT=`struct KawaseBlurUniforms {
|
|
1336
|
-
uOffset:vec2<f32>,
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1340
|
-
@group(0) @binding(2) var uSampler: sampler;
|
|
1341
|
-
@group(1) @binding(0) var<uniform> kawaseBlurUniforms : KawaseBlurUniforms;
|
|
1342
|
-
|
|
1343
|
-
@fragment
|
|
1344
|
-
fn mainFragment(
|
|
1345
|
-
@builtin(position) position: vec4<f32>,
|
|
1346
|
-
@location(0) uv : vec2<f32>
|
|
1347
|
-
) -> @location(0) vec4<f32> {
|
|
1348
|
-
let uOffset = kawaseBlurUniforms.uOffset;
|
|
1349
|
-
var color: vec4<f32> = vec4<f32>(0.0);
|
|
1350
|
-
|
|
1351
|
-
// Sample top left pixel
|
|
1352
|
-
color += textureSample(uTexture, uSampler, vec2<f32>(uv.x - uOffset.x, uv.y + uOffset.y));
|
|
1353
|
-
// Sample top right pixel
|
|
1354
|
-
color += textureSample(uTexture, uSampler, vec2<f32>(uv.x + uOffset.x, uv.y + uOffset.y));
|
|
1355
|
-
// Sample bottom right pixel
|
|
1356
|
-
color += textureSample(uTexture, uSampler, vec2<f32>(uv.x + uOffset.x, uv.y - uOffset.y));
|
|
1357
|
-
// Sample bottom left pixel
|
|
1358
|
-
color += textureSample(uTexture, uSampler, vec2<f32>(uv.x - uOffset.x, uv.y - uOffset.y));
|
|
1359
|
-
// Average
|
|
1360
|
-
color *= 0.25;
|
|
1361
|
-
|
|
1362
|
-
return color;
|
|
1363
|
-
}`;var mT=`
|
|
1364
|
-
precision highp float;
|
|
1365
|
-
in vec2 vTextureCoord;
|
|
1366
|
-
out vec4 finalColor;
|
|
1367
|
-
|
|
1368
|
-
uniform sampler2D uTexture;
|
|
1369
|
-
uniform vec2 uOffset;
|
|
1370
|
-
|
|
1371
|
-
uniform vec4 uInputClamp;
|
|
1372
|
-
|
|
1373
|
-
void main(void)
|
|
1374
|
-
{
|
|
1375
|
-
vec4 color = vec4(0.0);
|
|
1376
|
-
|
|
1377
|
-
// Sample top left pixel
|
|
1378
|
-
color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));
|
|
1379
|
-
|
|
1380
|
-
// Sample top right pixel
|
|
1381
|
-
color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));
|
|
1382
|
-
|
|
1383
|
-
// Sample bottom right pixel
|
|
1384
|
-
color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));
|
|
1385
|
-
|
|
1386
|
-
// Sample bottom left pixel
|
|
1387
|
-
color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));
|
|
1388
|
-
|
|
1389
|
-
// Average
|
|
1390
|
-
color *= 0.25;
|
|
1391
|
-
|
|
1392
|
-
finalColor = color;
|
|
1393
|
-
}
|
|
1394
|
-
`;var gT=`struct KawaseBlurUniforms {
|
|
1395
|
-
uOffset:vec2<f32>,
|
|
1396
|
-
};
|
|
1397
|
-
|
|
1398
|
-
struct GlobalFilterUniforms {
|
|
1399
|
-
uInputSize:vec4<f32>,
|
|
1400
|
-
uInputPixel:vec4<f32>,
|
|
1401
|
-
uInputClamp:vec4<f32>,
|
|
1402
|
-
uOutputFrame:vec4<f32>,
|
|
1403
|
-
uGlobalFrame:vec4<f32>,
|
|
1404
|
-
uOutputTexture:vec4<f32>,
|
|
1405
|
-
};
|
|
1406
|
-
|
|
1407
|
-
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1408
|
-
|
|
1409
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1410
|
-
@group(0) @binding(2) var uSampler: sampler;
|
|
1411
|
-
@group(1) @binding(0) var<uniform> kawaseBlurUniforms : KawaseBlurUniforms;
|
|
1412
|
-
|
|
1413
|
-
@fragment
|
|
1414
|
-
fn mainFragment(
|
|
1415
|
-
@builtin(position) position: vec4<f32>,
|
|
1416
|
-
@location(0) uv : vec2<f32>
|
|
1417
|
-
) -> @location(0) vec4<f32> {
|
|
1418
|
-
let uOffset = kawaseBlurUniforms.uOffset;
|
|
1419
|
-
var color: vec4<f32> = vec4(0.0);
|
|
1420
|
-
|
|
1421
|
-
// Sample top left pixel
|
|
1422
|
-
color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x - uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));
|
|
1423
|
-
// Sample top right pixel
|
|
1424
|
-
color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x + uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));
|
|
1425
|
-
// Sample bottom right pixel
|
|
1426
|
-
color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x + uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));
|
|
1427
|
-
// Sample bottom left pixel
|
|
1428
|
-
color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x - uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));
|
|
1429
|
-
// Average
|
|
1430
|
-
color *= 0.25;
|
|
1431
|
-
|
|
1432
|
-
return color;
|
|
1433
|
-
}`;var PC=Object.defineProperty,CC=(i,t,e)=>t in i?PC(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jr=(i,t,e)=>(CC(i,typeof t!="symbol"?t+"":t,e),e),xT=class _T extends ge{constructor(...t){let e=t[0]??{};(typeof e=="number"||Array.isArray(e))&&(O("6.0.0","KawaseBlurFilter constructor params are now options object. See params: { strength, quality, clamp, pixelSize }"),e={strength:e},t[1]!==void 0&&(e.quality=t[1]),t[2]!==void 0&&(e.clamp=t[2])),e={..._T.DEFAULT_OPTIONS,...e};let r=Tt.from({vertex:{source:Qr,entryPoint:"mainVertex"},fragment:{source:e?.clamp?gT:pT,entryPoint:"mainFragment"}}),s=vt.from({vertex:Zr,fragment:e?.clamp?mT:fT,name:"kawase-blur-filter"});super({gpuProgram:r,glProgram:s,resources:{kawaseBlurUniforms:{uOffset:{value:new Float32Array(2),type:"vec2<f32>"}}}}),Jr(this,"uniforms"),Jr(this,"_pixelSize",{x:0,y:0}),Jr(this,"_clamp"),Jr(this,"_kernels",[]),Jr(this,"_blur"),Jr(this,"_quality"),this.uniforms=this.resources.kawaseBlurUniforms.uniforms,this.pixelSize=e.pixelSize??{x:1,y:1},Array.isArray(e.strength)?this.kernels=e.strength:typeof e.strength=="number"&&(this._blur=e.strength,this.quality=e.quality??3),this._clamp=!!e.clamp}apply(t,e,r,s){let o=this.pixelSizeX/e.source.width,n=this.pixelSizeY/e.source.height,a;if(this._quality===1||this._blur===0)a=this._kernels[0]+.5,this.uniforms.uOffset[0]=a*o,this.uniforms.uOffset[1]=a*n,t.applyFilter(this,e,r,s);else{let l=ot.getSameSizeTexture(e),c=e,u=l,h,d=this._quality-1;for(let f=0;f<d;f++)a=this._kernels[f]+.5,this.uniforms.uOffset[0]=a*o,this.uniforms.uOffset[1]=a*n,t.applyFilter(this,c,u,!0),h=c,c=u,u=h;a=this._kernels[d]+.5,this.uniforms.uOffset[0]=a*o,this.uniforms.uOffset[1]=a*n,t.applyFilter(this,c,r,s),ot.returnTexture(l)}}get strength(){return this._blur}set strength(t){this._blur=t,this._generateKernels()}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get pixelSize(){return this._pixelSize}set pixelSize(t){if(typeof t=="number"){this.pixelSizeX=this.pixelSizeY=t;return}if(Array.isArray(t)){this.pixelSizeX=t[0],this.pixelSizeY=t[1];return}this._pixelSize=t}get pixelSizeX(){return this.pixelSize.x}set pixelSizeX(t){this.pixelSize.x=t}get pixelSizeY(){return this.pixelSize.y}set pixelSizeY(t){this.pixelSize.y=t}get clamp(){return this._clamp}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce((t,e)=>t+e+.5,0))}_generateKernels(){let t=this._blur,e=this._quality,r=[t];if(t>0){let s=t,o=t/e;for(let n=1;n<e;n++)s-=o,r.push(s)}this._kernels=r,this._updatePadding()}};Jr(xT,"DEFAULT_OPTIONS",{strength:4,quality:3,clamp:!1,pixelSize:{x:1,y:1}});var yT=xT;var bT=`precision highp float;
|
|
1434
|
-
in vec2 vTextureCoord;
|
|
1435
|
-
out vec4 finalColor;
|
|
1436
|
-
|
|
1437
|
-
uniform sampler2D uTexture;
|
|
1438
|
-
uniform vec2 uDimensions;
|
|
1439
|
-
uniform vec2 uCenter;
|
|
1440
|
-
uniform float uRadius;
|
|
1441
|
-
uniform float uStrength;
|
|
1442
|
-
|
|
1443
|
-
uniform vec4 uInputSize;
|
|
1444
|
-
uniform vec4 uInputClamp;
|
|
1445
|
-
|
|
1446
|
-
void main()
|
|
1447
|
-
{
|
|
1448
|
-
vec2 coord = vTextureCoord * uInputSize.xy;
|
|
1449
|
-
coord -= uCenter * uDimensions.xy;
|
|
1450
|
-
float distance = length(coord);
|
|
1451
|
-
|
|
1452
|
-
if (distance < uRadius) {
|
|
1453
|
-
float percent = distance / uRadius;
|
|
1454
|
-
if (uStrength > 0.0) {
|
|
1455
|
-
coord *= mix(1.0, smoothstep(0.0, uRadius / distance, percent), uStrength * 0.75);
|
|
1456
|
-
} else {
|
|
1457
|
-
coord *= mix(1.0, pow(percent, 1.0 + uStrength * 0.75) * uRadius / distance, 1.0 - percent);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
coord += uCenter * uDimensions.xy;
|
|
1462
|
-
coord /= uInputSize.xy;
|
|
1463
|
-
vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);
|
|
1464
|
-
vec4 color = texture(uTexture, clampedCoord);
|
|
1465
|
-
|
|
1466
|
-
if (coord != clampedCoord) {
|
|
1467
|
-
color *= max(0.0, 1.0 - length(coord - clampedCoord));
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
finalColor = color;
|
|
1471
|
-
}
|
|
1472
|
-
`;var vT=`struct BulgePinchUniforms {
|
|
1473
|
-
uDimensions: vec2<f32>,
|
|
1474
|
-
uCenter: vec2<f32>,
|
|
1475
|
-
uRadius: f32,
|
|
1476
|
-
uStrength: f32,
|
|
1477
|
-
};
|
|
1478
|
-
|
|
1479
|
-
struct GlobalFilterUniforms {
|
|
1480
|
-
uInputSize:vec4<f32>,
|
|
1481
|
-
uInputPixel:vec4<f32>,
|
|
1482
|
-
uInputClamp:vec4<f32>,
|
|
1483
|
-
uOutputFrame:vec4<f32>,
|
|
1484
|
-
uGlobalFrame:vec4<f32>,
|
|
1485
|
-
uOutputTexture:vec4<f32>,
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1489
|
-
|
|
1490
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1491
|
-
@group(0) @binding(2) var uSampler: sampler;
|
|
1492
|
-
@group(1) @binding(0) var<uniform> bulgePinchUniforms : BulgePinchUniforms;
|
|
1493
|
-
|
|
1494
|
-
@fragment
|
|
1495
|
-
fn mainFragment(
|
|
1496
|
-
@builtin(position) position: vec4<f32>,
|
|
1497
|
-
@location(0) uv : vec2<f32>
|
|
1498
|
-
) -> @location(0) vec4<f32> {
|
|
1499
|
-
let dimensions: vec2<f32> = bulgePinchUniforms.uDimensions;
|
|
1500
|
-
let center: vec2<f32> = bulgePinchUniforms.uCenter;
|
|
1501
|
-
let radius: f32 = bulgePinchUniforms.uRadius;
|
|
1502
|
-
let strength: f32 = bulgePinchUniforms.uStrength;
|
|
1503
|
-
var coord: vec2<f32> = (uv * gfu.uInputSize.xy) - center * dimensions.xy;
|
|
1504
|
-
|
|
1505
|
-
let distance: f32 = length(coord);
|
|
1506
|
-
|
|
1507
|
-
if (distance < radius) {
|
|
1508
|
-
let percent: f32 = distance / radius;
|
|
1509
|
-
if (strength > 0.0) {
|
|
1510
|
-
coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);
|
|
1511
|
-
} else {
|
|
1512
|
-
coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
coord += (center * dimensions.xy);
|
|
1516
|
-
coord /= gfu.uInputSize.xy;
|
|
1517
|
-
|
|
1518
|
-
let clampedCoord: vec2<f32> = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);
|
|
1519
|
-
var color: vec4<f32> = textureSample(uTexture, uSampler, clampedCoord);
|
|
1520
|
-
if (coord.x != clampedCoord.x && coord.y != clampedCoord.y) {
|
|
1521
|
-
color *= max(0.0, 1.0 - length(coord - clampedCoord));
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
return color;
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
fn compareVec2(x: vec2<f32>, y: vec2<f32>) -> bool
|
|
1528
|
-
{
|
|
1529
|
-
if (x.x == y.x && x.y == y.y)
|
|
1530
|
-
{
|
|
1531
|
-
return true;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
return false;
|
|
1535
|
-
}`;var EC=Object.defineProperty,AC=(i,t,e)=>t in i?EC(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,TT=(i,t,e)=>(AC(i,typeof t!="symbol"?t+"":t,e),e),ST=class wT extends ge{constructor(t){t={...wT.DEFAULT_OPTIONS,...t};let e=Tt.from({vertex:{source:Qr,entryPoint:"mainVertex"},fragment:{source:vT,entryPoint:"mainFragment"}}),r=vt.from({vertex:Zr,fragment:bT,name:"bulge-pinch-filter"});super({gpuProgram:e,glProgram:r,resources:{bulgePinchUniforms:{uDimensions:{value:[0,0],type:"vec2<f32>"},uCenter:{value:t.center,type:"vec2<f32>"},uRadius:{value:t.radius,type:"f32"},uStrength:{value:t.strength,type:"f32"}}}}),TT(this,"uniforms"),this.uniforms=this.resources.bulgePinchUniforms.uniforms,Object.assign(this,t)}apply(t,e,r,s){this.uniforms.uDimensions[0]=e.frame.width,this.uniforms.uDimensions[1]=e.frame.height,t.applyFilter(this,e,r,s)}get center(){return this.uniforms.uCenter}set center(t){typeof t=="number"&&(t={x:t,y:t}),Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uCenter=t}get centerX(){return this.uniforms.uCenter.x}set centerX(t){this.uniforms.uCenter.x=t}get centerY(){return this.uniforms.uCenter.y}set centerY(t){this.uniforms.uCenter.y=t}get radius(){return this.uniforms.uRadius}set radius(t){this.uniforms.uRadius=t}get strength(){return this.uniforms.uStrength}set strength(t){this.uniforms.uStrength=t}};TT(ST,"DEFAULT_OPTIONS",{center:{x:.5,y:.5},radius:100,strength:1});var gd=ST;var PT=`precision highp float;
|
|
1536
|
-
in vec2 vTextureCoord;
|
|
1537
|
-
out vec4 finalColor;
|
|
1538
|
-
|
|
1539
|
-
uniform sampler2D uTexture;
|
|
1540
|
-
uniform float uAlpha;
|
|
1541
|
-
uniform vec3 uColor;
|
|
1542
|
-
uniform vec2 uOffset;
|
|
1543
|
-
|
|
1544
|
-
uniform vec4 uInputSize;
|
|
1545
|
-
|
|
1546
|
-
void main(void){
|
|
1547
|
-
vec4 sample = texture(uTexture, vTextureCoord - uOffset * uInputSize.zw);
|
|
1548
|
-
|
|
1549
|
-
// Premultiply alpha
|
|
1550
|
-
sample.rgb = uColor.rgb * sample.a;
|
|
1551
|
-
|
|
1552
|
-
// alpha user alpha
|
|
1553
|
-
sample *= uAlpha;
|
|
1554
|
-
|
|
1555
|
-
finalColor = sample;
|
|
1556
|
-
}`;var CT=`struct DropShadowUniforms {
|
|
1557
|
-
uAlpha: f32,
|
|
1558
|
-
uColor: vec3<f32>,
|
|
1559
|
-
uOffset: vec2<f32>,
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
struct GlobalFilterUniforms {
|
|
1563
|
-
uInputSize:vec4<f32>,
|
|
1564
|
-
uInputPixel:vec4<f32>,
|
|
1565
|
-
uInputClamp:vec4<f32>,
|
|
1566
|
-
uOutputFrame:vec4<f32>,
|
|
1567
|
-
uGlobalFrame:vec4<f32>,
|
|
1568
|
-
uOutputTexture:vec4<f32>,
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1572
|
-
|
|
1573
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1574
|
-
@group(0) @binding(2) var uSampler: sampler;
|
|
1575
|
-
@group(1) @binding(0) var<uniform> dropShadowUniforms : DropShadowUniforms;
|
|
1576
|
-
|
|
1577
|
-
@fragment
|
|
1578
|
-
fn mainFragment(
|
|
1579
|
-
@builtin(position) position: vec4<f32>,
|
|
1580
|
-
@location(0) uv : vec2<f32>
|
|
1581
|
-
) -> @location(0) vec4<f32> {
|
|
1582
|
-
var color: vec4<f32> = textureSample(uTexture, uSampler, uv - dropShadowUniforms.uOffset * gfu.uInputSize.zw);
|
|
1583
|
-
|
|
1584
|
-
// Premultiply alpha
|
|
1585
|
-
color = vec4<f32>(vec3<f32>(dropShadowUniforms.uColor.rgb * color.a), color.a);
|
|
1586
|
-
// alpha user alpha
|
|
1587
|
-
color *= dropShadowUniforms.uAlpha;
|
|
1588
|
-
|
|
1589
|
-
return color;
|
|
1590
|
-
}`;var MC=Object.defineProperty,BC=(i,t,e)=>t in i?MC(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,is=(i,t,e)=>(BC(i,typeof t!="symbol"?t+"":t,e),e),ET=class AT extends ge{constructor(t){t={...AT.DEFAULT_OPTIONS,...t};let e=Tt.from({vertex:{source:Qr,entryPoint:"mainVertex"},fragment:{source:CT,entryPoint:"mainFragment"}}),r=vt.from({vertex:Zr,fragment:PT,name:"drop-shadow-filter"});super({gpuProgram:e,glProgram:r,resources:{dropShadowUniforms:{uAlpha:{value:t.alpha,type:"f32"},uColor:{value:new Float32Array(3),type:"vec3<f32>"},uOffset:{value:t.offset,type:"vec2<f32>"}}},resolution:t.resolution}),is(this,"uniforms"),is(this,"shadowOnly",!1),is(this,"_color"),is(this,"_blurFilter"),is(this,"_basePass"),this.uniforms=this.resources.dropShadowUniforms.uniforms,this._color=new $,this.color=t.color??0,this._blurFilter=new yT({strength:t.kernels??t.blur,quality:t.kernels?void 0:t.quality}),this._basePass=new ge({gpuProgram:Tt.from({vertex:{source:Qr,entryPoint:"mainVertex"},fragment:{source:`
|
|
1591
|
-
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1592
|
-
@group(0) @binding(2) var uSampler: sampler;
|
|
1593
|
-
@fragment
|
|
1594
|
-
fn mainFragment(
|
|
1595
|
-
@builtin(position) position: vec4<f32>,
|
|
1596
|
-
@location(0) uv : vec2<f32>
|
|
1597
|
-
) -> @location(0) vec4<f32> {
|
|
1598
|
-
return textureSample(uTexture, uSampler, uv);
|
|
1599
|
-
}
|
|
1600
|
-
`,entryPoint:"mainFragment"}}),glProgram:vt.from({vertex:Zr,fragment:`
|
|
1601
|
-
in vec2 vTextureCoord;
|
|
1602
|
-
out vec4 finalColor;
|
|
1603
|
-
uniform sampler2D uTexture;
|
|
1604
|
-
|
|
1605
|
-
void main(void){
|
|
1606
|
-
finalColor = texture(uTexture, vTextureCoord);
|
|
1607
|
-
}
|
|
1608
|
-
`,name:"drop-shadow-filter"}),resources:{}}),Object.assign(this,t)}apply(t,e,r,s){let o=ot.getSameSizeTexture(e);t.applyFilter(this,e,o,!0),this._blurFilter.apply(t,o,r,s),this.shadowOnly||t.applyFilter(this._basePass,e,r,!1),ot.returnTexture(o)}get offset(){return this.uniforms.uOffset}set offset(t){this.uniforms.uOffset=t,this._updatePadding()}get offsetX(){return this.offset.x}set offsetX(t){this.offset.x=t,this._updatePadding()}get offsetY(){return this.offset.y}set offsetY(t){this.offset.y=t,this._updatePadding()}get color(){return this._color.value}set color(t){this._color.setValue(t);let[e,r,s]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=s}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get blur(){return this._blurFilter.strength}set blur(t){this._blurFilter.strength=t,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(t){this._blurFilter.quality=t,this._updatePadding()}get kernels(){return this._blurFilter.kernels}set kernels(t){this._blurFilter.kernels=t}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(t){typeof t=="number"&&(t={x:t,y:t}),Array.isArray(t)&&(t={x:t[0],y:t[1]}),this._blurFilter.pixelSize=t}get pixelSizeX(){return this._blurFilter.pixelSizeX}set pixelSizeX(t){this._blurFilter.pixelSizeX=t}get pixelSizeY(){return this._blurFilter.pixelSizeY}set pixelSizeY(t){this._blurFilter.pixelSizeY=t}_updatePadding(){let t=Math.max(Math.abs(this.offsetX),Math.abs(this.offsetY));this.padding=t+this.blur*2+this.quality*4}};is(ET,"DEFAULT_OPTIONS",{offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:void 0,blur:2,quality:3,pixelSize:{x:1,y:1},resolution:1});var xd=ET;window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{let i=(v,T)=>(v%T+T)%T,t=()=>window.innerWidth<768,e=()=>window.innerWidth>=768&&window.innerWidth<1024,r=()=>t()?{maxWidth:250,maxHeight:250}:e()?{maxWidth:300,maxHeight:300}:{maxWidth:400,maxHeight:400},s=()=>t()?700:e()?600:500,o=(v,T)=>{let E=Math.max(v,T);return t()?E*.7:e()?E*.8:E*1},n=()=>t()?140:e()?150:166,a=()=>t()?.85:e()?.75:.7,l={TILE_SCALE:2,FRICTION:.92,NEAR_BORDER:60,PARALLAX_MIN:.4,PARALLAX_MAX:1.5,REDUCED_MOTION:window.matchMedia("(prefers-reduced-motion: reduce)").matches};(async function(){let T=document.querySelector(".infinite_page_wrap");if(!T)return console.warn("Pas de .infinite_page_wrap sur la page.");let E=gsap.utils.toArray(".infinite_page_image"),S=!1,{app:w,world:G,bulgePinchFilter:C,size:M}=await c(T),F=new dt;w.stage.addChild(F);let{tileW:R,tileH:W}=h(M,l.TILE_SCALE);await Sr.load([...E.map(N=>N.src),"https://cdn.prod.website-files.com/68f63039024ee46f705d5004/6916fbba326a4123b4082cea_btn-ressource.svg"]);let Ft=f(E,G,R,W,F,w),I={offset:{x:0,y:0},vel:{x:0,y:0}},L=_(),wt=null,H=x(w.canvas,L,{onDelta(N,At){S&&(I.offset.x-=N,I.offset.y-=At,I.vel.x=-N,I.vel.y=-At)},onPress(){S&&(wt=setTimeout(()=>{gsap.to(C,{strength:.25,duration:.4,ease:"cubic.out"})},150))},onRelease(){wt&&(clearTimeout(wt),wt=null),gsap.to(C,{strength:0,duration:.4,ease:"cubic.out"})}});await u(Ft,w,()=>{S=!0}),w.ticker.add(()=>{S&&(!H.isDragging&&!l.REDUCED_MOTION&&(I.offset.x+=I.vel.x,I.offset.y+=I.vel.y,I.vel.x*=l.FRICTION,I.vel.y*=l.FRICTION,Math.abs(I.vel.x)<.01&&(I.vel.x=0),Math.abs(I.vel.y)<.01&&(I.vel.y=0)),m(Ft,I,R,W))});let yt;window.addEventListener("resize",()=>{clearTimeout(yt),yt=setTimeout(()=>{let N={w:window.innerWidth,h:window.innerHeight};w.renderer.resize(N.w,N.h);let At=h(N,l.TILE_SCALE);R=At.tileW,W=At.tileH,G.x=-N.w/2,G.y=-N.h/2,C.radius=o(N.w,N.h);let mt=r();Ft.forEach(Pt=>{let ht=Pt.sprite.texture,Qt=mt.maxWidth/ht.width,Ee=mt.maxHeight/ht.height,ne=Math.min(Qt,Ee,1);Pt.baseScale=ne,Pt.sprite.scale.set(ne)})},150)})})();async function c(v){let T=window.innerWidth,E=window.innerHeight,S=new ll;await S.init({backgroundAlpha:1,background:"#fff",antialias:!0,resolution:window.devicePixelRatio||1,autoDensity:!0,width:T,height:E}),v.appendChild(S.canvas);let w=new dt;S.stage.addChild(w);let G=o(T,E),C=new gd({center:{x:.5,y:.5},radius:G,strength:0});return S.stage.filters=[C],w.x=-T/2,w.y=-E/2,{app:S,world:w,bulgePinchFilter:C,size:{w:T,h:E}}}async function u(v,T,E){let S=T.screen.width,w=T.screen.height,G=S/2+Math.abs(T.stage.children[0].x),C=w/2+Math.abs(T.stage.children[0].y),M=l.REDUCED_MOTION?.3:1,F=30,R=S*.9,W=w*.9,q=gsap.timeline();v.forEach((L,wt)=>{let H=L.sprite,yt=H.texture,N=R/yt.width,At=W/yt.height,mt=Math.min(N,At,L.baseScale);H.scale.set(mt),H.eventMode="none",H.x=G,H.y=C+F,H.alpha=0,q.to(H,{y:C,alpha:1,duration:M,ease:"power2.out"},wt*0),L.introScale=mt}),await q.then(),await new Promise(L=>setTimeout(L,l.REDUCED_MOTION?100:300));let Ft=gsap.timeline(),I=l.REDUCED_MOTION?.5:.8;v.forEach((L,wt)=>{let H=L.sprite,yt=L.logicalX,N=L.logicalY;Ft.to(H,{x:yt,y:N,duration:I,ease:"power3.inOut"},wt*(l.REDUCED_MOTION?.02:.1)),Ft.to(H.scale,{x:L.baseScale,y:L.baseScale,duration:I,ease:"power3.inOut"},wt*(l.REDUCED_MOTION?.02:.1))}),await Ft.then(),v.forEach(L=>{L.sprite.eventMode="static"}),E()}function h(v,T){return{tileW:Math.max(1,Math.floor(v.w*T)),tileH:Math.max(1,Math.floor(v.h*T))}}function d(v,T,E,S){T.removeChildren(),gsap.to(".service_title_component",{opacity:0,duration:.3,ease:"power2.out"});let w=E.screen.width,G=E.screen.height,C=new $t(A.WHITE);C.width=w,C.height=G,C.tint=16777215,C.alpha=0,C.eventMode="static",C.cursor="default",T.addChild(C);let M=A.from(v.src),R=v.src.toLowerCase().endsWith(".gif")?new Tl({source:M,autoplay:!0,loop:!0}):new $t(M);R.anchor.set(.5);let W=w/2,q=G/2,Ft=a(),I=w*Ft,L=G*Ft,wt=I/M.width,H=L/M.height,yt=Math.min(wt,H,1);if(S){let Pt=S.getGlobalPosition();R.x=Pt.x,R.y=Pt.y,R.scale.set(S.scale.x),R.alpha=1}else R.x=W,R.y=q,R.scale.set(.5),R.alpha=0;T.addChild(R),R.zIndex=1;let N=null,At=v.getAttribute("ressource-link");if(At){let Pt=Sr.get("https://cdn.prod.website-files.com/68f63039024ee46f705d5004/6916fbba326a4123b4082cea_btn-ressource.svg");Pt?.source&&(Pt.source.scaleMode="linear"),N=new $t(Pt),N.anchor.set(1,0),N.eventMode="static",N.cursor="pointer",N.alpha=0,N.zIndex=10;let ht=new xd({offset:{x:0,y:1},blur:15,alpha:.15,color:0,quality:5,resolution:window.devicePixelRatio||1});N.filters=[ht];let Qt=n();if(N.width>Qt){let ne=Qt/N.width;N.scale.set(ne)}(()=>{let ne=R.x+R.width/2,nr=R.y-R.height/2;N.x=ne,N.y=nr-N.height-10})(),N.on("click",ne=>{ne.stopPropagation(),window.open(At,"_blank")}),T.addChild(N)}T.sortableChildren=!0,S&&gsap.set(S,{alpha:0}),gsap.to(C,{alpha:.75,duration:.4,ease:"power2.out"}),gsap.to(R,{x:W,y:q,duration:.6,ease:"power3.out",onUpdate:()=>{if(N){let Pt=R.x+R.width/2,ht=R.y-R.height/2;N.x=Pt,N.y=ht-N.height-10}}}),gsap.to(R.scale,{x:yt,y:yt,duration:.6,ease:"power3.out",onUpdate:()=>{if(N){let Pt=R.x+R.width/2,ht=R.y-R.height/2;N.x=Pt,N.y=ht-N.height-10}}}),S||gsap.to(R,{alpha:1,duration:.4,ease:"power2.out"}),N&&gsap.to(N,{alpha:1,duration:.4,delay:.3,ease:"power2.out"}),C.on("pointerdown",()=>mt()),R.eventMode="static",R.cursor="pointer",R.on("pointerdown",()=>mt());function mt(){if(N&&gsap.to(N,{alpha:0,duration:.3,ease:"power2.in"}),gsap.to(C,{alpha:0,duration:.4,ease:"power2.in"}),S){let Pt=S.getGlobalPosition();gsap.to(R,{x:Pt.x,y:Pt.y,duration:.5,ease:"power3.in"}),gsap.to(R.scale,{x:S.scale.x,y:S.scale.y,duration:.5,ease:"power3.in",onComplete:()=>{gsap.set(S,{alpha:1}),T.removeChildren(),gsap.to(".service_title_component",{opacity:1,duration:.3,ease:"power2.out"})}})}else gsap.to(R,{alpha:0,duration:.3,ease:"power2.in"}),gsap.to(R.scale,{x:.5,y:.5,duration:.3,ease:"power2.in",onComplete:()=>{T.removeChildren(),gsap.to(".service_title_component",{opacity:1,duration:.3,ease:"power2.out"})}})}}function f(v,T,E,S,w,G){let C=v.length||1,M=s(),F=E*S,R=Math.max(C,Math.ceil(F/(M*M))),W=[];for(let N=0;N<R;N++)W.push(v[N%C]);let q=W.length,Ft=E/S,I=Math.ceil(Math.sqrt(q*Ft)),L=Math.ceil(q/I),wt=E/I,H=S/L,yt=.6;return W.map((N,At)=>{let mt=A.from(N.src);mt?.source&&(mt.source.scaleMode="linear");let ht=N.src.toLowerCase().endsWith(".gif")?new Tl({source:mt,autoplay:!0,loop:!0}):new $t(mt);ht.anchor.set(.5),ht.eventMode="static",ht.cursor="pointer";let Qt=0,Ee={x:0,y:0},ne=8;ht.on("pointerdown",ue=>{ue.stopPropagation(),Qt=Date.now(),Ee.x=ue.global.x,Ee.y=ue.global.y}),ht.on("pointerup",ue=>{ue.stopPropagation();let Ve=Date.now()-Qt,_d=ue.global.x-Ee.x,yd=ue.global.y-Ee.y;Math.sqrt(_d*_d+yd*yd)<ne&&Ve<200&&d(N,w,G,ht),Qt=0}),T.addChild(ht);let nr=At%I,ti=Math.floor(At/I),ss=wt*nr+wt/2,Ne=H*ti+H/2,ze=(Math.random()-.5)*wt*yt,He=(Math.random()-.5)*H*yt,We=ss+ze,Sl=Ne+He,an=y(N.factor??b(At,0,q-1,l.PARALLAX_MIN,l.PARALLAX_MAX),l.PARALLAX_MIN,l.PARALLAX_MAX),Er=N.getAttribute("ressource-max-width"),os=N.getAttribute("ressource-max-height"),ns=r();if(Er||os)if(Er&&!os){let Ve=Math.min(parseFloat(Er),ns.maxWidth)/mt.width;ht.scale.set(Math.min(Ve,1))}else if(os&&!Er){let Ve=Math.min(parseFloat(os),ns.maxHeight)/mt.height;ht.scale.set(Math.min(Ve,1))}else{let Ve=Math.min(parseFloat(Er),ns.maxWidth)/mt.width;ht.scale.set(Math.min(Ve,1))}else{let ue=ns.maxWidth/mt.width,Ve=ns.maxHeight/mt.height;ht.scale.set(Math.min(ue,Ve,1))}let MT=ht.scale.x;return{sprite:ht,logicalX:We,logicalY:Sl,factor:an,baseScale:MT}})}function m(v,T,E,S){let w=Math.hypot(T.vel.x,T.vel.y),G=Math.min(1,w/40);for(let C of v){let M=T.offset.x*C.factor,F=T.offset.y*C.factor,R=i(C.logicalX-M,E),W=i(C.logicalY-F,S);C.sprite.x=R,C.sprite.y=W;let q=1+.02*G*(1-C.factor);C.sprite.scale.set(C.baseScale*q)}}function _(){let v=document.createElement("div");return Object.assign(v.style,{position:"fixed",top:"-9999px",left:"-9999px",width:"1px",height:"1px",pointerEvents:"none"}),document.body.appendChild(v),v}function x(v,T,{onDelta:E,onPress:S,onRelease:w}){v.style.cursor="grab",v.style.touchAction="none";let G={x:0,y:0},C=Draggable.create(T,{type:"x,y",trigger:v,inertia:!l.REDUCED_MOTION,dragResistance:0,edgeResistance:0,throwResistance:0,onPress(){G.x=0,G.y=0,v.style.cursor="grabbing",S?.()},onDrag(){let M=this.x-G.x,F=this.y-G.y;E?.(M,F),G.x=this.x,G.y=this.y},onThrowUpdate(){let M=this.x-G.x,F=this.y-G.y;E?.(M,F),G.x=this.x,G.y=this.y},onThrowComplete(){gsap.set(T,{x:0,y:0}),G.x=0,G.y=0},onRelease(){v.style.cursor="grab",w?.(),(l.REDUCED_MOTION||!this.tween)&&(gsap.set(T,{x:0,y:0}),G.x=0,G.y=0)}})[0];return Object.defineProperty(C,"isDragging",{get:()=>C.isPressed||C.isThrowing}),C}function y(v,T,E){return Math.max(T,Math.min(E,v))}function b(v,T,E,S,w){return T===E?S:S+(w-S)*((v-T)/(E-T))}});})();
|
|
1609
|
-
/*! Bundled license information:
|
|
1610
|
-
|
|
1611
|
-
tiny-lru/dist/tiny-lru.js:
|
|
1612
|
-
(**
|
|
1613
|
-
* tiny-lru
|
|
1614
|
-
*
|
|
1615
|
-
* @copyright 2025 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
1616
|
-
* @license BSD-3-Clause
|
|
1617
|
-
* @version 11.4.5
|
|
1618
|
-
*)
|
|
1619
|
-
*/
|
|
1
|
+
(()=>{console.log("Index Script Loaded");console.log("test");})();
|