@vincentt-xr/sdk 2.0.0-alpha.11 → 2.0.0-alpha.12

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.
@@ -1,39 +1,19 @@
1
- import { jsx as z, jsxs as xe } from "react/jsx-runtime";
2
- import { useMemo as B, useSyncExternalStore as Ce, forwardRef as Le, useEffect as me, useState as he, useRef as U } from "react";
3
- import { useThree as Oe } from "@react-three/fiber";
1
+ import { jsx as z, jsxs as Te } from "react/jsx-runtime";
2
+ import { useMemo as B, forwardRef as xe, useEffect as be, useState as he, useRef as J } from "react";
3
+ import { useThree as Ce } from "@react-three/fiber";
4
4
  import { b as Fe } from "./context-DTxSQvp4.js";
5
+ import { u as Le } from "./useEditOverrides-BTkPGVjN.js";
5
6
  import * as We from "three";
6
- const it = ({ children: t, depth: e = 0 }) => {
7
- const { camera: n, size: i } = Oe(), a = B(() => {
7
+ const et = ({ children: t, depth: e = 0 }) => {
8
+ const { camera: n, size: i } = Ce(), a = B(() => {
8
9
  if (!n.isPerspectiveCamera)
9
10
  return { width: 10, height: 10 };
10
11
  const r = n, l = Math.abs(r.position.z - e), f = r.fov * Math.PI / 180, s = 2 * Math.tan(f / 2) * l;
11
12
  return { width: s * (i.width / i.height), height: s };
12
13
  }, [n, i, e]);
13
14
  return /* @__PURE__ */ z(Fe.Provider, { value: a, children: /* @__PURE__ */ z("group", { position: [0, 0, e], children: t }) });
14
- }, Ye = "__VCT_EDIT_OVERRIDES__";
15
- function ke() {
16
- const t = globalThis[Ye];
17
- return t && typeof t.subscribe == "function" && typeof t.version == "function" && typeof t.get == "function" ? t : void 0;
18
- }
19
- const Pe = () => () => {
20
- }, ce = () => 0;
21
- function He(t, e) {
22
- const n = ke();
23
- if (Ce(
24
- n ? n.subscribe : Pe,
25
- n ? n.version : ce,
26
- ce
27
- ), !n) return t;
28
- const i = n.get(t);
29
- if (!i) return t;
30
- let a = null;
31
- for (const r of e)
32
- Object.prototype.hasOwnProperty.call(i, r) && (a ?? (a = { ...t }), a[r] = i[r]);
33
- return a ?? t;
34
- }
35
- const Se = Le(
36
- ({ texture: t, name: e, overlay: n, opacity: i, position: a, rotation: r, scale: l, visible: f, renderOrder: s }, h) => /* @__PURE__ */ xe(
15
+ }, me = xe(
16
+ ({ texture: t, name: e, overlay: n, opacity: i, position: a, rotation: r, scale: l, visible: f, renderOrder: s }, h) => /* @__PURE__ */ Te(
37
17
  "mesh",
38
18
  {
39
19
  ref: h,
@@ -59,8 +39,8 @@ const Se = Le(
59
39
  }
60
40
  )
61
41
  );
62
- Se.displayName = "TextLabelMesh";
63
- const Xe = {
42
+ me.displayName = "TextLabelMesh";
43
+ const Oe = {
64
44
  color: "#ffffff",
65
45
  strokeWidth: 0,
66
46
  strokeOpacity: 1,
@@ -94,24 +74,24 @@ const Xe = {
94
74
  strikethrough: !1,
95
75
  bendPreset: "arc",
96
76
  bendStrength: 0
97
- }, Ae = (t) => {
98
- me(
77
+ }, Ye = (t) => {
78
+ be(
99
79
  () => () => {
100
80
  t == null || t.dispose();
101
81
  },
102
82
  [t]
103
83
  );
104
84
  };
105
- function pe(t, e, n) {
85
+ function ke(t, e, n) {
106
86
  return n === "left" ? e : n === "right" ? t - e : t / 2;
107
87
  }
108
- function Be(t, e, n, i, a) {
88
+ function Pe(t, e, n, i, a) {
109
89
  return a === "top" ? e + n / 2 : a === "bottom" ? t - e - i + n / 2 : t / 2 - (i - n) / 2;
110
90
  }
111
- function ze(t, e, n, i) {
91
+ function He(t, e, n, i) {
112
92
  return i === "full" || n === "left" ? 0 : n === "right" ? t - e : (t - e) / 2;
113
93
  }
114
- function ye(t, e, n, i) {
94
+ function Se(t, e, n, i) {
115
95
  return `${t} ${e} ${n}px ${i}`;
116
96
  }
117
97
  function I(t, e) {
@@ -122,30 +102,30 @@ function we(t, e) {
122
102
  const n = Math.max(0, Math.min(e, 1));
123
103
  return t * (1.2 + n * 0.6);
124
104
  }
125
- function ve(t, e) {
105
+ function ye(t, e) {
126
106
  "letterSpacing" in t && (t.letterSpacing = `${e}px`);
127
107
  }
128
- function Te(t) {
108
+ function ve(t) {
129
109
  "letterSpacing" in t && (t.letterSpacing = "0px");
130
110
  }
131
111
  function H(t, e, n) {
132
- ve(t, n);
112
+ ye(t, n);
133
113
  const i = t.measureText(e).width;
134
- return Te(t), i;
114
+ return ve(t), i;
135
115
  }
136
- function J(t, e, n, i) {
116
+ function V(t, e, n, i) {
137
117
  return Math.max(1, Math.floor((t - e * 2) / we(n, i)));
138
118
  }
139
- function Ie(t, e, n, i, a) {
119
+ function Xe(t, e, n, i, a) {
140
120
  return e.length <= i && e.every((r) => H(t, r, a) <= n);
141
121
  }
142
122
  function K(t, e, n, i, a, r, l, f) {
143
- t.font = ye(i, a, r, l);
123
+ t.font = Se(i, a, r, l);
144
124
  const s = e.split(" "), h = [];
145
125
  let o = "";
146
126
  for (const d of s) {
147
- const c = o ? `${o} ${d}` : d;
148
- H(t, c, f) > n && o ? (h.push(o), o = d) : o = c;
127
+ const g = o ? `${o} ${d}` : d;
128
+ H(t, g, f) > n && o ? (h.push(o), o = d) : o = g;
149
129
  }
150
130
  return o && h.push(o), h;
151
131
  }
@@ -182,7 +162,7 @@ function Q(t, e, n, i, a) {
182
162
  );
183
163
  });
184
164
  }
185
- function de(t, e, n, i, a, r) {
165
+ function ce(t, e, n, i, a, r) {
186
166
  if (e.length <= n)
187
167
  return Q(
188
168
  t,
@@ -206,7 +186,7 @@ function de(t, e, n, i, a, r) {
206
186
  r
207
187
  );
208
188
  }
209
- function Ee(t) {
189
+ function pe(t) {
210
190
  const {
211
191
  ctx: e,
212
192
  text: n,
@@ -219,12 +199,12 @@ function Ee(t) {
219
199
  fontSize: h,
220
200
  fontFamily: o,
221
201
  letterSpacing: d,
222
- lineSpacing: c,
202
+ lineSpacing: g,
223
203
  overflow: u,
224
204
  resizeToFit: S,
225
- minFontSize: g
205
+ minFontSize: c
226
206
  } = t;
227
- let b = h, m = I(b, d), y = i ?? ge(
207
+ let b = h, m = I(b, d), w = i ?? ge(
228
208
  e,
229
209
  n,
230
210
  a,
@@ -233,9 +213,9 @@ function Ee(t) {
233
213
  b,
234
214
  o,
235
215
  m
236
- ), v = J(r, l, b, c);
216
+ ), v = V(r, l, b, g);
237
217
  const C = S === !0 || u === "shrink";
238
- for (; C && !Ie(e, y, a, v, m) && b > g && (b = Math.max(g, b - 4), m = I(b, d), y = i ?? ge(
218
+ for (; C && !Xe(e, w, a, v, m) && b > c && (b = Math.max(c, b - 4), m = I(b, d), w = i ?? ge(
239
219
  e,
240
220
  n,
241
221
  a,
@@ -244,25 +224,25 @@ function Ee(t) {
244
224
  b,
245
225
  o,
246
226
  m
247
- ), v = J(r, l, b, c), b !== g); )
227
+ ), v = V(r, l, b, g), b !== c); )
248
228
  ;
249
- return u === "ellipsis" ? y = de(
229
+ return u === "ellipsis" ? w = ce(
250
230
  e,
251
- y,
231
+ w,
252
232
  v,
253
233
  a,
254
234
  !0,
255
235
  m
256
- ) : u === "clamp" || u === "shrink" ? y = de(
236
+ ) : u === "clamp" || u === "shrink" ? w = ce(
257
237
  e,
258
- y,
238
+ w,
259
239
  v,
260
240
  a,
261
241
  !1,
262
242
  m
263
- ) : u !== "clip" && (y = Q(e, y, a, void 0, m)), { fontSize: b, lines: y };
243
+ ) : u !== "clip" && (w = Q(e, w, a, void 0, m)), { fontSize: b, lines: w };
264
244
  }
265
- function Re(t) {
245
+ function Ae(t) {
266
246
  const {
267
247
  ctx: e,
268
248
  text: n,
@@ -276,27 +256,27 @@ function Re(t) {
276
256
  letterSpacing: o,
277
257
  lineSpacing: d
278
258
  } = t;
279
- let c = s, u = K(
259
+ let g = s, u = K(
280
260
  e,
281
261
  n,
282
262
  i,
283
263
  l,
284
264
  f,
285
- c,
265
+ g,
286
266
  h,
287
- I(c, o)
267
+ I(g, o)
288
268
  );
289
- const S = J(a, r, c, d);
290
- return u.length > S && (c = Math.max(12, Math.round(c * 0.75)), u = K(
269
+ const S = V(a, r, g, d);
270
+ return u.length > S && (g = Math.max(12, Math.round(g * 0.75)), u = K(
291
271
  e,
292
272
  n,
293
273
  i,
294
274
  l,
295
275
  f,
296
- c,
276
+ g,
297
277
  h,
298
- I(c, o)
299
- )), { fontSize: c, lines: u };
278
+ I(g, o)
279
+ )), { fontSize: g, lines: u };
300
280
  }
301
281
  function Z(t, e) {
302
282
  return typeof OffscreenCanvas < "u" ? new OffscreenCanvas(t, e) : (() => {
@@ -304,9 +284,9 @@ function Z(t, e) {
304
284
  return n.width = t, n.height = e, n;
305
285
  })();
306
286
  }
307
- function De(t, e) {
287
+ function Be(t, e) {
308
288
  const n = e.width - e.padding * 2, a = Array.isArray(e.lines) || e.text.includes(`
309
- `) || e.overflow !== void 0 || e.resizeToFit !== void 0 ? Ee({
289
+ `) || e.overflow !== void 0 || e.resizeToFit !== void 0 ? pe({
310
290
  ctx: t,
311
291
  text: e.text,
312
292
  explicitLines: e.lines,
@@ -322,7 +302,7 @@ function De(t, e) {
322
302
  minFontSize: e.minFontSize,
323
303
  letterSpacing: e.letterSpacing,
324
304
  lineSpacing: e.lineSpacing
325
- }) : Re({
305
+ }) : Ae({
326
306
  ctx: t,
327
307
  text: e.text,
328
308
  maxWidth: n,
@@ -335,18 +315,18 @@ function De(t, e) {
335
315
  letterSpacing: e.letterSpacing,
336
316
  lineSpacing: e.lineSpacing
337
317
  }), r = a.fontSize, l = a.lines;
338
- t.font = ye(e.fontStyle, e.fontWeight, r, e.fontFamily);
318
+ t.font = Se(e.fontStyle, e.fontWeight, r, e.fontFamily);
339
319
  const f = I(r, e.letterSpacing), s = we(r, e.lineSpacing), h = Math.max(
340
320
  r,
341
321
  r + (l.length - 1) * s
342
- ), o = Be(
322
+ ), o = Pe(
343
323
  e.height,
344
324
  e.padding,
345
325
  r,
346
326
  h,
347
327
  e.verticalAlign
348
328
  ), d = l.map(
349
- (c) => H(t, c, f)
329
+ (g) => H(t, g, f)
350
330
  );
351
331
  return {
352
332
  fontSize: r,
@@ -359,23 +339,23 @@ function De(t, e) {
359
339
  Math.max(0, Math.max(...d, 0)) + e.padding * 2
360
340
  ),
361
341
  textBlockHeight: Math.min(e.height, h + e.padding * 2),
362
- textX: pe(e.width, e.padding, e.textAlign)
342
+ textX: ke(e.width, e.padding, e.textAlign)
363
343
  };
364
344
  }
365
- function Ge(t, e, n, i, a, r) {
345
+ function ze(t, e, n, i, a, r) {
366
346
  t.beginPath(), t.moveTo(e + r, n), t.lineTo(e + i - r, n), t.quadraticCurveTo(e + i, n, e + i, n + r), t.lineTo(e + i, n + a - r), t.quadraticCurveTo(e + i, n + a, e + i - r, n + a), t.lineTo(e + r, n + a), t.quadraticCurveTo(e, n + a, e, n + a - r), t.lineTo(e, n + r), t.quadraticCurveTo(e, n, e + r, n), t.closePath();
367
347
  }
368
- function ue(t, e, n) {
348
+ function de(t, e, n) {
369
349
  return typeof t != "number" || Number.isNaN(t) || t <= 0 ? e : Math.min(t, n);
370
350
  }
371
- function $e(t, e) {
372
- const n = ze(
351
+ function Ie(t, e) {
352
+ const n = He(
373
353
  e.canvasWidth,
374
354
  e.panelWidth,
375
355
  e.textAlign,
376
356
  e.bgFit
377
357
  ), i = (e.canvasHeight - e.panelHeight) / 2, a = Math.min(e.borderRadius, Math.min(e.panelWidth, e.panelHeight) / 2);
378
- Ge(t, n, i, e.panelWidth, e.panelHeight, a), _e(t, {
358
+ ze(t, n, i, e.panelWidth, e.panelHeight, a), Re(t, {
379
359
  panelX: n,
380
360
  panelY: i,
381
361
  panelWidth: e.panelWidth,
@@ -390,7 +370,7 @@ function $e(t, e) {
390
370
  bgTextureFlipY: e.bgTextureFlipY
391
371
  }), e.borderColor && e.borderWidth > 0 && (t.lineWidth = e.borderWidth, t.strokeStyle = e.borderColor, t.stroke());
392
372
  }
393
- function _e(t, e) {
373
+ function Re(t, e) {
394
374
  if (t.save(), t.globalAlpha = Math.max(0, Math.min(e.bgOpacity, 1)), e.bgFillMode === "gradient" && e.bgGradientStops && e.bgGradientStops.length > 1) {
395
375
  const n = t.createLinearGradient(
396
376
  e.panelX,
@@ -404,7 +384,7 @@ function _e(t, e) {
404
384
  return;
405
385
  }
406
386
  if (e.bgTextureImage) {
407
- t.clip(), qe(t, {
387
+ t.clip(), Ee(t, {
408
388
  image: e.bgTextureImage,
409
389
  x: e.panelX,
410
390
  y: e.panelY,
@@ -418,17 +398,17 @@ function _e(t, e) {
418
398
  }
419
399
  t.fillStyle = e.bgColor, t.fill(), t.restore();
420
400
  }
421
- function qe(t, e) {
401
+ function Ee(t, e) {
422
402
  const { image: n, x: i, y: a, width: r, height: l, fit: f, flipX: s, flipY: h } = e, o = "naturalWidth" in n ? n.naturalWidth : "videoWidth" in n ? n.videoWidth : n.width, d = "naturalHeight" in n ? n.naturalHeight : "videoHeight" in n ? n.videoHeight : n.height;
423
- let c = r, u = l, S = i, g = a;
403
+ let g = r, u = l, S = i, c = a;
424
404
  if (f !== "stretch" && o > 0 && d > 0) {
425
405
  const b = f === "cover" ? Math.max(r / o, l / d) : Math.min(r / o, l / d);
426
- c = o * b, u = d * b, S = i + (r - c) / 2, g = a + (l - u) / 2;
406
+ g = o * b, u = d * b, S = i + (r - g) / 2, c = a + (l - u) / 2;
427
407
  }
428
- t.save(), (s || h) && (t.translate(s ? i + r : 0, h ? a + l : 0), t.scale(s ? -1 : 1, h ? -1 : 1), S = s ? -(S - i) - c + i : S, g = h ? -(g - a) - u + a : g), t.drawImage(n, S, g, c, u), t.restore();
408
+ t.save(), (s || h) && (t.translate(s ? i + r : 0, h ? a + l : 0), t.scale(s ? -1 : 1, h ? -1 : 1), S = s ? -(S - i) - g + i : S, c = h ? -(c - a) - u + a : c), t.drawImage(n, S, c, g, u), t.restore();
429
409
  }
430
- function Ve(t, e, n, i, a, r) {
431
- const l = a / 72, f = Math.abs(l), s = 1 - Math.min(1, Math.abs(e)), h = Math.min(1, Math.abs(e)), o = i <= 1 ? 0.5 : n / (i - 1), d = Math.sin(o * Math.PI * 2 - Math.PI / 2), c = Math.sin(o * Math.PI * 2.7 - Math.PI / 2) * (0.65 + o * 0.35), u = a * e * e, S = 2 * a * e / r, g = {
410
+ function $e(t, e, n, i, a, r) {
411
+ const l = a / 72, f = Math.abs(l), s = 1 - Math.min(1, Math.abs(e)), h = Math.min(1, Math.abs(e)), o = i <= 1 ? 0.5 : n / (i - 1), d = Math.sin(o * Math.PI * 2 - Math.PI / 2), g = Math.sin(o * Math.PI * 2.7 - Math.PI / 2) * (0.65 + o * 0.35), u = a * e * e, S = 2 * a * e / r, c = {
432
412
  xOffset: 0,
433
413
  yOffset: 0,
434
414
  rotation: 0,
@@ -437,112 +417,112 @@ function Ve(t, e, n, i, a, r) {
437
417
  };
438
418
  switch (t) {
439
419
  case "arc":
440
- return { ...g, yOffset: u, rotation: Math.atan(S) };
420
+ return { ...c, yOffset: u, rotation: Math.atan(S) };
441
421
  case "arc-lower":
442
422
  return {
443
- ...g,
423
+ ...c,
444
424
  yOffset: u * 0.55,
445
425
  scaleY: Math.max(0.2, 1 + l * e * e * 0.45)
446
426
  };
447
427
  case "arc-upper":
448
428
  return {
449
- ...g,
429
+ ...c,
450
430
  yOffset: -u * 0.55,
451
431
  scaleY: Math.max(0.2, 1 - l * e * e * 0.45)
452
432
  };
453
433
  case "arch":
454
- return { ...g, yOffset: u };
434
+ return { ...c, yOffset: u };
455
435
  case "bulge":
456
- return { ...g, scaleY: Math.max(0.2, 1 + l * s * 0.75) };
436
+ return { ...c, scaleY: Math.max(0.2, 1 + l * s * 0.75) };
457
437
  case "shell-lower":
458
438
  return {
459
- ...g,
439
+ ...c,
460
440
  yOffset: a * 0.45 * o * s,
461
441
  scaleY: Math.max(0.2, 1 + l * o * s)
462
442
  };
463
443
  case "shell-upper":
464
444
  return {
465
- ...g,
445
+ ...c,
466
446
  yOffset: -a * 0.45 * (1 - o) * s,
467
447
  scaleY: Math.max(0.2, 1 + l * (1 - o) * s)
468
448
  };
469
449
  case "flag":
470
450
  return {
471
- ...g,
472
- yOffset: a * 0.65 * c,
451
+ ...c,
452
+ yOffset: a * 0.65 * g,
473
453
  rotation: Math.atan(
474
454
  a / Math.max(r, 1) * Math.cos(o * Math.PI * 2.7) * 1.6
475
455
  )
476
456
  };
477
457
  case "wave":
478
458
  return {
479
- ...g,
459
+ ...c,
480
460
  yOffset: a * 0.6 * d,
481
461
  rotation: Math.atan(a / Math.max(r, 1) * Math.cos(o * Math.PI * 2) * 1.4)
482
462
  };
483
463
  case "fish":
484
464
  return {
485
- ...g,
465
+ ...c,
486
466
  scaleX: Math.max(0.25, 1 - f * h * 0.55),
487
467
  scaleY: Math.max(0.2, 1 + l * s)
488
468
  };
489
469
  case "rise":
490
- return { ...g, yOffset: a * e };
470
+ return { ...c, yOffset: a * e };
491
471
  case "fisheye":
492
472
  return {
493
- ...g,
473
+ ...c,
494
474
  yOffset: a * 0.18 * e * s,
495
475
  scaleX: Math.max(0.25, 1 + l * s * 0.7),
496
476
  scaleY: Math.max(0.2, 1 + l * s * 0.7)
497
477
  };
498
478
  case "inflate":
499
479
  return {
500
- ...g,
480
+ ...c,
501
481
  scaleX: Math.max(0.25, 1 + l * s * 0.6),
502
482
  scaleY: Math.max(0.2, 1 + l * s * 0.6)
503
483
  };
504
484
  case "squeeze":
505
- return { ...g, scaleY: Math.max(0.2, 1 - l * s * 0.8) };
485
+ return { ...c, scaleY: Math.max(0.2, 1 - l * s * 0.8) };
506
486
  case "twist":
507
487
  return {
508
- ...g,
488
+ ...c,
509
489
  yOffset: a * e,
510
490
  rotation: l * e * 0.45,
511
491
  scaleY: Math.max(0.2, 1 + l * e * 0.25)
512
492
  };
513
493
  default:
514
- return g;
494
+ return c;
515
495
  }
516
496
  }
517
497
  function P(t, e, n, i, a, r, l = "arc", f = 0) {
518
498
  if (f !== 0) {
519
- Ne(t, e, n, i, a, r, l, f);
499
+ Ge(t, e, n, i, a, r, l, f);
520
500
  return;
521
501
  }
522
- ve(t, a), r === "fill" ? t.fillText(e, n, i) : t.strokeText(e, n, i), Te(t);
502
+ ye(t, a), r === "fill" ? t.fillText(e, n, i) : t.strokeText(e, n, i), ve(t);
523
503
  }
524
- function Ne(t, e, n, i, a, r, l, f) {
504
+ function Ge(t, e, n, i, a, r, l, f) {
525
505
  const s = Array.from(e);
526
506
  if (s.length === 0) return;
527
- const h = s.map((m) => t.measureText(m).width), o = h.reduce((m, y) => m + y, 0) + a * Math.max(0, s.length - 1), d = t.textAlign, c = d === "right" ? n - o : d === "center" ? n - o / 2 : n, S = Math.max(-100, Math.min(f, 100)) / 100 * 72, g = Math.max(o / 2, 1);
528
- let b = c;
507
+ const h = s.map((m) => t.measureText(m).width), o = h.reduce((m, w) => m + w, 0) + a * Math.max(0, s.length - 1), d = t.textAlign, g = d === "right" ? n - o : d === "center" ? n - o / 2 : n, S = Math.max(-100, Math.min(f, 100)) / 100 * 72, c = Math.max(o / 2, 1);
508
+ let b = g;
529
509
  for (let m = 0; m < s.length; m++) {
530
- const y = s[m], v = h[m], C = b + v / 2, F = (C - c - o / 2) / g, x = Ve(
510
+ const w = s[m], v = h[m], C = b + v / 2, W = (C - g - o / 2) / c, x = $e(
531
511
  l,
532
- F,
512
+ W,
533
513
  m,
534
514
  s.length,
535
515
  S,
536
- g
516
+ c
537
517
  );
538
- t.save(), t.translate(C + x.xOffset, i + x.yOffset), t.rotate(x.rotation), t.scale(x.scaleX, x.scaleY), t.textAlign = "center", r === "fill" ? t.fillText(y, 0, 0) : t.strokeText(y, 0, 0), t.restore(), b += v + a;
518
+ t.save(), t.translate(C + x.xOffset, i + x.yOffset), t.rotate(x.rotation), t.scale(x.scaleX, x.scaleY), t.textAlign = "center", r === "fill" ? t.fillText(w, 0, 0) : t.strokeText(w, 0, 0), t.restore(), b += v + a;
539
519
  }
540
520
  }
541
- function be(t, e, n, i, a, r, l, f, s) {
542
- const h = H(t, e, f), o = a === "center" ? n - h / 2 : a === "right" ? n - h : n, d = s === "underline" ? l * 0.42 : -l * 0.08, c = i + d;
543
- t.save(), t.strokeStyle = r, t.lineWidth = Math.max(2, l * 0.06), t.lineCap = "round", t.beginPath(), t.moveTo(o, c), t.lineTo(o + h, c), t.stroke(), t.restore();
521
+ function ue(t, e, n, i, a, r, l, f, s) {
522
+ const h = H(t, e, f), o = a === "center" ? n - h / 2 : a === "right" ? n - h : n, d = s === "underline" ? l * 0.42 : -l * 0.08, g = i + d;
523
+ t.save(), t.strokeStyle = r, t.lineWidth = Math.max(2, l * 0.06), t.lineCap = "round", t.beginPath(), t.moveTo(o, g), t.lineTo(o + h, g), t.stroke(), t.restore();
544
524
  }
545
- function je(t, e) {
525
+ function De(t, e) {
546
526
  for (let n = 0; n < e.lines.length; n++) {
547
527
  const i = e.lines[n], a = e.startY + n * e.lineHeight;
548
528
  for (const r of e.shadowLayers)
@@ -576,7 +556,7 @@ function je(t, e) {
576
556
  "fill",
577
557
  e.bendPreset,
578
558
  e.bendStrength
579
- ), t.restore(), e.underline && be(
559
+ ), t.restore(), e.underline && ue(
580
560
  t,
581
561
  i,
582
562
  e.textX,
@@ -586,7 +566,7 @@ function je(t, e) {
586
566
  e.fontSize,
587
567
  e.letterSpacingPx,
588
568
  "underline"
589
- ), e.strikethrough && be(
569
+ ), e.strikethrough && ue(
590
570
  t,
591
571
  i,
592
572
  e.textX,
@@ -599,7 +579,7 @@ function je(t, e) {
599
579
  );
600
580
  }
601
581
  }
602
- function Ue(t, e) {
582
+ function qe(t, e) {
603
583
  const n = Math.max(0, Math.min(e.intensity, 1));
604
584
  if (n <= 0) return;
605
585
  const i = Math.max(0, Math.min(e.range, 1)), a = i * 72, r = Math.max(-0.5, Math.min(e.horizontalAngle, 0.5)) * 80, l = Math.max(-0.5, Math.min(e.verticalAngle, 0.5)) * 80;
@@ -626,7 +606,7 @@ function Ue(t, e) {
626
606
  )), t.restore();
627
607
  }
628
608
  }
629
- function Je(t, e) {
609
+ function Ne(t, e) {
630
610
  const n = Z(e.width, e.height), i = n.getContext("2d");
631
611
  i.clearRect(0, 0, e.width, e.height), i.font = e.font, i.fillStyle = "#ffffff", i.textAlign = e.textAlign, i.textBaseline = "middle";
632
612
  for (let l = 0; l < e.lines.length; l++)
@@ -643,7 +623,7 @@ function Je(t, e) {
643
623
  const a = Z(e.width, e.height), r = a.getContext("2d");
644
624
  r.clearRect(0, 0, e.width, e.height), r.save(), r.globalAlpha = e.opacity, r.filter = e.blur > 0 ? `blur(${e.blur}px)` : "none", r.drawImage(n, e.offsetX, e.offsetY), r.restore(), r.globalCompositeOperation = "destination-in", r.drawImage(n, 0, 0), r.globalCompositeOperation = "source-in", r.globalAlpha = e.opacity, r.fillStyle = e.color, r.fillRect(0, 0, e.width, e.height), t.drawImage(a, 0, 0);
645
625
  }
646
- function Ke(t) {
626
+ function Ue(t) {
647
627
  const {
648
628
  width: e,
649
629
  height: n,
@@ -656,84 +636,84 @@ function Ke(t) {
656
636
  innerShadow: h,
657
637
  glow: o,
658
638
  shadowColor: d,
659
- shadowBlur: c,
639
+ shadowBlur: g,
660
640
  shadowOffsetX: u,
661
641
  shadowOffsetY: S,
662
- shadowOpacity: g,
642
+ shadowOpacity: c,
663
643
  textAlign: b,
664
644
  bgFillMode: m,
665
- bgOpacity: y,
645
+ bgOpacity: w,
666
646
  bgFit: v,
667
647
  bgAutoSize: C,
668
- bgWidth: F,
648
+ bgWidth: W,
669
649
  bgHeight: x,
670
- bgGradientStops: L,
671
- bgTextureImage: O,
672
- bgTextureFit: E,
673
- bgTextureFlipX: R,
674
- bgTextureFlipY: D,
650
+ bgGradientStops: F,
651
+ bgTextureImage: L,
652
+ bgTextureFit: R,
653
+ bgTextureFlipX: E,
654
+ bgTextureFlipY: $,
675
655
  underline: G,
676
- strikethrough: $,
677
- bendPreset: W,
656
+ strikethrough: D,
657
+ bendPreset: O,
678
658
  bendStrength: Y
679
659
  } = t;
680
- let { fontSize: X, bgColor: A } = t;
681
- const _ = [
660
+ let { fontSize: X, bgColor: p } = t;
661
+ const q = [
682
662
  ...a ?? [],
683
663
  ...r && l > 0 ? [{ color: r, width: l, opacity: f }] : []
684
- ].filter((M) => M.width > 0), q = [
664
+ ].filter((T) => T.width > 0), N = [
685
665
  ...s ?? [],
686
- ...d && (c > 0 || u !== 0 || S !== 0) ? [
666
+ ...d && (g > 0 || u !== 0 || S !== 0) ? [
687
667
  {
688
668
  color: d,
689
- blur: c,
669
+ blur: g,
690
670
  offsetX: u,
691
671
  offsetY: S,
692
- opacity: g
672
+ opacity: c
693
673
  }
694
674
  ] : []
695
- ].filter((M) => M.blur > 0 || (M.offsetX ?? 0) !== 0 || (M.offsetY ?? 0) !== 0);
675
+ ].filter((T) => T.blur > 0 || (T.offsetX ?? 0) !== 0 || (T.offsetY ?? 0) !== 0);
696
676
  let k;
697
- const p = Z(e, n), T = p.getContext("2d");
698
- T.clearRect(0, 0, e, n), T.fillStyle = i, T.textAlign = b, T.textBaseline = "middle";
699
- const w = De(T, t);
700
- if (X = w.fontSize, A !== "transparent") {
701
- const M = C === !0, V = ue(
702
- M ? void 0 : F,
703
- v === "text" || M ? w.textBlockWidth : e,
677
+ const A = Z(e, n), M = A.getContext("2d");
678
+ M.clearRect(0, 0, e, n), M.fillStyle = i, M.textAlign = b, M.textBaseline = "middle";
679
+ const y = Be(M, t);
680
+ if (X = y.fontSize, p !== "transparent") {
681
+ const T = C === !0, U = de(
682
+ T ? void 0 : W,
683
+ v === "text" || T ? y.textBlockWidth : e,
704
684
  e
705
- ), N = ue(
706
- M ? void 0 : x,
707
- v === "text" || M ? w.textBlockHeight : n,
685
+ ), _ = de(
686
+ T ? void 0 : x,
687
+ v === "text" || T ? y.textBlockHeight : n,
708
688
  n
709
689
  );
710
- $e(T, {
690
+ Ie(M, {
711
691
  canvasWidth: e,
712
692
  canvasHeight: n,
713
693
  textAlign: b,
714
694
  bgFit: v,
715
- panelWidth: V,
716
- panelHeight: N,
717
- bgColor: A,
695
+ panelWidth: U,
696
+ panelHeight: _,
697
+ bgColor: p,
718
698
  bgFillMode: m,
719
- bgOpacity: y,
720
- bgGradientStops: L,
721
- bgTextureImage: O,
722
- bgTextureFit: E,
723
- bgTextureFlipX: R,
724
- bgTextureFlipY: D,
699
+ bgOpacity: w,
700
+ bgGradientStops: F,
701
+ bgTextureImage: L,
702
+ bgTextureFit: R,
703
+ bgTextureFlipX: E,
704
+ bgTextureFlipY: $,
725
705
  borderColor: t.borderColor,
726
706
  borderWidth: t.borderWidth,
727
707
  borderRadius: t.borderRadius
728
708
  });
729
709
  }
730
- return o && Ue(T, {
731
- lines: w.resolvedLines,
732
- textX: w.textX,
733
- startY: w.startY,
734
- lineHeight: w.lineHeight,
735
- letterSpacingPx: w.letterSpacingPx,
736
- bendPreset: W,
710
+ return o && qe(M, {
711
+ lines: y.resolvedLines,
712
+ textX: y.textX,
713
+ startY: y.startY,
714
+ lineHeight: y.lineHeight,
715
+ letterSpacingPx: y.letterSpacingPx,
716
+ bendPreset: O,
737
717
  bendStrength: Y,
738
718
  color: o.color,
739
719
  style: o.style,
@@ -741,31 +721,31 @@ function Ke(t) {
741
721
  range: o.range ?? 0.5,
742
722
  horizontalAngle: o.horizontalAngle ?? 0,
743
723
  verticalAngle: o.verticalAngle ?? 0
744
- }), je(T, {
745
- lines: w.resolvedLines,
746
- textX: w.textX,
747
- startY: w.startY,
748
- lineHeight: w.lineHeight,
724
+ }), De(M, {
725
+ lines: y.resolvedLines,
726
+ textX: y.textX,
727
+ startY: y.startY,
728
+ lineHeight: y.lineHeight,
749
729
  textAlign: b,
750
730
  color: i,
751
731
  fontSize: X,
752
- letterSpacingPx: w.letterSpacingPx,
753
- bendPreset: W,
732
+ letterSpacingPx: y.letterSpacingPx,
733
+ bendPreset: O,
754
734
  bendStrength: Y,
755
- shadowLayers: q,
756
- strokeLayers: _,
735
+ shadowLayers: N,
736
+ strokeLayers: q,
757
737
  underline: G,
758
- strikethrough: $
759
- }), h && Je(T, {
738
+ strikethrough: D
739
+ }), h && Ne(M, {
760
740
  width: e,
761
741
  height: n,
762
- font: T.font,
763
- lines: w.resolvedLines,
764
- textX: w.textX,
765
- startY: w.startY,
766
- lineHeight: w.lineHeight,
767
- letterSpacingPx: w.letterSpacingPx,
768
- bendPreset: W,
742
+ font: M.font,
743
+ lines: y.resolvedLines,
744
+ textX: y.textX,
745
+ startY: y.startY,
746
+ lineHeight: y.lineHeight,
747
+ letterSpacingPx: y.letterSpacingPx,
748
+ bendPreset: O,
769
749
  bendStrength: Y,
770
750
  textAlign: b,
771
751
  color: h.color,
@@ -773,9 +753,9 @@ function Ke(t) {
773
753
  blur: h.blur,
774
754
  offsetX: h.offsetX ?? 0,
775
755
  offsetY: h.offsetY ?? 0
776
- }), k = new We.CanvasTexture(p), k.needsUpdate = !0, k;
756
+ }), k = new We.CanvasTexture(A), k.needsUpdate = !0, k;
777
757
  }
778
- function Qe(t, e) {
758
+ function _e(t, e) {
779
759
  const {
780
760
  lines: n,
781
761
  color: i,
@@ -787,37 +767,37 @@ function Qe(t, e) {
787
767
  shadowLayers: h,
788
768
  shadowEnabled: o,
789
769
  innerShadow: d,
790
- glow: c,
770
+ glow: g,
791
771
  shadowColor: u,
792
772
  shadowBlur: S,
793
- shadowOffsetX: g,
773
+ shadowOffsetX: c,
794
774
  shadowOffsetY: b,
795
775
  shadowOpacity: m,
796
- fontWeight: y,
776
+ fontWeight: w,
797
777
  fontStyle: v,
798
778
  fontFamily: C,
799
- fontSize: F,
779
+ fontSize: W,
800
780
  textAlign: x,
801
- verticalAlign: L,
802
- overflow: O,
803
- resizeToFit: E,
804
- minFontSize: R,
805
- letterSpacing: D,
781
+ verticalAlign: F,
782
+ overflow: L,
783
+ resizeToFit: R,
784
+ minFontSize: E,
785
+ letterSpacing: $,
806
786
  lineSpacing: G,
807
- bgFillMode: $,
808
- bgOpacity: W,
787
+ bgFillMode: D,
788
+ bgOpacity: O,
809
789
  bgFit: Y,
810
790
  bgAutoSize: X,
811
- bgWidth: A,
812
- bgHeight: _,
813
- bgGradientStops: q,
791
+ bgWidth: p,
792
+ bgHeight: q,
793
+ bgGradientStops: N,
814
794
  bgTextureFit: k,
815
- bgTextureFlipX: p,
816
- bgTextureFlipY: T,
817
- borderColor: w,
818
- borderWidth: M,
819
- borderRadius: V,
820
- padding: N,
795
+ bgTextureFlipX: A,
796
+ bgTextureFlipY: M,
797
+ borderColor: y,
798
+ borderWidth: T,
799
+ borderRadius: U,
800
+ padding: _,
821
801
  aspect: ee,
822
802
  resolution: j,
823
803
  underline: te,
@@ -841,39 +821,39 @@ function Qe(t, e) {
841
821
  strokeOpacity: s,
842
822
  shadowLayers: le,
843
823
  innerShadow: d,
844
- glow: c,
824
+ glow: g,
845
825
  shadowColor: o === !1 ? void 0 : u,
846
826
  shadowBlur: o === !1 ? 0 : S,
847
- shadowOffsetX: o === !1 ? 0 : g,
827
+ shadowOffsetX: o === !1 ? 0 : c,
848
828
  shadowOffsetY: o === !1 ? 0 : b,
849
829
  shadowOpacity: m,
850
- fontWeight: y,
830
+ fontWeight: w,
851
831
  fontStyle: v,
852
832
  fontFamily: C,
853
- fontSize: F,
833
+ fontSize: W,
854
834
  textAlign: x,
855
- verticalAlign: L,
856
- overflow: O,
857
- resizeToFit: E,
858
- minFontSize: R,
859
- letterSpacing: D,
835
+ verticalAlign: F,
836
+ overflow: L,
837
+ resizeToFit: R,
838
+ minFontSize: E,
839
+ letterSpacing: $,
860
840
  lineSpacing: G,
861
841
  bgColor: e.bgColor,
862
- bgFillMode: $,
863
- bgOpacity: W,
842
+ bgFillMode: D,
843
+ bgOpacity: O,
864
844
  bgFit: Y,
865
845
  bgAutoSize: X,
866
- bgWidth: A,
867
- bgHeight: _,
868
- bgGradientStops: q,
846
+ bgWidth: p,
847
+ bgHeight: q,
848
+ bgGradientStops: N,
869
849
  bgTextureImage: oe,
870
850
  bgTextureFit: k,
871
- bgTextureFlipX: p,
872
- bgTextureFlipY: T,
873
- borderColor: w,
874
- borderWidth: M,
875
- borderRadius: V,
876
- padding: N,
851
+ bgTextureFlipX: A,
852
+ bgTextureFlipY: M,
853
+ borderColor: y,
854
+ borderWidth: T,
855
+ borderRadius: U,
856
+ padding: _,
877
857
  height: j,
878
858
  width: Math.round(j * Math.max(ee, 0.1)),
879
859
  underline: te,
@@ -893,39 +873,39 @@ function Qe(t, e) {
893
873
  s,
894
874
  le,
895
875
  d,
896
- c,
876
+ g,
897
877
  o,
898
878
  u,
899
879
  S,
900
- g,
880
+ c,
901
881
  b,
902
882
  m,
903
- y,
883
+ w,
904
884
  v,
905
885
  C,
906
- F,
886
+ W,
907
887
  x,
888
+ F,
908
889
  L,
909
- O,
910
- E,
911
890
  R,
912
- D,
913
- G,
891
+ E,
914
892
  $,
915
- W,
893
+ G,
894
+ D,
895
+ O,
916
896
  Y,
917
897
  X,
918
- A,
919
- _,
898
+ p,
920
899
  q,
900
+ N,
921
901
  oe,
922
902
  k,
923
- p,
924
- T,
925
- w,
903
+ A,
926
904
  M,
927
- V,
928
- N,
905
+ y,
906
+ T,
907
+ U,
908
+ _,
929
909
  ee,
930
910
  j,
931
911
  te,
@@ -933,12 +913,12 @@ function Qe(t, e) {
933
913
  re,
934
914
  ie
935
915
  ]
936
- ), fe = B(() => Ke(se), [se]);
937
- return Ae(fe), fe;
916
+ ), fe = B(() => Ue(se), [se]);
917
+ return Ye(fe), fe;
938
918
  }
939
- const Ze = ["color"];
940
- function at(t) {
941
- const e = He(t, Ze), n = { ...Xe, ...e }, {
919
+ const je = ["color"];
920
+ function tt(t) {
921
+ const e = Le(t, je), n = { ...Oe, ...e }, {
942
922
  text: i,
943
923
  bgColor: a,
944
924
  opacity: r,
@@ -948,20 +928,20 @@ function at(t) {
948
928
  rotation: h,
949
929
  scale: o,
950
930
  visible: d,
951
- renderOrder: c
952
- } = n, [u, S] = he(null), [g, b] = he(null), m = U(i);
931
+ renderOrder: g
932
+ } = n, [u, S] = he(null), [c, b] = he(null), m = J(i);
953
933
  m.current !== i && (m.current = i, u !== null && S(null));
954
- const y = U(a);
955
- y.current !== a && (y.current = a, g !== null && b(null));
956
- const v = U(null), x = Qe(n, { text: u ?? i, bgColor: g ?? a });
957
- return me(() => {
958
- const L = v.current;
959
- if (L)
960
- return L.userData.setText = (O) => S(O), L.userData.setBgColor = (O) => b(O), () => {
961
- delete L.userData.setText, delete L.userData.setBgColor;
934
+ const w = J(a);
935
+ w.current !== a && (w.current = a, c !== null && b(null));
936
+ const v = J(null), x = _e(n, { text: u ?? i, bgColor: c ?? a });
937
+ return be(() => {
938
+ const F = v.current;
939
+ if (F)
940
+ return F.userData.setText = (L) => S(L), F.userData.setBgColor = (L) => b(L), () => {
941
+ delete F.userData.setText, delete F.userData.setBgColor;
962
942
  };
963
943
  }, []), /* @__PURE__ */ z(
964
- Se,
944
+ me,
965
945
  {
966
946
  ref: v,
967
947
  name: l,
@@ -972,13 +952,12 @@ function at(t) {
972
952
  rotation: h,
973
953
  scale: o,
974
954
  visible: d,
975
- renderOrder: c
955
+ renderOrder: g
976
956
  }
977
957
  );
978
958
  }
979
959
  export {
980
- it as S,
981
- at as T,
982
- He as a,
983
- Ae as u
960
+ et as S,
961
+ tt as T,
962
+ Ye as u
984
963
  };