107 lines
1.1 MiB
JavaScript
107 lines
1.1 MiB
JavaScript
|
|
import{i as bE,B as Z_,F as bd,A as YT,a as Il,C as HT,P as X,R as we,S as bt,T as Ft,b as Ss,s as $_,c as Tg,M as Ne,d as mg,e as gi,G as Tl,f as jT,g as WT,h as zT,E as kT,j as KT,k as XT,l as qT,m as QT,p as JT,n as ZT,o as ml,q as $T,r as tm,t as Kr}from"./vendor-CZE3qWoT.js";const cr=class cr{static log(...t){this.LOG_DEBUG&&console.log(this.logPrefix(),...t)}static warn(...t){this.LOG_WARN&&console.warn(this.logPrefix(),...t)}static error(...t){this.LOG_ERROR&&console.error(this.logPrefix(),...t)}static events(...t){this.LOG_EVENTS&&console.log(this.logPrefix(),...t)}static packets(...t){this.LOG_PACKETS&&console.log(this.logPrefix(),...t)}static logPrefix(){return"[Nitro]"}};cr.LOG_DEBUG=!1,cr.LOG_WARN=!1,cr.LOG_ERROR=!1,cr.LOG_EVENTS=!1,cr.LOG_PACKETS=!1;let j=cr;class Xt{constructor(t=null){if(this._length=0,this._dictionary=new Map,this._array=[],this._keys=[],t)for(const[e,s]of t.entries())this.add(e,s)}get length(){return this._length}get disposed(){return!this._dictionary}dispose(){if(!this._dictionary){for(const t of this._dictionary.keys())this._dictionary.delete(t);this._dictionary=null}this._length=0,this._array=null,this._keys=null}reset(){for(const t of this._dictionary.keys())this._dictionary.delete(t);this._length=0,this._array=[],this._keys=[]}unshift(t,e){return this._dictionary.get(t)!==null?!1:(this._dictionary.set(t,e),this._array.unshift(e),this._keys.unshift(t),this._length++,!0)}add(t,e){return this._dictionary.get(t)!==void 0?!1:(this._dictionary.set(t,e),this._array[this._length]=e,this._keys[this._length]=t,this._length++,!0)}remove(t){const e=this._dictionary.get(t);if(!e)return null;const s=this._array.indexOf(e);return s>=0&&(this._array.splice(s,1),this._keys.splice(s,1),this._length--),this._dictionary.delete(t),e}getWithIndex(t){return t<0||t>=this._length?null:this._array[t]}getKey(t){return t<0||t>=this._length?null:this._keys[t]}getKeys(){return this._keys.slice()}hasKey(t){return this._keys.indexOf(t)>-1}getValue(t){return this._dictionary.get(t)}getValues(){return this._array.slice()}hasValue(t){return this._array.indexOf(t)>-1}indexOf(t){return this._array.indexOf(t)}concatenate(t){for(const e of t._keys)this.add(e,t.getValue(e))}clone(){const t=new Xt;return t.concatenate(this),t}}const pg=n=>{let t="";const e=new Uint8Array(n),s=e.byteLength;for(let i=0;i<s;i++)t+=String.fromCharCode(e[i]);return window.btoa(t)};class tl{constructor(t){this._position=0,this._dataView=new DataView(t)}readBytes(t){const e=new tl(this._dataView.buffer.slice(this._position,this._position+t));return this._position+=t,e}readByte(){const t=this._dataView.getInt8(this._position);return this._position++,t}readShort(){const t=this._dataView.getInt16(this._position);return this._position+=2,t}readInt(){const t=this._dataView.getInt32(this._position);return this._position+=4,t}readFloat(){const t=this._dataView.getFloat32(this._position);return this._position+=4,t}readDouble(){const t=this._dataView.getFloat64(this._position);return this._position+=8,t}remaining(){return this._dataView.byteLength-this._position}toString(t){return new TextDecoder().decode(this._dataView.buffer)}toArrayBuffer(){return this._dataView.buffer}}class FE{constructor(){this._buffer=new Uint8Array,this._position=0}writeByte(t){const e=new Uint8Array(1);return e[0]=t,this.appendArray(e),this}writeBytes(t){const e=new Uint8Array(t);return this.appendArray(e),this}writeShort(t){const e=new Uint8Array(2);return e[0]=t>>8,e[1]=t&255,this.appendArray(e),this}writeInt(t){const e=new Uint8Array(4);return e[0]=t>>24,e[1]=t>>16,e[2]=t>>8,e[3]=t&255,this.appendArray(e),this}writeString(t,e=!0){const s=new TextEncoder().encode(t);return e?(this.writeShort(s.length),this.appendArray(s)):this.appendArray(s),this}appendArray(t){if(!t)return;const e=new Uint8Array(this.position+t.length>this._buffer.length?this.position+t.length:this._buffer.length);e.set(this._buffer),e.set(t,this.position),this._buffer=e,this.position+=t.length}getBuffer(){return this._buffer.buffer}get position(){return this._position}set position(t){this._position=t}toStrin
|
||
|
|
attribute vec2 aTextureCoord;
|
||
|
|
|
||
|
|
uniform mat3 projectionMatrix;
|
||
|
|
|
||
|
|
varying vec2 vTextureCoord;
|
||
|
|
|
||
|
|
void main(void)
|
||
|
|
{
|
||
|
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
|
vTextureCoord = aTextureCoord;
|
||
|
|
}`,`varying vec2 vTextureCoord;
|
||
|
|
uniform sampler2D uSampler;
|
||
|
|
|
||
|
|
uniform float gamma;
|
||
|
|
uniform float contrast;
|
||
|
|
uniform float saturation;
|
||
|
|
uniform float brightness;
|
||
|
|
uniform float red;
|
||
|
|
uniform float green;
|
||
|
|
uniform float blue;
|
||
|
|
uniform float alpha;
|
||
|
|
|
||
|
|
void main(void)
|
||
|
|
{
|
||
|
|
vec4 c = texture2D(uSampler, vTextureCoord);
|
||
|
|
|
||
|
|
if (c.a > 0.0) {
|
||
|
|
c.rgb /= c.a;
|
||
|
|
|
||
|
|
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
||
|
|
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
||
|
|
rgb.r *= red;
|
||
|
|
rgb.g *= green;
|
||
|
|
rgb.b *= blue;
|
||
|
|
c.rgb = rgb * brightness;
|
||
|
|
|
||
|
|
c.rgb *= c.a;
|
||
|
|
}
|
||
|
|
|
||
|
|
gl_FragColor = c * alpha;
|
||
|
|
}`),this.gamma=1,this.saturation=1,this.contrast=1,this.brightness=1,this.red=1,this.green=1,this.blue=1,this.alpha=1,Object.assign(this,t)}apply(t,e,s,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,e,s,i)}}const sm=`
|
||
|
|
attribute vec2 aVertexPosition;
|
||
|
|
attribute vec2 aTextureCoord;
|
||
|
|
uniform mat3 projectionMatrix;
|
||
|
|
varying vec2 vTextureCoord;
|
||
|
|
void main(void)
|
||
|
|
{
|
||
|
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
|
vTextureCoord = aTextureCoord;
|
||
|
|
}`,im=`
|
||
|
|
varying vec2 vTextureCoord;
|
||
|
|
uniform sampler2D uSampler;
|
||
|
|
uniform sampler2D mask;
|
||
|
|
uniform int fromChannel;
|
||
|
|
uniform int toChannel;
|
||
|
|
|
||
|
|
void main(void) {
|
||
|
|
vec4 maskColor = texture2D(mask, vTextureCoord);
|
||
|
|
vec4 currentColor = texture2D(uSampler, vTextureCoord);
|
||
|
|
vec4 adjusted = currentColor;
|
||
|
|
|
||
|
|
if(maskColor.r == 0.0 && maskColor.g == 0.0 && maskColor.b == 0.0)
|
||
|
|
{
|
||
|
|
adjusted.a = 0.0;
|
||
|
|
}
|
||
|
|
|
||
|
|
gl_FragColor = vec4(adjusted.r, adjusted.g, adjusted.b, adjusted.a);
|
||
|
|
}`,on=class on extends bd{constructor(t,e,s){super(sm,im,{mask:t.castToBaseTexture(),fromChannel:e,toChannel:s})}};on.CHANNEL_RED=0,on.CHANNEL_GREEN=1,on.CHANNEL_BLUE=2,on.CHANNEL_ALPHA=3;let xE=on;const ra=class ra extends YT{constructor(t){super(t),ra.INSTANCE||(ra.INSTANCE=this)}static get instance(){return this.INSTANCE||null}};ra.INSTANCE=null;let Kt=ra;const ui=()=>{var n;return((n=Kt.instance)==null?void 0:n.ticker)||null},rm=()=>{var n;return((n=ui())==null?void 0:n.FPS)||0},nt=()=>{var n;return((n=ui())==null?void 0:n.lastTime)||0};class xY extends Il{}class nm extends Z_{}class Rs extends HT{}class am extends bd{}class _o extends X{}class GY extends we{}class xt extends bt{}class Rg extends Ft{}const om=`
|
||
|
|
attribute vec2 aVertexPosition;
|
||
|
|
attribute vec2 aTextureCoord;
|
||
|
|
uniform mat3 projectionMatrix;
|
||
|
|
varying vec2 vTextureCoord;
|
||
|
|
void main(void)
|
||
|
|
{
|
||
|
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
|
vTextureCoord = aTextureCoord;
|
||
|
|
}`,hm=`
|
||
|
|
varying vec2 vTextureCoord;
|
||
|
|
uniform sampler2D uSampler;
|
||
|
|
uniform sampler2D lut;
|
||
|
|
uniform int channel;
|
||
|
|
|
||
|
|
void main(void) {
|
||
|
|
vec4 currentColor = texture2D(uSampler, vTextureCoord);
|
||
|
|
vec4 adjusted = currentColor;
|
||
|
|
|
||
|
|
if(currentColor.a > 0.0)
|
||
|
|
{
|
||
|
|
if(channel == 0)
|
||
|
|
{
|
||
|
|
adjusted = texture2D(lut, vec2((currentColor.r * 255.0 + 0.5) / 256.0, 0.5));
|
||
|
|
} else if(channel == 1) {
|
||
|
|
adjusted = texture2D(lut, vec2((currentColor.g * 255.0 + 0.5) / 256.0, 0.5));
|
||
|
|
} else if(channel == 2) {
|
||
|
|
adjusted = texture2D(lut, vec2((currentColor.b * 255.0 + 0.5) / 256.0, 0.5));
|
||
|
|
} else if(channel == 3) {
|
||
|
|
adjusted = texture2D(lut, vec2((currentColor.a * 255.0 + 0.5) / 256.0, 0.5));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
gl_FragColor = vec4(adjusted.r, adjusted.g, adjusted.b, currentColor.a);
|
||
|
|
}`,Es=class Es extends am{constructor(t,e=Es.CHANNEL_RED){super(om,hm),this._channel=e;let s=[];s=this.getLutForPalette(t),this._lut=nm.fromBuffer(Uint8Array.from(s),s.length/4,1,{mipmap:0,scaleMode:0}),this.uniforms.lut=this._lut,this.uniforms.channel=this._channel}getLutForPalette(t){const e=[];for(let s=0;s<t.length;s++)e[s*4+Es.CHANNEL_RED]=t[s]>>16&255,e[s*4+Es.CHANNEL_GREEN]=t[s]>>8&255,e[s*4+Es.CHANNEL_BLUE]=t[s]&255,e[s*4+Es.CHANNEL_ALPHA]=t[s]>>24&255;return e}get lut(){return this._lut}get channel(){return this._channel}};Es.CHANNEL_RED=0,Es.CHANNEL_GREEN=1,Es.CHANNEL_BLUE=2,Es.CHANNEL_ALPHA=3;let lo=Es;const Eh=class Eh{constructor(){this.RENDER_TEXTURE_POOL=new Map,this.RENDER_TEXTURE_CACHE=[]}clearCache(){this.RENDER_TEXTURE_POOL.forEach(t=>t==null?void 0:t.destroy(!0)),this.RENDER_TEXTURE_POOL.clear(),this.RENDER_TEXTURE_CACHE=[]}clearRenderTexture(t){return t?this.writeToRenderTexture(new bt(Ft.EMPTY),t):null}getTextureIdentifier(t,e,s){return`${s??Eh.DEFAULT_PLANE_ID}:${t}:${e}`}createRenderTexture(t,e,s=null){if(t<0||e<0)return null;if(!s){const r=Ss.create({width:t,height:e});return this.RENDER_TEXTURE_CACHE.push(r),r}s=this.getTextureIdentifier(t,e,s);let i=this.RENDER_TEXTURE_POOL.get(s);return i||(i=Ss.create({width:t,height:e}),this.RENDER_TEXTURE_CACHE.push(i),this.RENDER_TEXTURE_POOL.set(s,i)),i}createAndFillRenderTexture(t,e,s=null,i=16777215){if(t<0||e<0)return null;const r=this.createRenderTexture(t,e,s);return this.clearAndFillRenderTexture(r,i)}createAndWriteRenderTexture(t,e,s,i=null,r=null){if(t<0||e<0)return null;const a=this.createRenderTexture(t,e,i);return this.writeToRenderTexture(s,a,!0,r)}clearAndFillRenderTexture(t,e=16777215){if(!t)return null;const s=new bt(Ft.WHITE);return s.tint=e,s.width=t.width,s.height=t.height,this.writeToRenderTexture(s,t)}writeToRenderTexture(t,e,s=!0,i=null){return!t||!e?null:(this.getRenderer().render(t,{renderTexture:e,clear:s,transform:i}),e)}getPixels(t,e=null){return this.getExtractor().pixels(t)}getRenderer(){return Kt.instance.renderer}getExtractor(){return this.getRenderer().plugins.extract}};Eh.DEFAULT_PLANE_ID="DEFAULT";let pl=Eh;class Pt{static generateTexture(t,e=null,s=null,i=1){return t?(s===null&&(s=$_.SCALE_MODE),this.getRenderer().generateTexture(t,{scaleMode:s,resolution:i,region:e})):null}static generateTextureFromImage(t){return t?Ft.from(t):null}static generateImage(t){return t?this.getExtractor().image(t):null}static generateImageUrl(t){return t?this.getExtractor().base64(t):null}static generateCanvas(t){return t?this.getExtractor().canvas(t):null}static clearRenderTexture(t){return t?this.writeToRenderTexture(new bt(Ft.EMPTY),t):null}static createRenderTexture(t,e){return t<0||e<0?null:Ss.create({width:t,height:e})}static createAndFillRenderTexture(t,e,s=16777215){if(t<0||e<0)return null;const i=this.createRenderTexture(t,e);return this.clearAndFillRenderTexture(i,s)}static createAndWriteRenderTexture(t,e,s,i=null){if(t<0||e<0)return null;const r=this.createRenderTexture(t,e);return this.writeToRenderTexture(s,r,!0,i)}static clearAndFillRenderTexture(t,e=16777215){if(!t)return null;const s=new bt(Ft.WHITE);return s.tint=e,s.width=t.width,s.height=t.height,this.writeToRenderTexture(s,t)}static writeToRenderTexture(t,e,s=!0,i=null){return!t||!e?null:(this.getRenderer().render(t,{renderTexture:e,clear:s,transform:i}),e)}static getPixels(t,e=null){return this.getExtractor().pixels(t)}static getRenderer(){return Kt.instance.renderer}static getExtractor(){return this.getRenderer().plugins.extract}}const ur=class ur{static createAsset(t,e,s,i,r,a=!1,o=!1,h=!1){const _=ur.GRAPHIC_POOL.length?ur.GRAPHIC_POOL.pop():new ur;return _._name=t,_._source=e||null,s?(_._texture=s,_._initialized=!1):(_._texture=null,_._initialized=!0),_._usesPalette=h,_._x=i,_._y=r,_._flipH=a,_._flipV=o,_._rectangle=null,_}recycle(){this._texture=null,ur.GRAPHIC_POOL.push(this)}initialize(){this._initialized||!this._texture||(this._width=this._texture.width,this._height=this._texture.height,this._initialized=!0)}getImageUrl(){return Pt.generateImageUrl(new bt(this._t
|
||
|
|
%c %c %c Nitro ${xi.UI_VERSION} - Renderer ${xi.RENDERER_VERSION} %c %c %c https://discord.nitrodev.co %c %c
|
||
|
|
|
||
|
|
`,"background: #ffffff; padding:5px 0;","background: #ffffff; padding:5px 0;","color: #ffffff; background: #000000; padding:5px 0;","background: #ffffff; padding:5px 0;","background: #ffffff; padding:5px 0;","background: #000000; padding:5px 0;","background: #ffffff; padding:5px 0;","background: #ffffff; padding:5px 0;"];self.console.log(...t)}else self.console&&self.console.log(`Nitro ${xi.UI_VERSION} - Renderer ${xi.RENDERER_VERSION} `)}};xi.RENDERER_VERSION="1.6.6",xi.UI_VERSION="";let Lo=xi;class Sm extends Ye{constructor(){super(),Lo.sayHello(),this._configuration=new Am,this._communication=new Om}onDispose(){this._communication&&(this._communication.dispose(),this._communication=null)}get configuration(){return this._configuration}get communication(){return this._communication}}class Cm{constructor(t){this._id=parseInt(t.id),this._value=parseInt(t.id),this._prevents=t.prevents||[],this._preventHeadTurn=t.preventHeadTurn||!1,this._isAnimated=!0,t.animated!==void 0&&t.animated===!1&&(this._isAnimated=!1)}get id(){return this._id}get value(){return this._value}get prevents(){return this._prevents}get preventHeadTurn(){return this._preventHeadTurn}get isAnimated(){return this._isAnimated}}class Nm{constructor(t){if(this._id=t.id,this._state=t.state,this._precedence=t.precedence,this._activePartSet=t.activePartSet,this._assetPartDefinition=t.assetPartDefinition,this._lay=t.lay,this._geometryType=t.geometryType,this._isMain=t.main||!1,this._isDefault=t.isDefault||!1,this._isAnimation=t.animation||!1,this._startFromFrameZero=t.startFromFrameZero||!1,this._prevents=t.prevents||[],this._preventHeadTurn=t.preventHeadTurn||!1,this._types=new Map,this._params=new Map,this._defaultParameterValue="",this._canvasOffsets=null,t.params&&t.params.length>0)for(const e of t.params)e&&(e.id==="default"?this._defaultParameterValue=e.value:this._params.set(e.id,e.value));if(t.types&&t.types.length>0)for(const e of t.types){if(!e)continue;const s=new Cm(e);this._types.set(s.id,s)}}setOffsets(t,e,s){this._canvasOffsets||(this._canvasOffsets=new Map);let i=this._canvasOffsets.get(t);i||(i=new Map,this._canvasOffsets.set(t,i)),i.set(e,s)}getOffsets(t,e){if(!this._canvasOffsets)return null;const s=this._canvasOffsets.get(t);return s?s.get(e):null}getType(t){if(!t)return null;const e=this._types.get(parseInt(t));return e||null}getParameterValue(t){if(!t)return"";const e=this._params.get(t);return e||this._defaultParameterValue}getPrevents(t){return this._prevents.concat(this.getTypePrevents(t))}getTypePrevents(t){if(!t)return[];const e=this._types.get(parseInt(t));return e?e.prevents:[]}getPreventHeadTurn(t){if(!t)return this._preventHeadTurn;const e=this.getType(t);return e?e.preventHeadTurn:this._preventHeadTurn}isAnimated(t){if(!t)return!0;const e=this.getType(t);return e?e.isAnimated:!0}get id(){return this._id}get state(){return this._state}get precedence(){return this._precedence}get activePartSet(){return this._activePartSet}get assetPartDefinition(){return this._assetPartDefinition}get lay(){return this._lay}get geometryType(){return this._geometryType}get isMain(){return this._isMain}get isDefault(){return this._isDefault}get isAnimation(){return this._isAnimation}get startFromFrameZero(){return this._startFromFrameZero}get prevents(){return this._prevents}get preventHeadTurn(){return this._preventHeadTurn}get params(){return this._params}}class Zl{constructor(t,e="",s=0){this._actionType=t||"",this._actionParameter=e||"",this._definition=null,this._startFrame=s||0,this._overridingAction=null}dispose(){this._actionType=null,this._actionParameter=null,this._definition=null}get id(){return this._definition?this._definition.id+"_"+this._actionParameter:""}get actionType(){return this._actionType}get actionParameter(){return this._actionParameter}set actionParameter(t){this._actionParameter=t}get definition(){return this._definition}set definition(t){this._definition=t}get startFrame(){return this._startFrame}get overridingAction(){return this._overridingAction}set overridingAction(t){this._overridingAction=t}}class Mm{constructor(t,e){t
|