textmode.js 0.2.1-beta.7 → 0.3.0

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.
@@ -142,33 +142,33 @@ class j {
142
142
  a(this, "gt", null);
143
143
  a(this, "vt");
144
144
  a(this, "yt");
145
- a(this, "wt", []);
146
- a(this, "Ct");
145
+ a(this, "Ct", []);
146
+ a(this, "wt");
147
147
  a(this, "$t", null);
148
148
  a(this, "bt", []);
149
149
  a(this, "xt", null);
150
150
  a(this, "Mt", !1);
151
151
  a(this, "Rt", null);
152
- this.dt = e, this._t = i, this.u = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...r }, this.vt = t, this.Ct = Math.min(Math.max(1, s), 8), this.xt = n, this.Mt = !!o, this.Rt = this.Mt ? new ht() : null;
152
+ this.dt = e, this._t = i, this.u = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...r }, this.vt = t, this.wt = Math.min(Math.max(1, s), 8), this.xt = n, this.Mt = !!o, this.Rt = this.Mt ? new ht() : null;
153
153
  const c = t.getParameter(t.MAX_DRAW_BUFFERS), l = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
154
- this.Ct = Math.min(this.Ct, c, l), this.yt = t.createFramebuffer(), this.Ft(), this.St(), this.bt = Array(this.Ct).fill(null);
154
+ this.wt = Math.min(this.wt, c, l), this.yt = t.createFramebuffer(), this.Ft(), this.St(), this.bt = Array(this.wt).fill(null);
155
155
  }
156
156
  Ft() {
157
157
  const t = this.vt, e = this.u.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.u.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.u.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE;
158
- for (let r = 0; r < this.Ct; r++) {
158
+ for (let r = 0; r < this.wt; r++) {
159
159
  const n = t.createTexture();
160
- t.bindTexture(t.TEXTURE_2D, n), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, i), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, i), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this.dt, this._t, 0, t.RGBA, s, null), this.wt.push(n);
160
+ t.bindTexture(t.TEXTURE_2D, n), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, i), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, i), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this.dt, this._t, 0, t.RGBA, s, null), this.Ct.push(n);
161
161
  }
162
162
  t.bindTexture(t.TEXTURE_2D, null);
163
163
  }
164
164
  St() {
165
165
  const t = this.vt;
166
- if (t.bindFramebuffer(t.FRAMEBUFFER, this.yt), this.Ct === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.wt[0], 0);
166
+ if (t.bindFramebuffer(t.FRAMEBUFFER, this.yt), this.wt === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.Ct[0], 0);
167
167
  else {
168
168
  const i = [];
169
- for (let s = 0; s < this.Ct; s++) {
169
+ for (let s = 0; s < this.wt; s++) {
170
170
  const r = t.COLOR_ATTACHMENT0 + s;
171
- t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.wt[s], 0), i.push(r);
171
+ t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.Ct[s], 0), i.push(r);
172
172
  }
173
173
  t.drawBuffers(i);
174
174
  }
@@ -177,12 +177,12 @@ class j {
177
177
  }
178
178
  At(t) {
179
179
  const e = this.vt;
180
- e.bindTexture(e.TEXTURE_2D, this.wt[0]), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, 1), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), e.bindTexture(e.TEXTURE_2D, null);
180
+ e.bindTexture(e.TEXTURE_2D, this.Ct[0]), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, 1), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), e.bindTexture(e.TEXTURE_2D, null);
181
181
  }
182
182
  resize(t, e) {
183
- this.dt = t, this._t = e, this.gt = null, this.bt = Array(this.Ct).fill(null);
183
+ this.dt = t, this._t = e, this.gt = null, this.bt = Array(this.wt).fill(null);
184
184
  const i = this.vt, s = this.u.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE;
185
- for (const r of this.wt) i.bindTexture(i.TEXTURE_2D, r), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, this.dt, this._t, 0, i.RGBA, s, null);
185
+ for (const r of this.Ct) i.bindTexture(i.TEXTURE_2D, r), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, this.dt, this._t, 0, i.RGBA, s, null);
186
186
  i.bindTexture(i.TEXTURE_2D, null);
187
187
  }
188
188
  zt(t) {
@@ -204,8 +204,8 @@ class j {
204
204
  const n = ((i = (e = this.xt).Tt) == null ? void 0 : i.call(e)) ?? null;
205
205
  n && this.xt.Et(n), this.Mt && this.Rt && ((r = (s = this.xt).Lt) == null || r.call(s, this.Rt));
206
206
  }
207
- this.$t = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.yt), this.bt = Array(this.Ct).fill(null);
208
- for (let n = 0; n < this.Ct; n++) t.clearBufferfv(t.COLOR, n, new Float32Array([0, 0, 0, 0]));
207
+ this.$t = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.yt), this.bt = Array(this.wt).fill(null);
208
+ for (let n = 0; n < this.wt; n++) t.clearBufferfv(t.COLOR, n, new Float32Array([0, 0, 0, 0]));
209
209
  t.viewport(0, 0, this.dt, this._t), W(t, [0, 0, this.dt, this._t]);
210
210
  }
211
211
  end() {
@@ -221,7 +221,7 @@ class j {
221
221
  kt() {
222
222
  const t = this.vt;
223
223
  t.deleteFramebuffer(this.yt);
224
- for (const e of this.wt) t.deleteTexture(e);
224
+ for (const e of this.Ct) t.deleteTexture(e);
225
225
  }
226
226
  get width() {
227
227
  return this.dt;
@@ -230,15 +230,15 @@ class j {
230
230
  return this._t;
231
231
  }
232
232
  get textures() {
233
- return [...this.wt];
233
+ return [...this.Ct];
234
234
  }
235
235
  }
236
236
  class I {
237
237
  constructor(t, e, i) {
238
238
  a(this, "vt");
239
239
  a(this, "Gt");
240
- a(this, "Dt", /* @__PURE__ */ new Map());
241
240
  a(this, "Bt", /* @__PURE__ */ new Map());
241
+ a(this, "Dt", /* @__PURE__ */ new Map());
242
242
  a(this, "It", 0);
243
243
  this.vt = t, this.Gt = this.Wt(e, i), this.Ot();
244
244
  }
@@ -248,9 +248,9 @@ class I {
248
248
  const i = this.vt.getActiveUniform(this.Gt, e);
249
249
  if (i) {
250
250
  const s = this.vt.getUniformLocation(this.Gt, i.name);
251
- if (s && (this.Dt.set(i.name, s), this.Bt.set(i.name, { type: i.type, size: i.size }), i.size > 1)) {
251
+ if (s && (this.Bt.set(i.name, s), this.Dt.set(i.name, { type: i.type, size: i.size }), i.size > 1)) {
252
252
  const r = i.name.replace(/\[.*\]$/, "");
253
- this.Dt.has(r) || (this.Dt.set(r, s), this.Bt.set(r, { type: i.type, size: i.size }));
253
+ this.Bt.has(r) || (this.Bt.set(r, s), this.Dt.set(r, { type: i.type, size: i.size }));
254
254
  }
255
255
  }
256
256
  }
@@ -281,21 +281,21 @@ class I {
281
281
  for (const [e, i] of Object.entries(t)) this.Xt(e, i);
282
282
  }
283
283
  jt(t) {
284
- return this.Dt.has(t);
284
+ return this.Bt.has(t);
285
285
  }
286
286
  Yt(t) {
287
- return this.Bt.get(t) || null;
287
+ return this.Dt.get(t) || null;
288
288
  }
289
289
  qt() {
290
290
  const t = [];
291
- for (const [e, i] of this.Bt.entries()) t.push({ name: e, ...i });
291
+ for (const [e, i] of this.Dt.entries()) t.push({ name: e, ...i });
292
292
  return t;
293
293
  }
294
294
  Xt(t, e) {
295
295
  var c;
296
- const i = this.Dt.get(t);
296
+ const i = this.Bt.get(t);
297
297
  if (!i) return;
298
- const s = this.Bt.get(t);
298
+ const s = this.Dt.get(t);
299
299
  if (!s) return void console.warn(`No type information found for uniform '${t}'`);
300
300
  const { type: r, size: n } = s, o = this.vt;
301
301
  if (typeof e == "number") switch (r) {
@@ -362,8 +362,8 @@ class I {
362
362
  this.vt.deleteProgram(this.Gt);
363
363
  }
364
364
  }
365
- const k = `#version 300 es
366
- in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2 Uw;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 A(float B){float C=sin(B),D=cos(B);return mat3(1,0,0,0,D,-C,0,C,D);}mat3 E(float B){float C=sin(B),D=cos(B);return mat3(D,0,C,0,1,0,-C,0,D);}mat3 F(float B){float C=sin(B),D=cos(B);return mat3(D,-C,0,C,D,0,0,0,1);}vec2 G(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return N*M*I+3.*N*H*J+3.*M*O*K+O*H*L;}vec2 P(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return-3.*N*I+3.*N*J-6.*M*H*J+6.*M*H*K-3.*O*K+3.*O*L;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 Q;bool R=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool S=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(R){float H=a_position.x;vec2 T=G(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 U=P(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float V=length(U);U=V>0.?U/V:vec2(1,0);Q=T+vec2(-U.y,U.x)*a_position.y*a_instanceSize.y;}else if(S){float C=a_instanceArcAngles.x,W=a_instanceArcAngles.y;C=mod(C,6.28318530718);if(C<0.)C+=6.28318530718;W=mod(W,6.28318530718);if(W<0.)W+=6.28318530718;float X=C-W;if(X<=0.)X+=6.28318530718;float Y=C-a_position.x*X;vec2 Z=vec2(cos(Y),sin(Y))*a_position.y;Q=Z*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{Q=a_position*a_instanceSize+a_instancePosition;}vec2 a=(Q/Uw)*2.-1.;a.y=-a.y;if(length(a_instanceGlobalRotation)>0.){vec3 b=vec3(a-a_instanceRotationCenter,0);b.x*=U9;if(a_instanceGlobalRotation.x!=0.)b=A(-a_instanceGlobalRotation.x)*b;if(a_instanceGlobalRotation.y!=0.)b=E(-a_instanceGlobalRotation.y)*b;if(a_instanceGlobalRotation.z!=0.)b=F(-a_instanceGlobalRotation.z)*b;b.x/=U9;a=b.xy+a_instanceRotationCenter;}gl_Position=vec4(a,0,1);}`, at = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.,1.);}";
365
+ const N = `#version 300 es
366
+ in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2 Uy;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 A(float B){float C=sin(B),D=cos(B);return mat3(1,0,0,0,D,-C,0,C,D);}mat3 E(float B){float C=sin(B),D=cos(B);return mat3(D,0,C,0,1,0,-C,0,D);}mat3 F(float B){float C=sin(B),D=cos(B);return mat3(D,-C,0,C,D,0,0,0,1);}vec2 G(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return N*M*I+3.*N*H*J+3.*M*O*K+O*H*L;}vec2 P(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return-3.*N*I+3.*N*J-6.*M*H*J+6.*M*H*K-3.*O*K+3.*O*L;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 Q;bool R=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool S=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(R){float H=a_position.x;vec2 T=G(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 U=P(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float V=length(U);U=V>0.?U/V:vec2(1,0);Q=T+vec2(-U.y,U.x)*a_position.y*a_instanceSize.y;}else if(S){float C=a_instanceArcAngles.x,W=a_instanceArcAngles.y;C=mod(C,6.28318530718);if(C<0.)C+=6.28318530718;W=mod(W,6.28318530718);if(W<0.)W+=6.28318530718;float X=C-W;if(X<=0.)X+=6.28318530718;float Y=C-a_position.x*X;vec2 Z=vec2(cos(Y),sin(Y))*a_position.y;Q=Z*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{Q=a_position*a_instanceSize+a_instancePosition;}vec2 a=(Q/Uy)*2.-1.;a.y=-a.y;if(length(a_instanceGlobalRotation)>0.){vec3 b=vec3(a-a_instanceRotationCenter,0);b.x*=U9;if(a_instanceGlobalRotation.x!=0.)b=A(-a_instanceGlobalRotation.x)*b;if(a_instanceGlobalRotation.y!=0.)b=E(-a_instanceGlobalRotation.y)*b;if(a_instanceGlobalRotation.z!=0.)b=F(-a_instanceGlobalRotation.z)*b;b.x/=U9;a=b.xy+a_instanceRotationCenter;}gl_Position=vec4(a,0,1);}`, at = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.,1.);}";
367
367
  class ft {
368
368
  constructor(t) {
369
369
  a(this, "vt");
@@ -371,10 +371,10 @@ class ft {
371
371
  a(this, "te");
372
372
  a(this, "ee");
373
373
  a(this, "se");
374
- this.vt = t, this.te = new I(this.vt, k, `#version 300 es
375
- precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.,1.);o_transform=vec4(v_transform,1.);}`), this.Qt = new I(this.vt, k, `#version 300 es
376
- precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ee = new I(this.vt, at, "precision mediump float;uniform sampler2D U0;uniform vec2 U1;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U5;uniform sampler2D U2;uniform sampler2D U6;uniform vec2 U7;uniform vec2 U8;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/U8;vec2 F=E*U7;vec2 G=floor(F);vec2 H=(G+0.5)/U7;vec4 I=texture2D(U3,H);vec4 J=texture2D(U4,H);vec4 K=texture2D(U5,H);bool L=K.r>0.5;bool M=K.g>0.5;bool N=K.b>0.5;vec4 O=texture2D(U2,H);int P=int(O.r*255.+0.5)+int(O.g*255.+0.5)*256;int Q=int(mod(float(P),U1.x));int R=P/int(U1.x);float S=(U1.y-1.)-float(R);vec2 T=vec2(float(Q),S)/U1;vec4 U=texture2D(U6,H);float V=U.r*255.+U.g;float W=-(V*360./255.)*0.017453292;vec2 X=fract(F)-0.5;if(M)X.x=-X.x;if(N)X.y=-X.y;X=A(W)*X+0.5;vec2 Y=1./U1;vec2 Z=T+X*Y;vec2 a=T+Y;if(any(lessThan(Z,T))||any(greaterThan(Z,a))){gl_FragColor=L?I:J;return;}vec4 b=texture2D(U0,Z);if(L)b.rgb=1.-b.rgb;gl_FragColor=mix(J,I,b);}"), this.se = new I(this.vt, k, `#version 300 es
377
- precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform bool Um;uniform bool Un;uniform vec2 Uo;uniform bool Up;uniform vec3 Uq;uniform bool Ur;uniform vec3 Us;uniform vec4 Ut;uniform int Uu;uniform vec3 Uv[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;float A(vec3 B){return dot(B,vec3(0.299,0.587,0.114));}void main(){vec2 C=vec2(v_uv.x,1.-v_uv.y);vec4 D=texture(Uk,C);float E=A(D.rgb);if(Uu>0){float F=float(Uu);float G=clamp(E*(F-1.),0.,F-1.);int H=int(floor(G+0.5));vec3 I=Uv[H];o_character=vec4(I,1.);}else{o_character=vec4(E,0.,0.,1.);}vec3 J=D.rgb;vec3 K=Up?Uq:J;vec3 L=Ur?Us:J;float M=Up?1.:D.a;float N;if(D.a<0.01){K=Ut.rgb;L=Ut.rgb;M=Ut.a;N=Ut.a;}else{N=Ur?1.:D.a;}o_primaryColor=vec4(K,M);o_secondaryColor=vec4(L,N);o_rotation=vec4(Uo.xy,0.,1.);o_transform=vec4(float(Ul),float(Um),float(Un),1.);}`);
374
+ this.vt = t, this.te = new I(this.vt, N, `#version 300 es
375
+ precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.,1.);o_transform=vec4(v_transform,1.);}`), this.Qt = new I(this.vt, N, `#version 300 es
376
+ precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ee = new I(this.vt, at, "precision mediump float;uniform sampler2D U0;uniform vec2 U1;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U5;uniform sampler2D U2;uniform sampler2D U6;uniform vec2 U7;uniform vec2 U8;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/U8;vec2 F=E*U7;vec2 G=floor(F);vec2 H=(G+0.5)/U7;vec4 I=texture2D(U3,H);vec4 J=texture2D(U4,H);vec4 K=texture2D(U5,H);bool L=K.r>0.5;bool M=K.g>0.5;bool N=K.b>0.5;vec4 O=texture2D(U2,H);int P=int(O.r*255.+0.5)+int(O.g*255.+0.5)*256;int Q=int(mod(float(P),U1.x));int R=P/int(U1.x);float S=(U1.y-1.)-float(R);vec2 T=vec2(float(Q),S)/U1;vec4 U=texture2D(U6,H);float V=U.r*255.+U.g;float W=-(V*360./255.)*0.017453292;vec2 X=fract(F)-0.5;if(M)X.x=-X.x;if(N)X.y=-X.y;X=A(W)*X+0.5;vec2 Y=1./U1;vec2 Z=T+X*Y;vec2 a=T+Y;if(any(lessThan(Z,T))||any(greaterThan(Z,a))){gl_FragColor=L?I:J;return;}vec4 b=texture2D(U0,Z);if(L)b.rgb=1.-b.rgb;gl_FragColor=mix(J,I,b);}"), this.se = new I(this.vt, N, `#version 300 es
377
+ precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform bool Um;uniform bool Un;uniform vec2 Uo;uniform bool Up;uniform vec3 Uq;uniform bool Ur;uniform vec3 Us;uniform vec4 Ut;uniform int Uu;uniform vec3 Uv[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;float A(vec3 B){return dot(B,vec3(0.299f,0.587f,0.114f));}void main(){vec2 C=vec2(v_uv.x,1.0f-v_uv.y);vec4 D=texture(Uk,C);float E=A(D.rgb);if(Uu>0){float F=float(Uu);float G=clamp(E*(F-1.0f),0.0f,F-1.0f);int H=int(floor(G+0.5f));vec3 I=Uv[H];o_character=vec4(I,1.0f);}else{o_character=vec4(E,0.0f,0.0f,1.0f);}vec3 J=D.rgb;vec3 K=Up?Uq:J;vec3 L=Ur?Us:J;float M=1.0f;float N=1.0f;if(D.a<0.01f){K=Ut.rgb;L=Ut.rgb;}o_primaryColor=vec4(K,M);o_secondaryColor=vec4(L,N);o_rotation=vec4(Uo.xy,0.0f,1.0f);o_transform=vec4(float(Ul),float(Um),float(Un),1.0f);}`);
378
378
  }
379
379
  ie() {
380
380
  return this.Qt;
@@ -389,7 +389,7 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform
389
389
  return this.se;
390
390
  }
391
391
  oe(t) {
392
- return new I(this.vt, k, t);
392
+ return new I(this.vt, N, t);
393
393
  }
394
394
  ae(t, e) {
395
395
  return new I(this.vt, t, e);
@@ -437,12 +437,12 @@ class gt {
437
437
  }
438
438
  ve(t, e, i) {
439
439
  const { shader: s } = t, r = H(this.vt) || this.vt.getParameter(this.vt.VIEWPORT);
440
- s.Nt({ U9: r[2] / r[3], Uw: [r[2], r[3]] });
440
+ s.Nt({ U9: r[2] / r[3], Uy: [r[2], r[3]] });
441
441
  const n = (l) => {
442
442
  if (!l || !l.ye()) return;
443
443
  const u = l.unitGeometry, f = l.unitBuffer;
444
444
  try {
445
- this.pe.ce(s.Jt, l.type + "", u, f), l.batch.we(s), l.batch.Ce(u.$e, u.be);
445
+ this.pe.ce(s.Jt, l.type + "", u, f), l.batch.Ce(s), l.batch.we(u.$e, u.be);
446
446
  } finally {
447
447
  l.batch.xe(s), this.pe._e(), l.Me();
448
448
  }
@@ -468,10 +468,10 @@ class gt {
468
468
  Ae(t, e, i, s, r, n, o, c) {
469
469
  e.Vt(), e.Nt(i);
470
470
  const l = this.vt.getParameter(this.vt.VIEWPORT);
471
- if (e.Nt({ U9: l[2] / l[3], Uw: [l[2], l[3]] }), t.Me(), t.Fe({ x: s, y: r, width: n, height: o }, c), t.ye()) {
471
+ if (e.Nt({ U9: l[2] / l[3], Uy: [l[2], l[3]] }), t.Me(), t.Fe({ x: s, y: r, width: n, height: o }, c), t.ye()) {
472
472
  const u = t.unitGeometry, f = t.unitBuffer;
473
473
  try {
474
- this.pe.ce(e.Jt, t.type + "", u, f), t.batch.we(e), t.batch.Ce(u.$e, u.be);
474
+ this.pe.ce(e.Jt, t.type + "", u, f), t.batch.Ce(e), t.batch.we(u.$e, u.be);
475
475
  } finally {
476
476
  t.batch.xe(e), this.pe._e(), t.Me();
477
477
  }
@@ -509,11 +509,11 @@ class pt {
509
509
  const c = this.Pe(w.CUSTOM);
510
510
  return c.params.x = t, c.params.y = e, c.params.width = i, c.params.height = s, c.params.shader = r, c.params.uniforms = n, o.J(c.state), c.id;
511
511
  }
512
- De(t, e, i, s, r, n) {
512
+ Be(t, e, i, s, r, n) {
513
513
  const o = this.Pe(w.LINE);
514
514
  return o.params.x1 = t, o.params.y1 = e, o.params.x2 = i, o.params.y2 = s, o.params.thickness = r, n.J(o.state), o.id;
515
515
  }
516
- Be(t, e, i, s, r) {
516
+ De(t, e, i, s, r) {
517
517
  const n = this.Pe(w.ELLIPSE);
518
518
  return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = s, r.J(n.state), n.id;
519
519
  }
@@ -562,10 +562,10 @@ const P = class P {
562
562
  };
563
563
  a(P, "BYTES_PER_INSTANCE", 140), a(P, "FLOATS_PER_INSTANCE", 35);
564
564
  let M = P;
565
- const C = class C {
565
+ const A = class A {
566
566
  };
567
- a(C, "STRIDE", M.BYTES_PER_INSTANCE), a(C, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 132, divisor: 1 } });
568
- let X = C;
567
+ a(A, "STRIDE", M.BYTES_PER_INSTANCE), a(A, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: A.STRIDE, offset: 132, divisor: 1 } });
568
+ let X = A;
569
569
  class mt {
570
570
  constructor(t, e = 1e3, i = 1.5) {
571
571
  a(this, "vt");
@@ -623,7 +623,7 @@ class mt {
623
623
  }
624
624
  return e;
625
625
  }
626
- we(t) {
626
+ Ce(t) {
627
627
  if (!this.ss || this.Qe.length === 0) return;
628
628
  const e = this.vt, i = t.Jt;
629
629
  this.fs();
@@ -638,7 +638,7 @@ class mt {
638
638
  const e = this.vt, i = this.ds(t.Jt);
639
639
  for (const [, s] of i) e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 0);
640
640
  }
641
- Ce(t, e) {
641
+ we(t, e) {
642
642
  this.Qe.length !== 0 && this.vt.drawArraysInstanced(t, 0, e, this.Qe.length);
643
643
  }
644
644
  kt() {
@@ -655,7 +655,7 @@ class D {
655
655
  this.vt = t, this._s = e, this.ps = i, this.gs = s;
656
656
  const r = this.vt.createBuffer();
657
657
  if (!r) throw Error("Failed to create unit geometry buffer");
658
- this.vt.bindBuffer(this.vt.ARRAY_BUFFER, r), this.vt.bufferData(this.vt.ARRAY_BUFFER, this.gs.ws, this.vt.STATIC_DRAW), this.vt.bindBuffer(this.vt.ARRAY_BUFFER, null), this.vs = r;
658
+ this.vt.bindBuffer(this.vt.ARRAY_BUFFER, r), this.vt.bufferData(this.vt.ARRAY_BUFFER, this.gs.Cs, this.vt.STATIC_DRAW), this.vt.bindBuffer(this.vt.ARRAY_BUFFER, null), this.vs = r;
659
659
  }
660
660
  get type() {
661
661
  return this.ps;
@@ -678,7 +678,7 @@ class D {
678
678
  kt() {
679
679
  this._s.kt(), this.vt.deleteBuffer(this.vs);
680
680
  }
681
- Cs(t, e, i, s, r) {
681
+ ws(t, e, i, s, r) {
682
682
  const n = this.$s(t, e, i, s, r.H || 0, r.V || 0, r.K || 0);
683
683
  return { le: [t, e], Le: [i, s], j: r.j || [0, 0, 0], Y: r.Y || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], G: r.G || [0, 0], Ke: [r.k ? 1 : 0, r.N ? 1 : 0, r.X ? 1 : 0], H: n.radiansX, V: n.radiansY, K: n.radiansZ, Ne: [n.centerX, n.centerY] };
684
684
  }
@@ -695,27 +695,27 @@ class D {
695
695
  return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + s / 2) / u * 2, radiansX: -r * Math.PI / 180, radiansY: -n * Math.PI / 180, radiansZ: -o * Math.PI / 180, aspectRatio: l / u };
696
696
  }
697
697
  }
698
- const vt = { ws: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), be: 6, $e: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
698
+ const vt = { Cs: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), be: 6, $e: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
699
699
  class xt extends D {
700
700
  constructor(t, e) {
701
701
  super(t, e, w.RECTANGLE, vt);
702
702
  }
703
703
  Fe(t, e) {
704
- const i = this.Cs(t.x, t.y, t.width, t.height, e);
704
+ const i = this.ws(t.x, t.y, t.width, t.height, e);
705
705
  return this._s.Fe(i);
706
706
  }
707
707
  }
708
- const yt = { ws: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), be: 6, $e: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
708
+ const yt = { Cs: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), be: 6, $e: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
709
709
  class Et extends D {
710
710
  constructor(t, e) {
711
711
  super(t, e, w.LINE, yt);
712
712
  }
713
713
  Fe(t, e) {
714
- const i = t.x2 - t.x1, s = t.y2 - t.y1, r = Math.hypot(i, s), n = t.thickness || e.O || 1, o = t.x1 + i / 2, c = t.y1 + s / 2, l = o - r / 2, u = c, f = this.Cs(l, u, r, n, e);
714
+ const i = t.x2 - t.x1, s = t.y2 - t.y1, r = Math.hypot(i, s), n = t.thickness || e.O || 1, o = t.x1 + i / 2, c = t.y1 + s / 2, l = o - r / 2, u = c, f = this.ws(l, u, r, n, e);
715
715
  return this.Ms(f, o, c), this._s.Fe(f);
716
716
  }
717
717
  }
718
- const wt = { ws: function(h = 32) {
718
+ const wt = { Cs: function(h = 32) {
719
719
  const t = [], e = 2 * Math.PI / h;
720
720
  for (let i = 0; i < h; i++) {
721
721
  const s = i * e, r = (i + 1) % h * e, n = Math.cos(s), o = Math.sin(s), c = 0.5 * (n + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), g = 0.5 * (u + 1), v = 0.5 * (f + 1);
@@ -728,11 +728,11 @@ class Rt extends D {
728
728
  super(t, e, w.ELLIPSE, wt);
729
729
  }
730
730
  Fe(t, e) {
731
- const i = this.Cs(t.x, t.y, t.width, t.height, e);
731
+ const i = this.ws(t.x, t.y, t.width, t.height, e);
732
732
  return this.Ms(i, t.x, t.y), this._s.Fe(i);
733
733
  }
734
734
  }
735
- let bt = { ws: function(h) {
735
+ let bt = { Cs: function(h) {
736
736
  const t = [];
737
737
  for (let e = 0; e < h; e++) {
738
738
  const i = e / h, s = (e + 1) / h;
@@ -745,17 +745,17 @@ class Tt extends D {
745
745
  super(t, e, w.ARC, bt);
746
746
  }
747
747
  Fe(t, e) {
748
- const i = t.x - t.width / 2, s = t.y - t.height / 2, r = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.Cs(i, s, t.width, t.height, e);
748
+ const i = t.x - t.width / 2, s = t.y - t.height / 2, r = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.ws(i, s, t.width, t.height, e);
749
749
  return this.Ms(o, t.x, t.y), o.Xe = [r, n], this._s.Fe(o);
750
750
  }
751
751
  }
752
- const Ct = { ws: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), be: 3, $e: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
753
- class At extends D {
752
+ const At = { Cs: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), be: 3, $e: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
753
+ class Ct extends D {
754
754
  constructor(t, e) {
755
- super(t, e, w.TRIANGLE, Ct);
755
+ super(t, e, w.TRIANGLE, At);
756
756
  }
757
757
  Fe(t, e) {
758
- const i = Math.min(t.x1, t.x2, t.x3), s = Math.max(t.x1, t.x2, t.x3), r = Math.min(t.y1, t.y2, t.y3), n = s - i, o = Math.max(t.y1, t.y2, t.y3) - r, c = this.Cs(i, r, n, o, e), l = i + 0.5 * n, u = r + o * (1 / 3);
758
+ const i = Math.min(t.x1, t.x2, t.x3), s = Math.max(t.x1, t.x2, t.x3), r = Math.min(t.y1, t.y2, t.y3), n = s - i, o = Math.max(t.y1, t.y2, t.y3) - r, c = this.ws(i, r, n, o, e), l = i + 0.5 * n, u = r + o * (1 / 3);
759
759
  return this.Ms(c, l, u), this._s.Fe(c);
760
760
  }
761
761
  }
@@ -763,7 +763,7 @@ function et(h, t, e, i, s) {
763
763
  const r = 1 - h, n = r * r, o = h * h;
764
764
  return n * r * t + 3 * n * h * e + 3 * r * o * i + o * h * s;
765
765
  }
766
- const _t = { ws: function(h = 16) {
766
+ const _t = { Cs: function(h = 16) {
767
767
  const t = [];
768
768
  for (let e = 0; e < h; e++) {
769
769
  const i = e / h, s = (e + 1) / h;
@@ -776,7 +776,7 @@ class Ut extends D {
776
776
  super(t, e, w.BEZIER_CURVE, _t);
777
777
  }
778
778
  Fe(t, e) {
779
- const i = e.O || 1, s = et(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = et(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.Cs(0, 0, 1, i, e);
779
+ const i = e.O || 1, s = et(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = et(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.ws(0, 0, 1, i, e);
780
780
  return this.Ms(n, s, r), n.qe = [t.x1, t.y1], n.je = [t.cp1x, t.cp1y], n.Ye = [t.cp2x, t.cp2y], n.Ze = [t.x2, t.y2], this._s.Fe(n);
781
781
  }
782
782
  }
@@ -799,7 +799,7 @@ class Lt {
799
799
  let e = this.Ts.get(t);
800
800
  if (e) return e;
801
801
  const i = new mt(this.vt);
802
- return e = (0, { [w.RECTANGLE]: () => new xt(this.vt, i), [w.LINE]: () => new Et(this.vt, i), [w.ELLIPSE]: () => new Rt(this.vt, i), [w.ARC]: () => new Tt(this.vt, i), [w.TRIANGLE]: () => new At(this.vt, i), [w.BEZIER_CURVE]: () => new Ut(this.vt, i) }[t])(), this.Ts.set(t, e), e;
802
+ return e = (0, { [w.RECTANGLE]: () => new xt(this.vt, i), [w.LINE]: () => new Et(this.vt, i), [w.ELLIPSE]: () => new Rt(this.vt, i), [w.ARC]: () => new Tt(this.vt, i), [w.TRIANGLE]: () => new Ct(this.vt, i), [w.BEZIER_CURVE]: () => new Ut(this.vt, i) }[t])(), this.Ts.set(t, e), e;
803
803
  }
804
804
  Gs(t) {
805
805
  this.Rs !== t && (this.Rs = t, t.Vt());
@@ -819,13 +819,13 @@ class Lt {
819
819
  ne() {
820
820
  return this.Fs.ne();
821
821
  }
822
- Ds(t) {
822
+ Bs(t) {
823
823
  this.Ss = t, t && (this.As = {});
824
824
  }
825
825
  Xt(t, e) {
826
826
  this.As[t] = e;
827
827
  }
828
- Bs(t) {
828
+ Ds(t) {
829
829
  Object.assign(this.As, t);
830
830
  }
831
831
  oe(t) {
@@ -850,10 +850,10 @@ class Lt {
850
850
  this.Ss ? (this.Ls.Ge(t, e, i, s, this.Ss, { ...this.As }, this.Ps), this.Ss = null, this.As = {}) : this.Ls.ke(t, e, i, s, this.Ps);
851
851
  }
852
852
  Ks(t, e, i, s) {
853
- this.Ls.De(t, e, i, s, this.Ps.lineWeight, this.Ps);
853
+ this.Ls.Be(t, e, i, s, this.Ps.lineWeight, this.Ps);
854
854
  }
855
855
  Ns(t, e, i, s) {
856
- this.Ls.Be(t, e, i, s, this.Ps);
856
+ this.Ls.De(t, e, i, s, this.Ps);
857
857
  }
858
858
  Xs(t, e, i, s, r, n) {
859
859
  this.Ls.We(t, e, i, s, r, n, this.Ps);
@@ -1028,9 +1028,9 @@ function St(h) {
1028
1028
  } else {
1029
1029
  const d = r.readBits(5) + 257, x = r.readBits(5) + 1, p = r.readBits(4) + 4, E = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1030
1030
  for (let U = 0; U < p; U++) y[E[U]] = r.readBits(3);
1031
- const A = O(y), b = [];
1031
+ const C = O(y), b = [];
1032
1032
  for (; b.length < d + x; ) {
1033
- const U = V(r, A);
1033
+ const U = V(r, C);
1034
1034
  if (U <= 15) b.push(U);
1035
1035
  else if (U === 16) {
1036
1036
  const G = r.readBits(2) + 3, S = b[b.length - 1] || 0;
@@ -1061,10 +1061,10 @@ function St(h) {
1061
1061
  E && (p += r.readBits(E));
1062
1062
  const y = V(r, m);
1063
1063
  if (y >= 30) throw Error("Invalid distance symbol");
1064
- let A = l[y];
1064
+ let C = l[y];
1065
1065
  const b = u[y];
1066
- b && (A += r.readBits(b));
1067
- const T = n.length - A;
1066
+ b && (C += r.readBits(b));
1067
+ const T = n.length - C;
1068
1068
  if (T < 0) throw Error("Invalid distance");
1069
1069
  for (let L = 0; L < p; L++) n.push(n[T + L] || 0);
1070
1070
  } else if (d === 286 || d === 287) throw Error("Reserved length symbol");
@@ -1081,8 +1081,8 @@ function Bt(h) {
1081
1081
  const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), n = [];
1082
1082
  let o = 44;
1083
1083
  for (let p = 0; p < s; p++) {
1084
- const E = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), A = t.readUint(e, o + 8), b = t.readUint(e, o + 12), T = t.readUint(e, o + 16);
1085
- n.push({ tag: E, offset: y, compLength: A, origLength: b, checksum: T }), o += 20;
1084
+ const E = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), C = t.readUint(e, o + 8), b = t.readUint(e, o + 12), T = t.readUint(e, o + 16);
1085
+ n.push({ tag: E, offset: y, compLength: C, origLength: b, checksum: T }), o += 20;
1086
1086
  }
1087
1087
  for (const p of n) {
1088
1088
  const E = new Uint8Array(e.buffer, p.offset, p.compLength);
@@ -1108,8 +1108,8 @@ function Bt(h) {
1108
1108
  if (p.tag === "head" && E.length >= 12) {
1109
1109
  const y = new Uint8Array(E);
1110
1110
  t.writeUint(y, 8, 0);
1111
- const A = Y(y, 0, z(y.length));
1112
- t.writeUint(d, x, A), x += 4;
1111
+ const C = Y(y, 0, z(y.length));
1112
+ t.writeUint(d, x, C), x += 4;
1113
1113
  } else {
1114
1114
  const y = Y(E, 0, z(E.length));
1115
1115
  t.writeUint(d, x, y), x += 4;
@@ -1121,8 +1121,8 @@ function Bt(h) {
1121
1121
  d.set(p.data, E);
1122
1122
  }
1123
1123
  if (n.find((p) => p.tag === "head")) {
1124
- const p = m.head, E = function(y, A) {
1125
- const b = R, T = A + 8, L = [y[T], y[T + 1], y[T + 2], y[T + 3]];
1124
+ const p = m.head, E = function(y, C) {
1125
+ const b = R, T = C + 8, L = [y[T], y[T + 1], y[T + 2], y[T + 3]];
1126
1126
  b.writeUint(y, T, 0);
1127
1127
  const U = 2981146554 - (Y(y, 0, z(y.length)) >>> 0) >>> 0;
1128
1128
  return y[T] = L[0], y[T + 1] = L[1], y[T + 2] = L[2], y[T + 3] = L[3], U >>> 0;
@@ -1398,27 +1398,27 @@ class q {
1398
1398
  }
1399
1399
  class $t {
1400
1400
  constructor(t) {
1401
- a(this, "wi");
1402
1401
  a(this, "Ci");
1402
+ a(this, "wi");
1403
1403
  a(this, "xt");
1404
1404
  a(this, "$i");
1405
- this.xt = t, this.$i = new q(), this.wi = document.createElement("canvas"), this.Ci = this.wi.getContext("2d", { willReadFrequently: !0, alpha: !1 });
1405
+ this.xt = t, this.$i = new q(), this.Ci = document.createElement("canvas"), this.wi = this.Ci.getContext("2d", { willReadFrequently: !0, alpha: !1 });
1406
1406
  }
1407
1407
  createTextureAtlas(t, e, i, s) {
1408
1408
  const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), c = e.width * n, l = e.height * o, u = typeof s == "object" ? s : null;
1409
1409
  this.bi(c, l), this.xi(t, e, n, i, u);
1410
1410
  const f = this.xt.Ys(c, l, 1, { filter: "nearest" });
1411
- return f.At(this.wi), { framebuffer: f, columns: n, rows: o };
1411
+ return f.At(this.Ci), { framebuffer: f, columns: n, rows: o };
1412
1412
  }
1413
1413
  bi(t, e) {
1414
- this.wi.width = t, this.wi.height = e, this.wi.style.width = t + "px", this.wi.style.height = t + "px", this.Ci.imageSmoothingEnabled = !1, this.wi.style.imageRendering = "pixelated", this.Ci.fillStyle = "black", this.Ci.fillRect(0, 0, t, e), this.Ci.textBaseline = "top", this.Ci.textAlign = "left", this.Ci.fillStyle = "white";
1414
+ this.Ci.width = t, this.Ci.height = e, this.Ci.style.width = t + "px", this.Ci.style.height = t + "px", this.wi.imageSmoothingEnabled = !1, this.Ci.style.imageRendering = "pixelated", this.wi.fillStyle = "black", this.wi.fillRect(0, 0, t, e), this.wi.textBaseline = "top", this.wi.textAlign = "left", this.wi.fillStyle = "white";
1415
1415
  }
1416
1416
  xi(t, e, i, s, r) {
1417
1417
  const n = s / r.head.unitsPerEm;
1418
1418
  for (let o = 0; o < t.length; o++) {
1419
1419
  const c = o % i, l = Math.floor(o / i), u = t[o].character, f = this.Mi(r, u);
1420
1420
  if (!f) continue;
1421
- const g = u.codePointAt(0) || 0, v = this.$i.ui(r, g), m = this.Ri(r, v) * n, d = c * e.width, x = l * e.height, p = d + 0.5 * e.width, E = x + 0.5 * e.height, y = Math.round(p - 0.5 * e.width), A = Math.round(E - 0.5 * s), b = y + 0.5 * (e.width - m), T = A + r.hhea.ascender * n;
1421
+ const g = u.codePointAt(0) || 0, v = this.$i.ui(r, g), m = this.Ri(r, v) * n, d = c * e.width, x = l * e.height, p = d + 0.5 * e.width, E = x + 0.5 * e.height, y = Math.round(p - 0.5 * e.width), C = Math.round(E - 0.5 * s), b = y + 0.5 * (e.width - m), T = C + r.hhea.ascender * n;
1422
1422
  this.Fi(f, b, T, n);
1423
1423
  }
1424
1424
  }
@@ -1440,39 +1440,39 @@ class $t {
1440
1440
  if (!t || !t.xs || t.noc === 0) return;
1441
1441
  const { xs: r, ys: n, endPts: o, flags: c } = t;
1442
1442
  if (!(r && n && o && c)) return;
1443
- this.Ci.beginPath();
1443
+ this.wi.beginPath();
1444
1444
  let l = 0;
1445
1445
  for (let u = 0; u < o.length; u++) {
1446
1446
  const f = o[u];
1447
1447
  if (!(f < l)) {
1448
1448
  if (f >= l) {
1449
1449
  const g = e + r[l] * s, v = i - n[l] * s;
1450
- this.Ci.moveTo(g, v);
1450
+ this.wi.moveTo(g, v);
1451
1451
  let m = l + 1;
1452
1452
  for (; m <= f; )
1453
1453
  if (1 & c[m]) {
1454
1454
  const d = e + r[m] * s, x = i - n[m] * s;
1455
- this.Ci.lineTo(d, x), m++;
1455
+ this.wi.lineTo(d, x), m++;
1456
1456
  } else {
1457
1457
  const d = e + r[m] * s, x = i - n[m] * s;
1458
1458
  let p = m + 1 > f ? l : m + 1;
1459
1459
  if (1 & c[p]) {
1460
1460
  const E = e + r[p] * s, y = i - n[p] * s;
1461
- this.Ci.quadraticCurveTo(d, x, E, y), m = p + 1;
1461
+ this.wi.quadraticCurveTo(d, x, E, y), m = p + 1;
1462
1462
  } else {
1463
1463
  const E = (d + (e + r[p] * s)) / 2, y = (x + (i - n[p] * s)) / 2;
1464
- this.Ci.quadraticCurveTo(d, x, E, y), m = p;
1464
+ this.wi.quadraticCurveTo(d, x, E, y), m = p;
1465
1465
  }
1466
1466
  }
1467
- this.Ci.closePath();
1467
+ this.wi.closePath();
1468
1468
  }
1469
1469
  l = f + 1;
1470
1470
  }
1471
1471
  }
1472
- this.Ci.fill();
1472
+ this.wi.fill();
1473
1473
  }
1474
1474
  }
1475
- class Nt {
1475
+ class kt {
1476
1476
  constructor() {
1477
1477
  a(this, "Si");
1478
1478
  this.Si = new q();
@@ -1492,7 +1492,7 @@ class Nt {
1492
1492
  this.Si.yi();
1493
1493
  }
1494
1494
  }
1495
- class kt {
1495
+ class Nt {
1496
1496
  constructor() {
1497
1497
  a(this, "$i");
1498
1498
  this.$i = new q();
@@ -1526,15 +1526,15 @@ class zt {
1526
1526
  a(this, "Pi", []);
1527
1527
  a(this, "ki");
1528
1528
  a(this, "Gi", 16);
1529
- a(this, "Di", 0);
1530
1529
  a(this, "Bi", 0);
1530
+ a(this, "Di", 0);
1531
1531
  a(this, "Ii", { width: 0, height: 0 });
1532
1532
  a(this, "Wi");
1533
1533
  a(this, "Oi");
1534
1534
  a(this, "Hi");
1535
1535
  a(this, "Vi");
1536
1536
  a(this, "Ki");
1537
- this.Gi = e, this.Oi = new Ot(), this.Hi = new $t(t), this.Vi = new Nt(), this.Ki = new kt();
1537
+ this.Gi = e, this.Oi = new Ot(), this.Hi = new $t(t), this.Vi = new kt(), this.Ki = new Nt();
1538
1538
  }
1539
1539
  async Ni(t) {
1540
1540
  let e;
@@ -1550,7 +1550,7 @@ class zt {
1550
1550
  if (t === void 0) return this.Gi;
1551
1551
  this.Gi = t, this.Ii = this.Vi.Ai(this.Pi.map((i) => i.character), this.Gi, this.Li);
1552
1552
  const e = this.Hi.createTextureAtlas(this.Pi, this.Ii, this.Gi, this.Li);
1553
- this.ki = e.framebuffer, this.Di = e.columns, this.Bi = e.rows;
1553
+ this.ki = e.framebuffer, this.Bi = e.columns, this.Di = e.rows;
1554
1554
  }
1555
1555
  async qi(t) {
1556
1556
  try {
@@ -1573,7 +1573,7 @@ class zt {
1573
1573
  const t = this.Oi.ii(this.Li), e = this.Oi.oi(t);
1574
1574
  this.Pi = this.Ki.createCharacterObjects(e, this.Li), this.Ii = this.Vi.Ai(e, this.Gi, this.Li);
1575
1575
  const i = this.Hi.createTextureAtlas(this.Pi, this.Ii, this.Gi, this.Li);
1576
- this.ki = i.framebuffer, this.Di = i.columns, this.Bi = i.rows;
1576
+ this.ki = i.framebuffer, this.Bi = i.columns, this.Di = i.rows;
1577
1577
  }
1578
1578
  Ti(t) {
1579
1579
  return this.Ki.Ti(t, this.Pi);
@@ -1591,10 +1591,10 @@ class zt {
1591
1591
  return this.Pi;
1592
1592
  }
1593
1593
  get textureColumns() {
1594
- return this.Di;
1594
+ return this.Bi;
1595
1595
  }
1596
1596
  get textureRows() {
1597
- return this.Bi;
1597
+ return this.Di;
1598
1598
  }
1599
1599
  get maxGlyphDimensions() {
1600
1600
  return this.Ii;
@@ -1732,7 +1732,7 @@ class Ht {
1732
1732
  return this.er.height;
1733
1733
  }
1734
1734
  }
1735
- class N {
1735
+ class k {
1736
1736
  constructor(t, e, i, s) {
1737
1737
  a(this, "vr");
1738
1738
  a(this, "dt");
@@ -1743,10 +1743,10 @@ class N {
1743
1743
  a(this, "X", 0);
1744
1744
  a(this, "G", [0, 0]);
1745
1745
  a(this, "yr", "sampled");
1746
- a(this, "wr", "fixed");
1746
+ a(this, "Cr", "fixed");
1747
1747
  a(this, "Y", [1, 1, 1]);
1748
1748
  a(this, "q", [0, 0, 0]);
1749
- a(this, "Cr", [0, 0, 0, 1]);
1749
+ a(this, "wr", [0, 0, 0, 1]);
1750
1750
  a(this, "$r", [[0.1, 0, 0]]);
1751
1751
  a(this, "br");
1752
1752
  this.vt = t, this.vr = e, this.dt = i, this._t = s;
@@ -1771,13 +1771,13 @@ class N {
1771
1771
  return this.G = [i, s], this;
1772
1772
  }
1773
1773
  Os() {
1774
- return { texture: this.vr, invert: this.k, flipX: this.N, flipY: this.X, charRotation: this.G, charColorFixed: this.yr === "fixed", charColor: this.Y, cellColorFixed: this.wr === "fixed", cellColor: this.q, backgroundColor: this.Cr, charCount: this.$r.length, charList: this.$r };
1774
+ return { texture: this.vr, invert: this.k, flipX: this.N, flipY: this.X, charRotation: this.G, charColorFixed: this.yr === "fixed", charColor: this.Y, cellColorFixed: this.Cr === "fixed", cellColor: this.q, backgroundColor: this.wr, charCount: this.$r.length, charList: this.$r };
1775
1775
  }
1776
1776
  charColorMode(t) {
1777
1777
  return this.yr = t, this;
1778
1778
  }
1779
1779
  cellColorMode(t) {
1780
- return this.wr = t, this;
1780
+ return this.Cr = t, this;
1781
1781
  }
1782
1782
  charColor(t, e, i) {
1783
1783
  return this.Y = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255], this;
@@ -1786,7 +1786,7 @@ class N {
1786
1786
  return this.q = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255], this;
1787
1787
  }
1788
1788
  background(t, e, i, s) {
1789
- return this.Cr = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
1789
+ return this.wr = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
1790
1790
  }
1791
1791
  characters(t) {
1792
1792
  const e = this.br(t).filter((i) => Array.isArray(i)).slice(0, 64);
@@ -1795,7 +1795,7 @@ class N {
1795
1795
  static Rr(t, e, i) {
1796
1796
  const s = t.context, r = s.createTexture();
1797
1797
  s.bindTexture(s.TEXTURE_2D, r), s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, 1), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), s.texImage2D(s.TEXTURE_2D, 0, s.RGBA, s.RGBA, s.UNSIGNED_BYTE, e), s.bindTexture(s.TEXTURE_2D, null);
1798
- const n = e.naturalWidth ?? e.width ?? e.videoWidth ?? 0, o = e.naturalHeight ?? e.height ?? e.videoHeight ?? 0, c = new N(s, r, n, o);
1798
+ const n = e.naturalWidth ?? e.width ?? e.videoWidth ?? 0, o = e.naturalHeight ?? e.height ?? e.videoHeight ?? 0, c = new k(s, r, n, o);
1799
1799
  return c.br = i, c;
1800
1800
  }
1801
1801
  get texture() {
@@ -1879,8 +1879,8 @@ class Xt {
1879
1879
  }
1880
1880
  class Yt {
1881
1881
  constructor() {
1882
- a(this, "Dr", /* @__PURE__ */ new Map());
1883
- a(this, "Br", null);
1882
+ a(this, "Br", /* @__PURE__ */ new Map());
1883
+ a(this, "Dr", null);
1884
1884
  a(this, "Ir", null);
1885
1885
  a(this, "Wr");
1886
1886
  a(this, "Or");
@@ -1897,7 +1897,7 @@ class Yt {
1897
1897
  }, window.addEventListener("keydown", this.Wr, { passive: !1 }), window.addEventListener("keyup", this.Or, { passive: !1 }), this.Hr = !0);
1898
1898
  }
1899
1899
  qr() {
1900
- this.Hr && (window.removeEventListener("keydown", this.Wr), window.removeEventListener("keyup", this.Or), this.Hr = !1, this.Dr.clear(), this.Br = null, this.Ir = null);
1900
+ this.Hr && (window.removeEventListener("keydown", this.Wr), window.removeEventListener("keyup", this.Or), this.Hr = !1, this.Br.clear(), this.Dr = null, this.Ir = null);
1901
1901
  }
1902
1902
  Zr(t) {
1903
1903
  this.Vr = t;
@@ -1906,39 +1906,39 @@ class Yt {
1906
1906
  this.Kr = t;
1907
1907
  }
1908
1908
  Qr(t) {
1909
- const e = this.tn(t), i = this.Dr.get(t) || this.Dr.get(e);
1909
+ const e = this.tn(t), i = this.Br.get(t) || this.Br.get(e);
1910
1910
  return (i == null ? void 0 : i.isPressed) || !1;
1911
1911
  }
1912
1912
  en() {
1913
- return this.Br;
1913
+ return this.Dr;
1914
1914
  }
1915
1915
  sn() {
1916
1916
  return this.Ir;
1917
1917
  }
1918
1918
  rn() {
1919
1919
  const t = [];
1920
- for (const [e, i] of this.Dr) i.isPressed && t.push(e);
1920
+ for (const [e, i] of this.Br) i.isPressed && t.push(e);
1921
1921
  return t;
1922
1922
  }
1923
1923
  nn() {
1924
1924
  return { ctrl: this.Qr("Control"), shift: this.Qr("Shift"), alt: this.Qr("Alt"), meta: this.Qr("Meta") };
1925
1925
  }
1926
1926
  an() {
1927
- this.Dr.clear(), this.Br = null, this.Ir = null;
1927
+ this.Br.clear(), this.Dr = null, this.Ir = null;
1928
1928
  }
1929
1929
  jr(t) {
1930
1930
  const e = t.key, i = Date.now();
1931
- this.Dr.has(e) || this.Dr.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
1932
- const s = this.Dr.get(e);
1933
- if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Br = e, this.Vr)) {
1931
+ this.Br.has(e) || this.Br.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
1932
+ const s = this.Br.get(e);
1933
+ if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Dr = e, this.Vr)) {
1934
1934
  const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
1935
1935
  this.Vr(r);
1936
1936
  }
1937
1937
  }
1938
1938
  Yr(t) {
1939
1939
  const e = t.key, i = Date.now();
1940
- this.Dr.has(e) || this.Dr.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
1941
- const s = this.Dr.get(e);
1940
+ this.Br.has(e) || this.Br.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
1941
+ const s = this.Br.get(e);
1942
1942
  if (s.isPressed = !1, s.lastReleaseTime = i, this.Ir = e, this.Kr) {
1943
1943
  const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
1944
1944
  this.Kr(r);
@@ -1964,8 +1964,8 @@ class Vt {
1964
1964
  a(this, "Hr", !1);
1965
1965
  a(this, "vn");
1966
1966
  a(this, "yn");
1967
- a(this, "wn");
1968
1967
  a(this, "Cn");
1968
+ a(this, "wn");
1969
1969
  a(this, "$n");
1970
1970
  this.er = t;
1971
1971
  }
@@ -2011,10 +2011,10 @@ class Vt {
2011
2011
  this.yn = t;
2012
2012
  }
2013
2013
  Jr(t) {
2014
- this.wn = t;
2014
+ this.Cn = t;
2015
2015
  }
2016
2016
  Tn(t) {
2017
- this.Cn = t;
2017
+ this.wn = t;
2018
2018
  }
2019
2019
  En(t) {
2020
2020
  this.$n = t;
@@ -2023,9 +2023,9 @@ class Vt {
2023
2023
  return { x: this.cn.x, y: this.cn.y };
2024
2024
  }
2025
2025
  Mn(t) {
2026
- if (this.Cn) {
2026
+ if (this.wn) {
2027
2027
  const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, originalEvent: t };
2028
- this.Cn(e);
2028
+ this.wn(e);
2029
2029
  }
2030
2030
  }
2031
2031
  Rn(t) {
@@ -2035,9 +2035,9 @@ class Vt {
2035
2035
  }
2036
2036
  }
2037
2037
  Fn(t) {
2038
- if (this.wn) {
2038
+ if (this.Cn) {
2039
2039
  const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, button: t.button, originalEvent: t };
2040
- this.wn(e);
2040
+ this.Cn(e);
2041
2041
  }
2042
2042
  }
2043
2043
  Sn(t) {
@@ -2130,13 +2130,13 @@ const Kt = (h) => class extends h {
2130
2130
  this.xt.qs(t, e, i, s, r, n);
2131
2131
  }
2132
2132
  shader(t) {
2133
- this.xt.Ds(t);
2133
+ this.xt.Bs(t);
2134
2134
  }
2135
2135
  setUniform(t, e) {
2136
2136
  this.xt.Xt(t, e);
2137
2137
  }
2138
2138
  setUniforms(t) {
2139
- this.xt.Bs(t);
2139
+ this.xt.Ds(t);
2140
2140
  }
2141
2141
  createFilterShader(t) {
2142
2142
  return this.xt.oe(t);
@@ -2154,12 +2154,12 @@ const Kt = (h) => class extends h {
2154
2154
  }
2155
2155
  }
2156
2156
  async loadImage(t) {
2157
- if (typeof t != "string") return N.Rr(this.xt, t, (s) => this.Li.Ei(s));
2157
+ if (typeof t != "string") return k.Rr(this.xt, t, (s) => this.Li.Ei(s));
2158
2158
  const e = t, i = await new Promise((s, r) => {
2159
2159
  const n = new Image();
2160
2160
  n.crossOrigin = "anonymous", n.onload = () => s(n), n.onerror = (o) => r(o), n.src = e;
2161
2161
  });
2162
- return N.Rr(this.xt, i, (s) => this.Li.Ei(s));
2162
+ return k.Rr(this.xt, i, (s) => this.Li.Ei(s));
2163
2163
  }
2164
2164
  };
2165
2165
  class J {
@@ -2175,12 +2175,12 @@ class J {
2175
2175
  }
2176
2176
  }
2177
2177
  class Q {
2178
- Dn(t, e) {
2178
+ Bn(t, e) {
2179
2179
  return new Blob([t], { type: e });
2180
2180
  }
2181
- Bn(t, e, i) {
2181
+ Dn(t, e, i) {
2182
2182
  try {
2183
- const s = this.Dn(t, i), r = URL.createObjectURL(s), n = document.createElement("a");
2183
+ const s = this.Bn(t, i), r = URL.createObjectURL(s), n = document.createElement("a");
2184
2184
  n.href = r, n.download = e, n.style.display = "none", n.rel = "noopener", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r);
2185
2185
  } catch (s) {
2186
2186
  console.error("Failed to download file:", s);
@@ -2273,11 +2273,11 @@ class qt {
2273
2273
  const x = e + r[d] * s, p = i - n[d] * s;
2274
2274
  let E = d + 1 > g ? u : d + 1;
2275
2275
  if (1 & c[E]) {
2276
- const y = e + r[E] * s, A = i - n[E] * s;
2277
- l += `Q${x.toFixed(2)},${p.toFixed(2)} ${y.toFixed(2)},${A.toFixed(2)}`, d = E + 1;
2276
+ const y = e + r[E] * s, C = i - n[E] * s;
2277
+ l += `Q${x.toFixed(2)},${p.toFixed(2)} ${y.toFixed(2)},${C.toFixed(2)}`, d = E + 1;
2278
2278
  } else {
2279
- const y = (x + (e + r[E] * s)) / 2, A = (p + (i - n[E] * s)) / 2;
2280
- l += `Q${x.toFixed(2)},${p.toFixed(2)} ${y.toFixed(2)},${A.toFixed(2)}`, d = E;
2279
+ const y = (x + (e + r[E] * s)) / 2, C = (p + (i - n[E] * s)) / 2;
2280
+ l += `Q${x.toFixed(2)},${p.toFixed(2)} ${y.toFixed(2)},${C.toFixed(2)}`, d = E;
2281
2281
  }
2282
2282
  }
2283
2283
  l += "Z";
@@ -2358,10 +2358,10 @@ class Jt {
2358
2358
  }
2359
2359
  class Qt extends Q {
2360
2360
  ho(t) {
2361
- return this.Dn(t, "image/svg+xml;charset=utf-8");
2361
+ return this.Bn(t, "image/svg+xml;charset=utf-8");
2362
2362
  }
2363
2363
  co(t, e) {
2364
- this.Bn(t, this.On(e) + ".svg", "image/svg+xml;charset=utf-8");
2364
+ this.Dn(t, this.On(e) + ".svg", "image/svg+xml;charset=utf-8");
2365
2365
  }
2366
2366
  lo(t, e) {
2367
2367
  this.co(t, e || this.Hn());
@@ -2416,10 +2416,10 @@ class te {
2416
2416
  }
2417
2417
  class ee extends Q {
2418
2418
  yo(t, e) {
2419
- const i = this.wo(e);
2420
- this.Bn(t, i, "text/plain;charset=utf-8");
2419
+ const i = this.Co(e);
2420
+ this.Dn(t, i, "text/plain;charset=utf-8");
2421
2421
  }
2422
- wo(t) {
2422
+ Co(t) {
2423
2423
  let e = this.On(t);
2424
2424
  return e === ".txt" || e.length <= 4 ? this.Hn() : e;
2425
2425
  }
@@ -2434,12 +2434,12 @@ class rt {
2434
2434
  _o(t) {
2435
2435
  return { preserveTrailingSpaces: t.preserveTrailingSpaces ?? !1, lineEnding: t.lineEnding ?? "lf", emptyCharacter: t.emptyCharacter ?? " ", filename: t.filename || this.do.Hn() };
2436
2436
  }
2437
- Co(t, e = {}) {
2437
+ wo(t, e = {}) {
2438
2438
  const i = this._o(e), s = this.uo.mo(this.uo.Pn(t.pipeline), t.grid, t.font, i.emptyCharacter);
2439
2439
  return this.fo.vo(s, i);
2440
2440
  }
2441
2441
  yo(t, e = {}) {
2442
- this.do.yo(this.Co(t, e), e.filename);
2442
+ this.do.yo(this.wo(t, e), e.filename);
2443
2443
  }
2444
2444
  }
2445
2445
  class ie extends J {
@@ -2527,7 +2527,7 @@ const he = (h) => class extends h {
2527
2527
  this.xt.Et(this.To);
2528
2528
  }
2529
2529
  toString(t = {}) {
2530
- return this.zo(), new rt().Co({ pipeline: this.Eo, grid: this.hn, font: this.Li }, t);
2530
+ return this.zo(), new rt().wo({ pipeline: this.Eo, grid: this.hn, font: this.Li }, t);
2531
2531
  }
2532
2532
  saveStrings(t = {}) {
2533
2533
  this.zo(), new rt().yo({ pipeline: this.Eo, grid: this.hn, font: this.Li }, t);
@@ -2641,8 +2641,8 @@ class fe {
2641
2641
  a(this, "Go");
2642
2642
  a(this, "To");
2643
2643
  a(this, "Eo");
2644
- a(this, "Do");
2645
2644
  a(this, "Bo");
2645
+ a(this, "Do");
2646
2646
  a(this, "Io");
2647
2647
  }
2648
2648
  ko() {
@@ -2664,12 +2664,12 @@ class de extends function(e, ...i) {
2664
2664
  a(this, "cr");
2665
2665
  a(this, "hr", !1);
2666
2666
  a(this, "No");
2667
- this.hr = e.overlay ?? !1, this.er = new Ht(e), this.xt = new Lt(this.er.gr()), this.Li = new zt(this.xt, e.fontSize ?? 16), this.Po = new Xt(e.frameRate ?? 60), this.Lo = new Vt(this.er), this.Go = new Yt(), this.To = this.xt.Tt(), this.Do = this.xt.re(), this.Xo(e);
2667
+ this.hr = e.overlay ?? !1, this.er = new Ht(e), this.xt = new Lt(this.er.gr()), this.Li = new zt(this.xt, e.fontSize ?? 16), this.Po = new Xt(e.frameRate ?? 60), this.Lo = new Vt(this.er), this.Go = new Yt(), this.To = this.xt.Tt(), this.Bo = this.xt.re(), this.Xo(e);
2668
2668
  }
2669
2669
  async Xo(e) {
2670
2670
  await this.Li.Ni(e.fontSource);
2671
2671
  const i = this.Li.maxGlyphDimensions;
2672
- this.hn = new Wt(this.er.canvas, i.width, i.height), this.Lo.Ni(this.hn), this.Eo = this.xt.Ys(this.hn.cols, this.hn.rows, 5), this.Bo = this.xt.Ys(this.hn.width, this.hn.height, 1), this.hr && (this.No = N.Rr(this.xt, this.er.targetCanvas, (s) => this.Li.Ei(s))), this.Io = this.xt.ae(at, "precision mediump float;uniform sampler2D Ua;uniform vec2 Ub;uniform vec2 Uc;uniform vec2 Ud;void main(){vec2 A=gl_FragCoord.xy-Uc;vec2 B=A*(Ub/Ud);vec2 C=(floor(B)+0.5)/Ub;gl_FragColor=texture2D(Ua,C);}"), this.jo(), this.Oo(), this.Po.start(() => this.ko());
2672
+ this.hn = new Wt(this.er.canvas, i.width, i.height), this.Lo.Ni(this.hn), this.Eo = this.xt.Ys(this.hn.cols, this.hn.rows, 5), this.Do = this.xt.Ys(this.hn.width, this.hn.height, 1), this.hr && (this.No = k.Rr(this.xt, this.er.targetCanvas, (s) => this.Li.Ei(s))), this.Io = this.xt.ae(at, "precision mediump float;uniform sampler2D Ua;uniform vec2 Ub;uniform vec2 Uc;uniform vec2 Ud;void main(){vec2 A=gl_FragCoord.xy-Uc;vec2 B=A*(Ub/Ud);vec2 C=(floor(B)+0.5)/Ub;gl_FragColor=texture2D(Ua,C);}"), this.jo(), this.Oo(), this.Po.start(() => this.ko());
2673
2673
  }
2674
2674
  jo() {
2675
2675
  this.Ko = () => {
@@ -2686,9 +2686,9 @@ class de extends function(e, ...i) {
2686
2686
  const i = this.xt.context;
2687
2687
  i.bindTexture(i.TEXTURE_2D, this.No.texture), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, 1), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.er.targetCanvas), i.bindTexture(i.TEXTURE_2D, null);
2688
2688
  }
2689
- this.Eo.begin(), this.xt.Gs(this.To), this.Ho(), this.xt.Et(this.To), this.Eo.end(), this.Bo.begin(), this.xt.Gs(this.Do), this.Do.Nt({ U0: this.Li.fontFramebuffer, U1: [this.Li.textureColumns, this.Li.textureRows], U2: this.Eo.textures[0], U3: this.Eo.textures[1], U4: this.Eo.textures[2], U5: this.Eo.textures[4], U6: this.Eo.textures[3], U7: [this.hn.cols, this.hn.rows], U8: [this.Bo.width, this.Bo.height], U9: this.Bo.width / this.Bo.height }), this.xt.Hs(0, 0, this.er.width, this.er.height), this.Bo.end();
2689
+ this.Eo.begin(), this.xt.Gs(this.To), this.Ho(), this.xt.Et(this.To), this.Eo.end(), this.Do.begin(), this.xt.Gs(this.Bo), this.Bo.Nt({ U0: this.Li.fontFramebuffer, U1: [this.Li.textureColumns, this.Li.textureRows], U2: this.Eo.textures[0], U3: this.Eo.textures[1], U4: this.Eo.textures[2], U5: this.Eo.textures[4], U6: this.Eo.textures[3], U7: [this.hn.cols, this.hn.rows], U8: [this.Do.width, this.Do.height], U9: this.Do.width / this.Do.height }), this.xt.Hs(0, 0, this.er.width, this.er.height), this.Do.end();
2690
2690
  const e = this.xt.state.canvasBackgroundColor;
2691
- this.xt.He(e[0], e[1], e[2], e[3]), this.xt.Gs(this.Io), this.Io.Nt({ Ua: this.Bo.textures[0], Ub: [this.Bo.width, this.Bo.height], Uc: [this.hn.offsetX, this.hn.offsetY], Ud: [this.hn.width, this.hn.height] }), this.xt.Hs(this.hn.offsetX, this.hn.offsetY, this.hn.width, this.hn.height);
2691
+ this.xt.He(e[0], e[1], e[2], e[3]), this.xt.Gs(this.Io), this.Io.Nt({ Ua: this.Do.textures[0], Ub: [this.Do.width, this.Do.height], Uc: [this.hn.offsetX, this.hn.offsetY], Ud: [this.hn.width, this.hn.height] }), this.xt.Hs(this.hn.offsetX, this.hn.offsetY, this.hn.width, this.hn.height);
2692
2692
  }
2693
2693
  setup(e) {
2694
2694
  this.Oo = e;
@@ -2700,10 +2700,10 @@ class de extends function(e, ...i) {
2700
2700
  this.Vo = e;
2701
2701
  }
2702
2702
  resizeCanvas(e, i) {
2703
- this.er.mr(e, i), this.hn.rr(), this.Eo.resize(this.hn.cols, this.hn.rows), this.Bo.resize(this.hn.width, this.hn.height), this.xt.Js(), this.Lo.bn(), this.ko();
2703
+ this.er.mr(e, i), this.hn.rr(), this.Eo.resize(this.hn.cols, this.hn.rows), this.Do.resize(this.hn.width, this.hn.height), this.xt.Js(), this.Lo.bn(), this.ko();
2704
2704
  }
2705
2705
  destroy() {
2706
- this.Wo || (this.Po.stop(), window.removeEventListener("resize", this.Ko), this.Lo.qr(), this.Go.qr(), this.Li.kt(), this.xt.kt(), this.Bo.kt(), this.Io.kt(), this.No && this.No.kt(), this.Wo = !0);
2706
+ this.Wo || (this.Po.stop(), window.removeEventListener("resize", this.Ko), this.Lo.qr(), this.Go.qr(), this.Li.kt(), this.xt.kt(), this.Do.kt(), this.Io.kt(), this.No && this.No.kt(), this.Wo = !0);
2707
2707
  }
2708
2708
  get grid() {
2709
2709
  return this.hn;
@@ -2737,7 +2737,7 @@ class Z {
2737
2737
  $.C(t);
2738
2738
  }
2739
2739
  static get version() {
2740
- return "0.2.1-beta.7";
2740
+ return "0.3.0";
2741
2741
  }
2742
2742
  }
2743
2743
  const pe = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), me = Z.create, ve = Z.setErrorLevel, xe = Z.version;
@@ -2747,7 +2747,7 @@ export {
2747
2747
  zt as TextmodeFont,
2748
2748
  j as TextmodeFramebuffer,
2749
2749
  Wt as TextmodeGrid,
2750
- N as TextmodeImage,
2750
+ k as TextmodeImage,
2751
2751
  de as Textmodifier,
2752
2752
  me as create,
2753
2753
  pe as export,